code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public String invokeOperationToString(ObjectName name, String operName, String... paramStrings) throws Exception {
return ClientUtils.valueToString(invokeOperation(name, operName, paramStrings));
} | class class_name[name] begin[{]
method[invokeOperationToString, return_type[type[String]], modifier[public], parameter[name, operName, paramStrings]] begin[{]
return[call[ClientUtils.valueToString, parameter[call[.invokeOperation, parameter[member[.name], member[.operName], member[.paramStrings]]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[invokeOperationToString] operator[SEP] identifier[ObjectName] identifier[name] , identifier[String] identifier[operName] , identifier[String] operator[...] identifier[paramStrings] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[ClientUtils] operator[SEP] identifier[valueToString] operator[SEP] identifier[invokeOperation] operator[SEP] identifier[name] , identifier[operName] , identifier[paramStrings] operator[SEP] operator[SEP] operator[SEP]
}
|
public void defineColumnHeaderByKey(HeaderColumnKey xObject) {
int x = layout.addColumn();
xMap.put(xObject, x);
} | class class_name[name] begin[{]
method[defineColumnHeaderByKey, return_type[void], modifier[public], parameter[xObject]] begin[{]
local_variable[type[int], x]
call[xMap.put, parameter[member[.xObject], member[.x]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[defineColumnHeaderByKey] operator[SEP] identifier[HeaderColumnKey] identifier[xObject] operator[SEP] {
Keyword[int] identifier[x] operator[=] identifier[layout] operator[SEP] identifier[addColumn] operator[SEP] operator[SEP] operator[SEP] identifier[xMap] operator[SEP] identifier[put] operator[SEP] identifier[xObject] , identifier[x] operator[SEP] operator[SEP]
}
|
public Observable<Page<SyncGroupInner>> listByDatabaseNextAsync(final String nextPageLink) {
return listByDatabaseNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<SyncGroupInner>>, Page<SyncGroupInner>>() {
@Override
public Page<SyncGroupInner> call(ServiceResponse<Page<SyncGroupInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listByDatabaseNextAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
return[call[.listByDatabaseNextWithServiceResponseAsync, parameter[member[.nextPageLink]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[SyncGroupInner] operator[>] operator[>] identifier[listByDatabaseNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listByDatabaseNextWithServiceResponseAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SyncGroupInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[SyncGroupInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[SyncGroupInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SyncGroupInner] 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 streamselector[] get_filtered(nitro_service service, String filter) throws Exception{
streamselector obj = new streamselector();
options option = new options();
option.set_filter(filter);
streamselector[] response = (streamselector[]) obj.getfiltered(service, option);
return response;
} | class class_name[name] begin[{]
method[get_filtered, return_type[type[streamselector]], modifier[public static], parameter[service, filter]] begin[{]
local_variable[type[streamselector], obj]
local_variable[type[options], option]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[streamselector], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[streamselector] operator[SEP] operator[SEP] identifier[get_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[streamselector] identifier[obj] operator[=] Keyword[new] identifier[streamselector] 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[streamselector] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[streamselector] 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]
}
|
public static <T> EditableTextField<T> of(final String id, final IModel<T> model,
final IModel<String> labelModel, final ModeContext modeContext)
{
final EditableTextField<T> editableTextField = new EditableTextField<>(id, model,
labelModel, modeContext);
return editableTextField;
} | class class_name[name] begin[{]
method[of, return_type[type[EditableTextField]], modifier[public static], parameter[id, model, labelModel, modeContext]] begin[{]
local_variable[type[EditableTextField], editableTextField]
return[member[.editableTextField]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[EditableTextField] operator[<] identifier[T] operator[>] identifier[of] operator[SEP] Keyword[final] identifier[String] identifier[id] , Keyword[final] identifier[IModel] operator[<] identifier[T] operator[>] identifier[model] , Keyword[final] identifier[IModel] operator[<] identifier[String] operator[>] identifier[labelModel] , Keyword[final] identifier[ModeContext] identifier[modeContext] operator[SEP] {
Keyword[final] identifier[EditableTextField] operator[<] identifier[T] operator[>] identifier[editableTextField] operator[=] Keyword[new] identifier[EditableTextField] operator[<] operator[>] operator[SEP] identifier[id] , identifier[model] , identifier[labelModel] , identifier[modeContext] operator[SEP] operator[SEP] Keyword[return] identifier[editableTextField] operator[SEP]
}
|
@Override
public AnycastInputHandler getAnycastInputHandler(SIBUuid8 dmeId, SIBUuid12 gatheringTargetDestUuid, boolean createAIH)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getAnycastInputHandler", new Object[] { dmeId, gatheringTargetDestUuid, Boolean.valueOf(createAIH) });
AnycastInputHandler aih = _targetDestinationHandler.getAnycastInputHandler(dmeId, gatheringTargetDestUuid, createAIH);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAnycastInputHandler", aih);
return aih;
} | class class_name[name] begin[{]
method[getAnycastInputHandler, return_type[type[AnycastInputHandler]], modifier[public], parameter[dmeId, gatheringTargetDestUuid, createAIH]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getAnycastInputHandler"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=dmeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=gatheringTargetDestUuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=createAIH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[AnycastInputHandler], aih]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["getAnycastInputHandler"], member[.aih]]]
else begin[{]
None
end[}]
return[member[.aih]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[AnycastInputHandler] identifier[getAnycastInputHandler] operator[SEP] identifier[SIBUuid8] identifier[dmeId] , identifier[SIBUuid12] identifier[gatheringTargetDestUuid] , Keyword[boolean] identifier[createAIH] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[dmeId] , identifier[gatheringTargetDestUuid] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[createAIH] operator[SEP]
} operator[SEP] operator[SEP] identifier[AnycastInputHandler] identifier[aih] operator[=] identifier[_targetDestinationHandler] operator[SEP] identifier[getAnycastInputHandler] operator[SEP] identifier[dmeId] , identifier[gatheringTargetDestUuid] , identifier[createAIH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[aih] operator[SEP] operator[SEP] Keyword[return] identifier[aih] operator[SEP]
}
|
private final void unlockNonPersistentMessages(java.util.ArrayList unlockList)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockNonPersistentMessages", unlockList);
try
{
int length = unlockList.size();
for (int i = 0; i < length; i++)
{
AOValue value = (AOValue) unlockList.get(i);
dem.removeTimeoutEntry(value);
SIMPMessage msgItem = consumerDispatcher.getMessageByValue(value);
// PK67067 We may not find a message in the store for this tick, because
// it may have been removed using the SIBQueuePoint MBean
if (msgItem != null) msgItem.unlockMsg(msgItem.getLockID(),null, true);
}
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.unlockNonPersistentMessages",
"1:2846:1.80.3.24",
this);
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockNonPersistentMessages");
} | class class_name[name] begin[{]
method[unlockNonPersistentMessages, return_type[void], modifier[final private], parameter[unlockList]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["unlockNonPersistentMessages"], member[.unlockList]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=unlockList, selectors=[], type_arguments=None), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=unlockList, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AOValue, sub_type=None)), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AOValue, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeTimeoutEntry, postfix_operators=[], prefix_operators=[], qualifier=dem, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessageByValue, postfix_operators=[], prefix_operators=[], qualifier=consumerDispatcher, selectors=[], type_arguments=None), name=msgItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SIMPMessage, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=msgItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLockID, postfix_operators=[], prefix_operators=[], qualifier=msgItem, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=unlockMsg, postfix_operators=[], prefix_operators=[], qualifier=msgItem, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.AOStream.unlockNonPersistentMessages"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2846:1.80.3.24"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["unlockNonPersistentMessages"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[final] Keyword[void] identifier[unlockNonPersistentMessages] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] identifier[unlockList] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[unlockList] operator[SEP] operator[SEP] Keyword[try] {
Keyword[int] identifier[length] operator[=] identifier[unlockList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[AOValue] identifier[value] operator[=] operator[SEP] identifier[AOValue] operator[SEP] identifier[unlockList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dem] operator[SEP] identifier[removeTimeoutEntry] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[SIMPMessage] identifier[msgItem] operator[=] identifier[consumerDispatcher] operator[SEP] identifier[getMessageByValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msgItem] operator[!=] Other[null] operator[SEP] identifier[msgItem] operator[SEP] identifier[unlockMsg] operator[SEP] identifier[msgItem] operator[SEP] identifier[getLockID] operator[SEP] operator[SEP] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public <T> T getItem(final List<T> items, final int probability, final T defaultItem) {
if (items == null) {
throw new IllegalArgumentException("Item list cannot be null");
}
if (items.isEmpty()) {
throw new IllegalArgumentException("Item list cannot be empty");
}
return chance(probability) ? items.get(random.nextInt(items.size())) : defaultItem;
} | class class_name[name] begin[{]
method[getItem, return_type[type[T]], modifier[public], parameter[items, probability, defaultItem]] begin[{]
if[binary_operation[member[.items], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Item list cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[items.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Item list cannot be empty")], 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[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=probability, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=chance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MemberReference(member=defaultItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None)], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=random, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getItem] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[T] operator[>] identifier[items] , Keyword[final] Keyword[int] identifier[probability] , Keyword[final] identifier[T] identifier[defaultItem] operator[SEP] {
Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[items] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[chance] operator[SEP] identifier[probability] operator[SEP] operator[?] identifier[items] operator[SEP] identifier[get] operator[SEP] identifier[random] operator[SEP] identifier[nextInt] operator[SEP] identifier[items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[defaultItem] operator[SEP]
}
|
private static String scalaVersion() {
String scalaVersion = "";
try {
Class<?> scalaProperties = Class.forName("scala.util.Properties");
scalaVersion = "scala";
String version = (String)scalaProperties.getMethod("versionNumberString").invoke(null);
scalaVersion = concat(scalaVersion, version, "/");
} catch (ClassNotFoundException e) {
//Ignore
} catch (Exception e) {
if (log.isTraceEnabled()){
log.trace("Exception attempting to get Scala version.", e);
}
}
return scalaVersion;
} | class class_name[name] begin[{]
method[scalaVersion, return_type[type[String]], modifier[private static], parameter[]] begin[{]
local_variable[type[String], scalaVersion]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="scala.util.Properties")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), name=scalaProperties)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalaVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="scala")), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="versionNumberString")], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=scalaProperties, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=version)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalaVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=scalaVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=concat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException'])), CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception attempting to get Scala version."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=trace, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.scalaVersion]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[scalaVersion] operator[SEP] operator[SEP] {
identifier[String] identifier[scalaVersion] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[Class] operator[<] operator[?] operator[>] identifier[scalaProperties] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[scalaVersion] operator[=] literal[String] operator[SEP] identifier[String] identifier[version] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[scalaProperties] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[invoke] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[scalaVersion] operator[=] identifier[concat] operator[SEP] identifier[scalaVersion] , identifier[version] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[scalaVersion] operator[SEP]
}
|
public void marshall(TopicRule topicRule, ProtocolMarshaller protocolMarshaller) {
if (topicRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(topicRule.getRuleName(), RULENAME_BINDING);
protocolMarshaller.marshall(topicRule.getSql(), SQL_BINDING);
protocolMarshaller.marshall(topicRule.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(topicRule.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(topicRule.getActions(), ACTIONS_BINDING);
protocolMarshaller.marshall(topicRule.getRuleDisabled(), RULEDISABLED_BINDING);
protocolMarshaller.marshall(topicRule.getAwsIotSqlVersion(), AWSIOTSQLVERSION_BINDING);
protocolMarshaller.marshall(topicRule.getErrorAction(), ERRORACTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[topicRule, protocolMarshaller]] begin[{]
if[binary_operation[member[.topicRule], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRuleName, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=RULENAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSql, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=SQL_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDescription, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=DESCRIPTION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCreatedAt, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=CREATEDAT_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=ACTIONS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRuleDisabled, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=RULEDISABLED_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAwsIotSqlVersion, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=AWSIOTSQLVERSION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getErrorAction, postfix_operators=[], prefix_operators=[], qualifier=topicRule, selectors=[], type_arguments=None), MemberReference(member=ERRORACTION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[TopicRule] identifier[topicRule] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[topicRule] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getRuleName] operator[SEP] operator[SEP] , identifier[RULENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getSql] operator[SEP] operator[SEP] , identifier[SQL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] , identifier[DESCRIPTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getCreatedAt] operator[SEP] operator[SEP] , identifier[CREATEDAT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] , identifier[ACTIONS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getRuleDisabled] operator[SEP] operator[SEP] , identifier[RULEDISABLED_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getAwsIotSqlVersion] operator[SEP] operator[SEP] , identifier[AWSIOTSQLVERSION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[topicRule] operator[SEP] identifier[getErrorAction] operator[SEP] operator[SEP] , identifier[ERRORACTION_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public R finish() throws X, DbxException {
assertOpenAndUnfinished();
HttpRequestor.Response response = null;
try {
response = httpUploader.finish();
try {
if (response.getStatusCode() == 200) {
return responseSerializer.deserialize(response.getBody());
}
else if (response.getStatusCode() == 409) {
DbxWrappedException wrapped = DbxWrappedException.fromResponse(errorSerializer, response, this.userId);
throw newException(wrapped);
}
else {
throw DbxRequestUtil.unexpectedStatus(response);
}
} catch (JsonProcessingException ex) {
String requestId = DbxRequestUtil.getRequestId(response);
throw new BadResponseException(requestId, "Bad JSON in response: " + ex, ex);
}
} catch (IOException ex) {
throw new NetworkIOException(ex);
} finally {
// Make sure input stream is closed
if (response != null) {
IOUtil.closeQuietly(response.getBody());
}
finished = true;
}
} | class class_name[name] begin[{]
method[finish, return_type[type[R]], modifier[public], parameter[]] begin[{]
call[.assertOpenAndUnfinished, parameter[]]
local_variable[type[HttpRequestor], response]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=finish, postfix_operators=[], prefix_operators=[], qualifier=httpUploader, selectors=[], type_arguments=None)), label=None), TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=409), operator===), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unexpectedStatus, postfix_operators=[], prefix_operators=[], qualifier=DbxRequestUtil, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=errorSerializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=userId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=fromResponse, postfix_operators=[], prefix_operators=[], qualifier=DbxWrappedException, selectors=[], type_arguments=None), name=wrapped)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DbxWrappedException, sub_type=None)), ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=wrapped, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], member=deserialize, postfix_operators=[], prefix_operators=[], qualifier=responseSerializer, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRequestId, postfix_operators=[], prefix_operators=[], qualifier=DbxRequestUtil, selectors=[], type_arguments=None), name=requestId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=requestId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad JSON in response: "), operandr=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), 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=BadResponseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['JsonProcessingException']))], finally_block=None, label=None, resources=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=NetworkIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=response, 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=[MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], member=closeQuietly, postfix_operators=[], prefix_operators=[], qualifier=IOUtil, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=finished, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[R] identifier[finish] operator[SEP] operator[SEP] Keyword[throws] identifier[X] , identifier[DbxException] {
identifier[assertOpenAndUnfinished] operator[SEP] operator[SEP] operator[SEP] identifier[HttpRequestor] operator[SEP] identifier[Response] identifier[response] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[response] operator[=] identifier[httpUploader] operator[SEP] identifier[finish] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[==] Other[200] operator[SEP] {
Keyword[return] identifier[responseSerializer] operator[SEP] identifier[deserialize] operator[SEP] identifier[response] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[==] Other[409] operator[SEP] {
identifier[DbxWrappedException] identifier[wrapped] operator[=] identifier[DbxWrappedException] operator[SEP] identifier[fromResponse] operator[SEP] identifier[errorSerializer] , identifier[response] , Keyword[this] operator[SEP] identifier[userId] operator[SEP] operator[SEP] Keyword[throw] identifier[newException] operator[SEP] identifier[wrapped] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[DbxRequestUtil] operator[SEP] identifier[unexpectedStatus] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[JsonProcessingException] identifier[ex] operator[SEP] {
identifier[String] identifier[requestId] operator[=] identifier[DbxRequestUtil] operator[SEP] identifier[getRequestId] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[BadResponseException] operator[SEP] identifier[requestId] , literal[String] operator[+] identifier[ex] , identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NetworkIOException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[response] operator[!=] Other[null] operator[SEP] {
identifier[IOUtil] operator[SEP] identifier[closeQuietly] operator[SEP] identifier[response] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[finished] operator[=] literal[boolean] operator[SEP]
}
}
|
static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) {
final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId());
final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader);
return PatchingTask.Factory.create(description, context);
} | class class_name[name] begin[{]
method[createTask, return_type[type[PatchingTask]], modifier[static], parameter[definition, provider, context]] begin[{]
local_variable[type[PatchContentLoader], contentLoader]
local_variable[type[PatchingTaskDescription], description]
return[call[PatchingTask.Factory.create, parameter[member[.description], member[.context]]]]
end[}]
END[}] | Keyword[static] identifier[PatchingTask] identifier[createTask] operator[SEP] Keyword[final] identifier[PatchingTasks] operator[SEP] identifier[ContentTaskDefinition] identifier[definition] , Keyword[final] identifier[PatchContentProvider] identifier[provider] , Keyword[final] identifier[IdentityPatchContext] operator[SEP] identifier[PatchEntry] identifier[context] operator[SEP] {
Keyword[final] identifier[PatchContentLoader] identifier[contentLoader] operator[=] identifier[provider] operator[SEP] identifier[getLoader] operator[SEP] identifier[definition] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] identifier[getPatchId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PatchingTaskDescription] identifier[description] operator[=] identifier[PatchingTaskDescription] operator[SEP] identifier[create] operator[SEP] identifier[definition] , identifier[contentLoader] operator[SEP] operator[SEP] Keyword[return] identifier[PatchingTask] operator[SEP] identifier[Factory] operator[SEP] identifier[create] operator[SEP] identifier[description] , identifier[context] operator[SEP] operator[SEP]
}
|
public String send_bat_sms(Map<String, Object> data) {
String id = data.get("id").toString();
String to = data.get("to").toString();
Gson gson = new Gson();
String json = gson.toJson(data);
return get("sms/" + id + "/" + to, EMPTY_STRING);
} | class class_name[name] begin[{]
method[send_bat_sms, return_type[type[String]], modifier[public], parameter[data]] begin[{]
local_variable[type[String], id]
local_variable[type[String], to]
local_variable[type[Gson], gson]
local_variable[type[String], json]
return[call[.get, parameter[binary_operation[binary_operation[binary_operation[literal["sms/"], +, member[.id]], +, literal["/"]], +, member[.to]], member[.EMPTY_STRING]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[send_bat_sms] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[data] operator[SEP] {
identifier[String] identifier[id] operator[=] identifier[data] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[to] operator[=] identifier[data] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Gson] identifier[gson] operator[=] Keyword[new] identifier[Gson] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[json] operator[=] identifier[gson] operator[SEP] identifier[toJson] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[return] identifier[get] operator[SEP] literal[String] operator[+] identifier[id] operator[+] literal[String] operator[+] identifier[to] , identifier[EMPTY_STRING] operator[SEP] operator[SEP]
}
|
static boolean isJavaBaseAssignable( Class<?> lhsType, Class<?> rhsType )
{
/*
Assignment to loose type, defer to bsh extensions
Note: we could shortcut this here:
if ( lhsType == null ) return true;
rather than forcing another round. It's not strictly a Java issue,
so does it belong here?
*/
if ( lhsType == null )
return false;
// null rhs type corresponds to type of Primitive.NULL assignable to any
// object type but we give preference here to string types
if ( rhsType == null )
return lhsType == String.class;
if ( lhsType.isPrimitive() && rhsType.isPrimitive() ) {
if ( lhsType == rhsType )
return true;
// handle primitive widening conversions - JLS 5.1.2
if ( NUMBER_ORDER.containsKey(rhsType)
&& NUMBER_ORDER.containsKey(lhsType) )
return NUMBER_ORDER.get(rhsType) < NUMBER_ORDER.get(lhsType);
}
else if ( lhsType.isAssignableFrom(rhsType) )
return true;
return false;
} | class class_name[name] begin[{]
method[isJavaBaseAssignable, return_type[type[boolean]], modifier[static], parameter[lhsType, rhsType]] begin[{]
if[binary_operation[member[.lhsType], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.rhsType], ==, literal[null]]] begin[{]
return[binary_operation[member[.lhsType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[call[lhsType.isPrimitive, parameter[]], &&, call[rhsType.isPrimitive, parameter[]]]] begin[{]
if[binary_operation[member[.lhsType], ==, member[.rhsType]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[NUMBER_ORDER.containsKey, parameter[member[.rhsType]]], &&, call[NUMBER_ORDER.containsKey, parameter[member[.lhsType]]]]] begin[{]
return[binary_operation[call[NUMBER_ORDER.get, parameter[member[.rhsType]]], <, call[NUMBER_ORDER.get, parameter[member[.lhsType]]]]]
else begin[{]
None
end[}]
else begin[{]
if[call[lhsType.isAssignableFrom, parameter[member[.rhsType]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[static] Keyword[boolean] identifier[isJavaBaseAssignable] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[lhsType] , identifier[Class] operator[<] operator[?] operator[>] identifier[rhsType] operator[SEP] {
Keyword[if] operator[SEP] identifier[lhsType] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[rhsType] operator[==] Other[null] operator[SEP] Keyword[return] identifier[lhsType] operator[==] identifier[String] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] identifier[lhsType] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[&&] identifier[rhsType] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[lhsType] operator[==] identifier[rhsType] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[NUMBER_ORDER] operator[SEP] identifier[containsKey] operator[SEP] identifier[rhsType] operator[SEP] operator[&&] identifier[NUMBER_ORDER] operator[SEP] identifier[containsKey] operator[SEP] identifier[lhsType] operator[SEP] operator[SEP] Keyword[return] identifier[NUMBER_ORDER] operator[SEP] identifier[get] operator[SEP] identifier[rhsType] operator[SEP] operator[<] identifier[NUMBER_ORDER] operator[SEP] identifier[get] operator[SEP] identifier[lhsType] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lhsType] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[rhsType] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public FastFloatBuffer append(final float[] array, final int off, final int len) {
if (offset + len - buffer.length > 0) {
grow(offset + len);
}
System.arraycopy(array, off, buffer, offset, len);
offset += len;
return this;
} | class class_name[name] begin[{]
method[append, return_type[type[FastFloatBuffer]], modifier[public], parameter[array, off, len]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.offset], +, member[.len]], -, member[buffer.length]], >, literal[0]]] begin[{]
call[.grow, parameter[binary_operation[member[.offset], +, member[.len]]]]
else begin[{]
None
end[}]
call[System.arraycopy, parameter[member[.array], member[.off], member[.buffer], member[.offset], member[.len]]]
assign[member[.offset], member[.len]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[FastFloatBuffer] identifier[append] operator[SEP] Keyword[final] Keyword[float] operator[SEP] operator[SEP] identifier[array] , Keyword[final] Keyword[int] identifier[off] , Keyword[final] Keyword[int] identifier[len] operator[SEP] {
Keyword[if] operator[SEP] identifier[offset] operator[+] identifier[len] operator[-] identifier[buffer] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[grow] operator[SEP] identifier[offset] operator[+] identifier[len] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[array] , identifier[off] , identifier[buffer] , identifier[offset] , identifier[len] operator[SEP] operator[SEP] identifier[offset] operator[+=] identifier[len] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Dimension getMinDimension() {
long effWithMin = getEffectiveMinWidth();
long effHeightMin = getEffectiveMinHeight();
double effRatio = getRatio();
if (effWithMin == 0 && effHeightMin > 0 && effRatio > 0) {
effWithMin = Math.round(effHeightMin * effRatio);
}
if (effWithMin > 0 && effHeightMin == 0 && effRatio > 0) {
effHeightMin = Math.round(effWithMin / effRatio);
}
if (effWithMin > 0 || effHeightMin > 0) {
return new Dimension(effWithMin, effHeightMin);
}
else {
return null;
}
} | class class_name[name] begin[{]
method[getMinDimension, return_type[type[Dimension]], modifier[public], parameter[]] begin[{]
local_variable[type[long], effWithMin]
local_variable[type[long], effHeightMin]
local_variable[type[double], effRatio]
if[binary_operation[binary_operation[binary_operation[member[.effWithMin], ==, literal[0]], &&, binary_operation[member[.effHeightMin], >, literal[0]]], &&, binary_operation[member[.effRatio], >, literal[0]]]] begin[{]
assign[member[.effWithMin], call[Math.round, parameter[binary_operation[member[.effHeightMin], *, member[.effRatio]]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.effWithMin], >, literal[0]], &&, binary_operation[member[.effHeightMin], ==, literal[0]]], &&, binary_operation[member[.effRatio], >, literal[0]]]] begin[{]
assign[member[.effHeightMin], call[Math.round, parameter[binary_operation[member[.effWithMin], /, member[.effRatio]]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.effWithMin], >, literal[0]], ||, binary_operation[member[.effHeightMin], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=effWithMin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=effHeightMin, 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=Dimension, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[Dimension] identifier[getMinDimension] operator[SEP] operator[SEP] {
Keyword[long] identifier[effWithMin] operator[=] identifier[getEffectiveMinWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[effHeightMin] operator[=] identifier[getEffectiveMinHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[effRatio] operator[=] identifier[getRatio] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[effWithMin] operator[==] Other[0] operator[&&] identifier[effHeightMin] operator[>] Other[0] operator[&&] identifier[effRatio] operator[>] Other[0] operator[SEP] {
identifier[effWithMin] operator[=] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[effHeightMin] operator[*] identifier[effRatio] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[effWithMin] operator[>] Other[0] operator[&&] identifier[effHeightMin] operator[==] Other[0] operator[&&] identifier[effRatio] operator[>] Other[0] operator[SEP] {
identifier[effHeightMin] operator[=] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[effWithMin] operator[/] identifier[effRatio] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[effWithMin] operator[>] Other[0] operator[||] identifier[effHeightMin] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[Dimension] operator[SEP] identifier[effWithMin] , identifier[effHeightMin] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
static void putInt(ByteBuffer buffer, int value) {
value = (value << 1) ^ (value >> 31);
if (value >>> 7 == 0) {
buffer.put((byte) value);
} else {
buffer.put((byte) ((value & 0x7F) | 0x80));
if (value >>> 14 == 0) {
buffer.put((byte) (value >>> 7));
} else {
buffer.put((byte) (value >>> 7 | 0x80));
if (value >>> 21 == 0) {
buffer.put((byte) (value >>> 14));
} else {
buffer.put((byte) (value >>> 14 | 0x80));
if (value >>> 28 == 0) {
buffer.put((byte) (value >>> 21));
} else {
buffer.put((byte) (value >>> 21 | 0x80));
buffer.put((byte) (value >>> 28));
}
}
}
}
} | class class_name[name] begin[{]
method[putInt, return_type[void], modifier[static], parameter[buffer, value]] begin[{]
assign[member[.value], binary_operation[binary_operation[member[.value], <<, literal[1]], ^, binary_operation[member[.value], >>, literal[31]]]]
if[binary_operation[binary_operation[member[.value], >>>, literal[7]], ==, literal[0]]] begin[{]
call[buffer.put, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]]
else begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7F), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]]
if[binary_operation[binary_operation[member[.value], >>>, literal[14]], ==, literal[0]]] begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7), operator=>>>), type=BasicType(dimensions=[], name=byte))]]
else begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]]
if[binary_operation[binary_operation[member[.value], >>>, literal[21]], ==, literal[0]]] begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=14), operator=>>>), type=BasicType(dimensions=[], name=byte))]]
else begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=14), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]]
if[binary_operation[binary_operation[member[.value], >>>, literal[28]], ==, literal[0]]] begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=21), operator=>>>), type=BasicType(dimensions=[], name=byte))]]
else begin[{]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=21), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]]
call[buffer.put, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=28), operator=>>>), type=BasicType(dimensions=[], name=byte))]]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[putInt] operator[SEP] identifier[ByteBuffer] identifier[buffer] , Keyword[int] identifier[value] operator[SEP] {
identifier[value] operator[=] operator[SEP] identifier[value] operator[<<] Other[1] operator[SEP] operator[^] operator[SEP] identifier[value] operator[>] operator[>] Other[31] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[7] operator[==] Other[0] operator[SEP] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[&] literal[Integer] operator[SEP] operator[|] literal[Integer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[14] operator[==] Other[0] operator[SEP] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[7] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[7] operator[|] literal[Integer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[21] operator[==] Other[0] operator[SEP] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[14] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[14] operator[|] literal[Integer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[28] operator[==] Other[0] operator[SEP] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[21] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[21] operator[|] literal[Integer] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[28] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
|
public static RectifyCalibrated rectify(GrayU8 origLeft , GrayU8 origRight ,
StereoParameters param ,
GrayU8 rectLeft , GrayU8 rectRight )
{
// Compute rectification
RectifyCalibrated rectifyAlg = RectifyImageOps.createCalibrated();
Se3_F64 leftToRight = param.getRightToLeft().invert(null);
// original camera calibration matrices
DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(param.getLeft(), (DMatrixRMaj)null);
DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(param.getRight(), (DMatrixRMaj)null);
rectifyAlg.process(K1,new Se3_F64(),K2,leftToRight);
// rectification matrix for each image
DMatrixRMaj rect1 = rectifyAlg.getRect1();
DMatrixRMaj rect2 = rectifyAlg.getRect2();
// New calibration matrix,
DMatrixRMaj rectK = rectifyAlg.getCalibrationMatrix();
// Adjust the rectification to make the view area more useful
RectifyImageOps.allInsideLeft(param.left, rect1, rect2, rectK);
// undistorted and rectify images
FMatrixRMaj rect1_F32 = new FMatrixRMaj(3,3);
FMatrixRMaj rect2_F32 = new FMatrixRMaj(3,3);
ConvertMatrixData.convert(rect1, rect1_F32);
ConvertMatrixData.convert(rect2, rect2_F32);
ImageDistort<GrayU8,GrayU8> imageDistortLeft =
RectifyImageOps.rectifyImage(param.getLeft(), rect1_F32, BorderType.SKIP, origLeft.getImageType());
ImageDistort<GrayU8,GrayU8> imageDistortRight =
RectifyImageOps.rectifyImage(param.getRight(), rect2_F32, BorderType.SKIP, origRight.getImageType());
imageDistortLeft.apply(origLeft, rectLeft);
imageDistortRight.apply(origRight, rectRight);
return rectifyAlg;
} | class class_name[name] begin[{]
method[rectify, return_type[type[RectifyCalibrated]], modifier[public static], parameter[origLeft, origRight, param, rectLeft, rectRight]] begin[{]
local_variable[type[RectifyCalibrated], rectifyAlg]
local_variable[type[Se3_F64], leftToRight]
local_variable[type[DMatrixRMaj], K1]
local_variable[type[DMatrixRMaj], K2]
call[rectifyAlg.process, parameter[member[.K1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Se3_F64, sub_type=None)), member[.K2], member[.leftToRight]]]
local_variable[type[DMatrixRMaj], rect1]
local_variable[type[DMatrixRMaj], rect2]
local_variable[type[DMatrixRMaj], rectK]
call[RectifyImageOps.allInsideLeft, parameter[member[param.left], member[.rect1], member[.rect2], member[.rectK]]]
local_variable[type[FMatrixRMaj], rect1_F32]
local_variable[type[FMatrixRMaj], rect2_F32]
call[ConvertMatrixData.convert, parameter[member[.rect1], member[.rect1_F32]]]
call[ConvertMatrixData.convert, parameter[member[.rect2], member[.rect2_F32]]]
local_variable[type[ImageDistort], imageDistortLeft]
local_variable[type[ImageDistort], imageDistortRight]
call[imageDistortLeft.apply, parameter[member[.origLeft], member[.rectLeft]]]
call[imageDistortRight.apply, parameter[member[.origRight], member[.rectRight]]]
return[member[.rectifyAlg]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RectifyCalibrated] identifier[rectify] operator[SEP] identifier[GrayU8] identifier[origLeft] , identifier[GrayU8] identifier[origRight] , identifier[StereoParameters] identifier[param] , identifier[GrayU8] identifier[rectLeft] , identifier[GrayU8] identifier[rectRight] operator[SEP] {
identifier[RectifyCalibrated] identifier[rectifyAlg] operator[=] identifier[RectifyImageOps] operator[SEP] identifier[createCalibrated] operator[SEP] operator[SEP] operator[SEP] identifier[Se3_F64] identifier[leftToRight] operator[=] identifier[param] operator[SEP] identifier[getRightToLeft] operator[SEP] operator[SEP] operator[SEP] identifier[invert] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[K1] operator[=] identifier[PerspectiveOps] operator[SEP] identifier[pinholeToMatrix] operator[SEP] identifier[param] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] , operator[SEP] identifier[DMatrixRMaj] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[K2] operator[=] identifier[PerspectiveOps] operator[SEP] identifier[pinholeToMatrix] operator[SEP] identifier[param] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] , operator[SEP] identifier[DMatrixRMaj] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[rectifyAlg] operator[SEP] identifier[process] operator[SEP] identifier[K1] , Keyword[new] identifier[Se3_F64] operator[SEP] operator[SEP] , identifier[K2] , identifier[leftToRight] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[rect1] operator[=] identifier[rectifyAlg] operator[SEP] identifier[getRect1] operator[SEP] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[rect2] operator[=] identifier[rectifyAlg] operator[SEP] identifier[getRect2] operator[SEP] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[rectK] operator[=] identifier[rectifyAlg] operator[SEP] identifier[getCalibrationMatrix] operator[SEP] operator[SEP] operator[SEP] identifier[RectifyImageOps] operator[SEP] identifier[allInsideLeft] operator[SEP] identifier[param] operator[SEP] identifier[left] , identifier[rect1] , identifier[rect2] , identifier[rectK] operator[SEP] operator[SEP] identifier[FMatrixRMaj] identifier[rect1_F32] operator[=] Keyword[new] identifier[FMatrixRMaj] operator[SEP] Other[3] , Other[3] operator[SEP] operator[SEP] identifier[FMatrixRMaj] identifier[rect2_F32] operator[=] Keyword[new] identifier[FMatrixRMaj] operator[SEP] Other[3] , Other[3] operator[SEP] operator[SEP] identifier[ConvertMatrixData] operator[SEP] identifier[convert] operator[SEP] identifier[rect1] , identifier[rect1_F32] operator[SEP] operator[SEP] identifier[ConvertMatrixData] operator[SEP] identifier[convert] operator[SEP] identifier[rect2] , identifier[rect2_F32] operator[SEP] operator[SEP] identifier[ImageDistort] operator[<] identifier[GrayU8] , identifier[GrayU8] operator[>] identifier[imageDistortLeft] operator[=] identifier[RectifyImageOps] operator[SEP] identifier[rectifyImage] operator[SEP] identifier[param] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] , identifier[rect1_F32] , identifier[BorderType] operator[SEP] identifier[SKIP] , identifier[origLeft] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ImageDistort] operator[<] identifier[GrayU8] , identifier[GrayU8] operator[>] identifier[imageDistortRight] operator[=] identifier[RectifyImageOps] operator[SEP] identifier[rectifyImage] operator[SEP] identifier[param] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] , identifier[rect2_F32] , identifier[BorderType] operator[SEP] identifier[SKIP] , identifier[origRight] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[imageDistortLeft] operator[SEP] identifier[apply] operator[SEP] identifier[origLeft] , identifier[rectLeft] operator[SEP] operator[SEP] identifier[imageDistortRight] operator[SEP] identifier[apply] operator[SEP] identifier[origRight] , identifier[rectRight] operator[SEP] operator[SEP] Keyword[return] identifier[rectifyAlg] operator[SEP]
}
|
public static <T> void isEquals( final T argument,
String argumentName,
final T object,
String objectName ) {
if (argument == null) {
if (object == null) return;
// fall through ... one is null
} else {
if (argument.equals(object)) return;
// fall through ... they are not equal
}
if (objectName == null) objectName = getObjectName(object);
throw new IllegalArgumentException(CommonI18n.argumentMustBeEquals.text(argumentName, objectName));
} | class class_name[name] begin[{]
method[isEquals, return_type[void], modifier[public static], parameter[argument, argumentName, object, objectName]] begin[{]
if[binary_operation[member[.argument], ==, literal[null]]] begin[{]
if[binary_operation[member[.object], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
else begin[{]
if[call[argument.equals, parameter[member[.object]]]] begin[{]
return[None]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.objectName], ==, literal[null]]] begin[{]
assign[member[.objectName], call[.getObjectName, parameter[member[.object]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=argumentName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=text, postfix_operators=[], prefix_operators=[], qualifier=CommonI18n.argumentMustBeEquals, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[isEquals] operator[SEP] Keyword[final] identifier[T] identifier[argument] , identifier[String] identifier[argumentName] , Keyword[final] identifier[T] identifier[object] , identifier[String] identifier[objectName] operator[SEP] {
Keyword[if] operator[SEP] identifier[argument] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[object] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[objectName] operator[==] Other[null] operator[SEP] identifier[objectName] operator[=] identifier[getObjectName] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[CommonI18n] operator[SEP] identifier[argumentMustBeEquals] operator[SEP] identifier[text] operator[SEP] identifier[argumentName] , identifier[objectName] operator[SEP] operator[SEP] operator[SEP]
}
|
public static base_response add(nitro_service client, tmsessionaction resource) throws Exception {
tmsessionaction addresource = new tmsessionaction();
addresource.name = resource.name;
addresource.sesstimeout = resource.sesstimeout;
addresource.defaultauthorizationaction = resource.defaultauthorizationaction;
addresource.sso = resource.sso;
addresource.ssocredential = resource.ssocredential;
addresource.ssodomain = resource.ssodomain;
addresource.httponlycookie = resource.httponlycookie;
addresource.kcdaccount = resource.kcdaccount;
addresource.persistentcookie = resource.persistentcookie;
addresource.persistentcookievalidity = resource.persistentcookievalidity;
addresource.homepage = resource.homepage;
return addresource.add_resource(client);
} | class class_name[name] begin[{]
method[add, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[tmsessionaction], addresource]
assign[member[addresource.name], member[resource.name]]
assign[member[addresource.sesstimeout], member[resource.sesstimeout]]
assign[member[addresource.defaultauthorizationaction], member[resource.defaultauthorizationaction]]
assign[member[addresource.sso], member[resource.sso]]
assign[member[addresource.ssocredential], member[resource.ssocredential]]
assign[member[addresource.ssodomain], member[resource.ssodomain]]
assign[member[addresource.httponlycookie], member[resource.httponlycookie]]
assign[member[addresource.kcdaccount], member[resource.kcdaccount]]
assign[member[addresource.persistentcookie], member[resource.persistentcookie]]
assign[member[addresource.persistentcookievalidity], member[resource.persistentcookievalidity]]
assign[member[addresource.homepage], member[resource.homepage]]
return[call[addresource.add_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[add] operator[SEP] identifier[nitro_service] identifier[client] , identifier[tmsessionaction] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[tmsessionaction] identifier[addresource] operator[=] Keyword[new] identifier[tmsessionaction] operator[SEP] operator[SEP] operator[SEP] identifier[addresource] operator[SEP] identifier[name] operator[=] identifier[resource] operator[SEP] identifier[name] operator[SEP] identifier[addresource] operator[SEP] identifier[sesstimeout] operator[=] identifier[resource] operator[SEP] identifier[sesstimeout] operator[SEP] identifier[addresource] operator[SEP] identifier[defaultauthorizationaction] operator[=] identifier[resource] operator[SEP] identifier[defaultauthorizationaction] operator[SEP] identifier[addresource] operator[SEP] identifier[sso] operator[=] identifier[resource] operator[SEP] identifier[sso] operator[SEP] identifier[addresource] operator[SEP] identifier[ssocredential] operator[=] identifier[resource] operator[SEP] identifier[ssocredential] operator[SEP] identifier[addresource] operator[SEP] identifier[ssodomain] operator[=] identifier[resource] operator[SEP] identifier[ssodomain] operator[SEP] identifier[addresource] operator[SEP] identifier[httponlycookie] operator[=] identifier[resource] operator[SEP] identifier[httponlycookie] operator[SEP] identifier[addresource] operator[SEP] identifier[kcdaccount] operator[=] identifier[resource] operator[SEP] identifier[kcdaccount] operator[SEP] identifier[addresource] operator[SEP] identifier[persistentcookie] operator[=] identifier[resource] operator[SEP] identifier[persistentcookie] operator[SEP] identifier[addresource] operator[SEP] identifier[persistentcookievalidity] operator[=] identifier[resource] operator[SEP] identifier[persistentcookievalidity] operator[SEP] identifier[addresource] operator[SEP] identifier[homepage] operator[=] identifier[resource] operator[SEP] identifier[homepage] operator[SEP] Keyword[return] identifier[addresource] operator[SEP] identifier[add_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public ScriptResult ExecuteShellScriptInJob(String jobname, String engine, String script) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + jobname + "/script");
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("engine", engine));
nvp.add(new BasicNameValuePair("script", script));
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return scriptResult(postRequest);
} | class class_name[name] begin[{]
method[ExecuteShellScriptInJob, return_type[type[ScriptResult]], modifier[public], parameter[jobname, engine, script]] begin[{]
local_variable[type[HttpPost], postRequest]
local_variable[type[List], nvp]
call[nvp.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="engine"), MemberReference(member=engine, 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=BasicNameValuePair, sub_type=None))]]
call[nvp.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="script"), MemberReference(member=script, 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=BasicNameValuePair, sub_type=None))]]
local_variable[type[StringEntity], postEntity]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=postEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=nvp, 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=UrlEncodedFormEntity, sub_type=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=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
call[postEntity.setContentType, parameter[literal["application/x-www-form-urlencoded"]]]
call[postRequest.addHeader, parameter[literal["Accept"], literal["application/xml"]]]
call[postRequest.setEntity, parameter[member[.postEntity]]]
return[call[.scriptResult, parameter[member[.postRequest]]]]
end[}]
END[}] | Keyword[public] identifier[ScriptResult] identifier[ExecuteShellScriptInJob] operator[SEP] identifier[String] identifier[jobname] , identifier[String] identifier[engine] , identifier[String] identifier[script] operator[SEP] {
identifier[HttpPost] identifier[postRequest] operator[=] Keyword[new] identifier[HttpPost] operator[SEP] identifier[baseUrl] operator[+] literal[String] operator[+] identifier[jobname] operator[+] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[NameValuePair] operator[>] identifier[nvp] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[NameValuePair] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[nvp] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BasicNameValuePair] operator[SEP] literal[String] , identifier[engine] operator[SEP] operator[SEP] operator[SEP] identifier[nvp] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BasicNameValuePair] operator[SEP] literal[String] , identifier[script] operator[SEP] operator[SEP] operator[SEP] identifier[StringEntity] identifier[postEntity] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[postEntity] operator[=] Keyword[new] identifier[UrlEncodedFormEntity] operator[SEP] identifier[nvp] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
identifier[postEntity] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[postRequest] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[postRequest] operator[SEP] identifier[setEntity] operator[SEP] identifier[postEntity] operator[SEP] operator[SEP] Keyword[return] identifier[scriptResult] operator[SEP] identifier[postRequest] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@BackpressureSupport(BackpressureKind.FULL)
public final Completable concatMapCompletableDelayError(Function<? super T, ? extends CompletableSource> mapper, boolean tillTheEnd) {
return concatMapCompletableDelayError(mapper, tillTheEnd, 2);
} | class class_name[name] begin[{]
method[concatMapCompletableDelayError, return_type[type[Completable]], modifier[final public], parameter[mapper, tillTheEnd]] begin[{]
return[call[.concatMapCompletableDelayError, parameter[member[.mapper], member[.tillTheEnd], literal[2]]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] Keyword[public] Keyword[final] identifier[Completable] identifier[concatMapCompletableDelayError] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[CompletableSource] operator[>] identifier[mapper] , Keyword[boolean] identifier[tillTheEnd] operator[SEP] {
Keyword[return] identifier[concatMapCompletableDelayError] operator[SEP] identifier[mapper] , identifier[tillTheEnd] , Other[2] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
static private Class<DataTypeFactory<?>> getClassFor(String line) throws ClassNotFoundException {
return (Class<DataTypeFactory<?>>)Class.forName(line);
} | class class_name[name] begin[{]
method[getClassFor, return_type[type[Class]], modifier[private static], parameter[line]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=DataTypeFactory, sub_type=None))], dimensions=[], name=Class, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[static] Keyword[private] identifier[Class] operator[<] identifier[DataTypeFactory] operator[<] operator[?] operator[>] operator[>] identifier[getClassFor] operator[SEP] identifier[String] identifier[line] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] {
Keyword[return] operator[SEP] identifier[Class] operator[<] identifier[DataTypeFactory] operator[<] operator[?] operator[>] operator[>] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
|
private long lstToUT(double lst) {
// Convert to local mean time
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
// Then find local midnight on this day
long base = DAY_MS * ((time + fGmtOffset)/DAY_MS) - fGmtOffset;
//out(" lt =" + lt + " hours");
//out(" base=" + new Date(base));
return base + (long)(lt * HOUR_MS);
} | class class_name[name] begin[{]
method[lstToUT, return_type[type[long]], modifier[private], parameter[lst]] begin[{]
local_variable[type[double], lt]
local_variable[type[long], base]
return[binary_operation[member[.base], +, Cast(expression=BinaryOperation(operandl=MemberReference(member=lt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=HOUR_MS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), type=BasicType(dimensions=[], name=long))]]
end[}]
END[}] | Keyword[private] Keyword[long] identifier[lstToUT] operator[SEP] Keyword[double] identifier[lst] operator[SEP] {
Keyword[double] identifier[lt] operator[=] identifier[normalize] operator[SEP] operator[SEP] identifier[lst] operator[-] identifier[getSiderealOffset] operator[SEP] operator[SEP] operator[SEP] operator[*] literal[Float] , Other[24] operator[SEP] operator[SEP] Keyword[long] identifier[base] operator[=] identifier[DAY_MS] operator[*] operator[SEP] operator[SEP] identifier[time] operator[+] identifier[fGmtOffset] operator[SEP] operator[/] identifier[DAY_MS] operator[SEP] operator[-] identifier[fGmtOffset] operator[SEP] Keyword[return] identifier[base] operator[+] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[lt] operator[*] identifier[HOUR_MS] operator[SEP] operator[SEP]
}
|
public static final ParameterizedType parameterize(final Class<?> raw,
final Map<TypeVariable<?>, Type> typeArgMappings) {
Validate.notNull(raw, "raw class is null");
Validate.notNull(typeArgMappings, "typeArgMappings is null");
return parameterizeWithOwner(null, raw, extractTypeArgumentsFrom(typeArgMappings, raw.getTypeParameters()));
} | class class_name[name] begin[{]
method[parameterize, return_type[type[ParameterizedType]], modifier[final public static], parameter[raw, typeArgMappings]] begin[{]
call[Validate.notNull, parameter[member[.raw], literal["raw class is null"]]]
call[Validate.notNull, parameter[member[.typeArgMappings], literal["typeArgMappings is null"]]]
return[call[.parameterizeWithOwner, parameter[literal[null], member[.raw], call[.extractTypeArgumentsFrom, parameter[member[.typeArgMappings], call[raw.getTypeParameters, parameter[]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[ParameterizedType] identifier[parameterize] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[raw] , Keyword[final] identifier[Map] operator[<] identifier[TypeVariable] operator[<] operator[?] operator[>] , identifier[Type] operator[>] identifier[typeArgMappings] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[raw] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[typeArgMappings] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[parameterizeWithOwner] operator[SEP] Other[null] , identifier[raw] , identifier[extractTypeArgumentsFrom] operator[SEP] identifier[typeArgMappings] , identifier[raw] operator[SEP] identifier[getTypeParameters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
boolean popNamespace(String prefix)
{
// Prefixes "xml" and "xmlns" cannot be redefined
if (prefix.startsWith(XML_PREFIX))
{
return false;
}
Stack stack;
if ((stack = getPrefixStack(prefix)) != null)
{
stack.pop();
return true;
}
return false;
} | class class_name[name] begin[{]
method[popNamespace, return_type[type[boolean]], modifier[default], parameter[prefix]] begin[{]
if[call[prefix.startsWith, parameter[member[.XML_PREFIX]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Stack], stack]
if[binary_operation[assign[member[.stack], call[.getPrefixStack, parameter[member[.prefix]]]], !=, literal[null]]] begin[{]
call[stack.pop, parameter[]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[boolean] identifier[popNamespace] operator[SEP] identifier[String] identifier[prefix] operator[SEP] {
Keyword[if] operator[SEP] identifier[prefix] operator[SEP] identifier[startsWith] operator[SEP] identifier[XML_PREFIX] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Stack] identifier[stack] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[stack] operator[=] identifier[getPrefixStack] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[stack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void validateTimeout(Duration timeout) {
if(timeout.equals(Duration.ZERO)) {
String message = "The timeout must be nonzero";
throw new IllegalArgumentException(message);
}
} | class class_name[name] begin[{]
method[validateTimeout, return_type[void], modifier[public static], parameter[timeout]] begin[{]
if[call[timeout.equals, parameter[member[Duration.ZERO]]]] begin[{]
local_variable[type[String], message]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[validateTimeout] operator[SEP] identifier[Duration] identifier[timeout] operator[SEP] {
Keyword[if] operator[SEP] identifier[timeout] operator[SEP] identifier[equals] operator[SEP] identifier[Duration] operator[SEP] identifier[ZERO] operator[SEP] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
|
public PreparedQuery<T> prepare() throws SQLException {
// we only store things in the cache if there was not selects specified
boolean cacheStore = (selectList == null);
return super.prepareStatement(limit, cacheStore);
} | class class_name[name] begin[{]
method[prepare, return_type[type[PreparedQuery]], modifier[public], parameter[]] begin[{]
local_variable[type[boolean], cacheStore]
return[SuperMethodInvocation(arguments=[MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cacheStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | Keyword[public] identifier[PreparedQuery] operator[<] identifier[T] operator[>] identifier[prepare] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[boolean] identifier[cacheStore] operator[=] operator[SEP] identifier[selectList] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[limit] , identifier[cacheStore] operator[SEP] operator[SEP]
}
|
@Override
public void overrideMethod(ClassMethod method, Method superclassMethod) {
CodeAttribute ca = method.getCodeAttribute();
Class<?> returnType = superclassMethod.getReturnType();
if (!returnType.isPrimitive()) {
ca.aconstNull();
} else if (returnType == double.class) {
ca.dconst(0);
} else if (returnType == float.class) {
ca.fconst(0);
} else if (returnType == long.class) {
ca.lconst(0);
} else if (returnType == void.class) {
// do nothing
} else {
ca.iconst(0);
}
ca.returnInstruction();
} | class class_name[name] begin[{]
method[overrideMethod, return_type[void], modifier[public], parameter[method, superclassMethod]] begin[{]
local_variable[type[CodeAttribute], ca]
local_variable[type[Class], returnType]
if[call[returnType.isPrimitive, parameter[]]] begin[{]
call[ca.aconstNull, parameter[]]
else begin[{]
if[binary_operation[member[.returnType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=double))]] begin[{]
call[ca.dconst, parameter[literal[0]]]
else begin[{]
if[binary_operation[member[.returnType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=float))]] begin[{]
call[ca.fconst, parameter[literal[0]]]
else begin[{]
if[binary_operation[member[.returnType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=long))]] begin[{]
call[ca.lconst, parameter[literal[0]]]
else begin[{]
if[binary_operation[member[.returnType], ==, VoidClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=None)]] begin[{]
else begin[{]
call[ca.iconst, parameter[literal[0]]]
end[}]
end[}]
end[}]
end[}]
end[}]
call[ca.returnInstruction, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[overrideMethod] operator[SEP] identifier[ClassMethod] identifier[method] , identifier[Method] identifier[superclassMethod] operator[SEP] {
identifier[CodeAttribute] identifier[ca] operator[=] identifier[method] operator[SEP] identifier[getCodeAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[returnType] operator[=] identifier[superclassMethod] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[returnType] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[SEP] {
identifier[ca] operator[SEP] identifier[aconstNull] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[returnType] operator[==] Keyword[double] operator[SEP] Keyword[class] operator[SEP] {
identifier[ca] operator[SEP] identifier[dconst] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[returnType] operator[==] Keyword[float] operator[SEP] Keyword[class] operator[SEP] {
identifier[ca] operator[SEP] identifier[fconst] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[returnType] operator[==] Keyword[long] operator[SEP] Keyword[class] operator[SEP] {
identifier[ca] operator[SEP] identifier[lconst] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[returnType] operator[==] Keyword[void] operator[SEP] Keyword[class] operator[SEP] {
}
Keyword[else] {
identifier[ca] operator[SEP] identifier[iconst] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[ca] operator[SEP] identifier[returnInstruction] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object convertProperty(Object dynaPropVal) {
Object propertyValue = null;
if (dynaPropVal == null) {
throw new IllegalArgumentException("Unable to convertProperty on null object.");
}
Class<?> propClass = dynaPropVal.getClass();
String propName = propClass.getName();
//Check the dynamic propery for ArrayOfXXX object
if (propName.contains("ArrayOf")) {
String methodName = propName.substring(propName.indexOf("ArrayOf") + "ArrayOf".length());
// If object is ArrayOfXXX object, then get the XXX[] by invoking getXXX() on the object. For Ex:
// ArrayOfManagedObjectReference.getManagedObjectReference() returns ManagedObjectReference[] array.
try {
Method getMethod;
try {
getMethod = propClass.getMethod("get" + methodName, (Class[]) null);
}
catch (NoSuchMethodException ignore) {
getMethod = propClass.getMethod("get_" + methodName.toLowerCase(), (Class[]) null);
}
propertyValue = getMethod.invoke(dynaPropVal, (Object[]) null);
}
catch (Exception e) {
log.error("Exception caught trying to convertProperty", e);
}
}
//Handle the case of an unwrapped array being deserialized.
else if (dynaPropVal.getClass().isArray()) {
propertyValue = dynaPropVal;
}
else {
propertyValue = dynaPropVal;
}
return propertyValue;
} | class class_name[name] begin[{]
method[convertProperty, return_type[type[Object]], modifier[public static], parameter[dynaPropVal]] begin[{]
local_variable[type[Object], propertyValue]
if[binary_operation[member[.dynaPropVal], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to convertProperty on null object.")], 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[Class], propClass]
local_variable[type[String], propName]
if[call[propName.contains, parameter[literal["ArrayOf"]]]] begin[{]
local_variable[type[String], methodName]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=getMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="get"), operandr=MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Class, sub_type=None))], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=propClass, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="get_"), operandr=MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=methodName, selectors=[], type_arguments=None), operator=+), Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Class, sub_type=None))], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=propClass, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=propertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=dynaPropVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=getMethod, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception caught trying to convertProperty"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
if[call[dynaPropVal.getClass, parameter[]]] begin[{]
assign[member[.propertyValue], member[.dynaPropVal]]
else begin[{]
assign[member[.propertyValue], member[.dynaPropVal]]
end[}]
end[}]
return[member[.propertyValue]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[convertProperty] operator[SEP] identifier[Object] identifier[dynaPropVal] operator[SEP] {
identifier[Object] identifier[propertyValue] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[dynaPropVal] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Class] operator[<] operator[?] operator[>] identifier[propClass] operator[=] identifier[dynaPropVal] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[propName] operator[=] identifier[propClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propName] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[methodName] operator[=] identifier[propName] operator[SEP] identifier[substring] operator[SEP] identifier[propName] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Method] identifier[getMethod] operator[SEP] Keyword[try] {
identifier[getMethod] operator[=] identifier[propClass] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[+] identifier[methodName] , operator[SEP] identifier[Class] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[ignore] operator[SEP] {
identifier[getMethod] operator[=] identifier[propClass] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[+] identifier[methodName] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] , operator[SEP] identifier[Class] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[propertyValue] operator[=] identifier[getMethod] operator[SEP] identifier[invoke] operator[SEP] identifier[dynaPropVal] , operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[dynaPropVal] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
identifier[propertyValue] operator[=] identifier[dynaPropVal] operator[SEP]
}
Keyword[else] {
identifier[propertyValue] operator[=] identifier[dynaPropVal] operator[SEP]
}
Keyword[return] identifier[propertyValue] operator[SEP]
}
|
public long getWebPageAndChildrenLastModified(WebSiteRequest req) throws IOException, SQLException {
WebPage[] myPages = getCachedPages(req);
int len = myPages.length;
long mostRecent = getClassLastModified();
if(mostRecent==-1) return -1;
for (int c = 0; c < len; c++) {
long time = myPages[c].getLastModified(req);
if(time==-1) return -1;
if (time > mostRecent) mostRecent = time;
}
return mostRecent;
} | class class_name[name] begin[{]
method[getWebPageAndChildrenLastModified, return_type[type[long]], modifier[public], parameter[req]] begin[{]
local_variable[type[WebPage], myPages]
local_variable[type[int], len]
local_variable[type[long], mostRecent]
if[binary_operation[member[.mostRecent], ==, literal[1]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=myPages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLastModified, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=time)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=time, 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=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=mostRecent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=mostRecent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=c, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.mostRecent]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getWebPageAndChildrenLastModified] operator[SEP] identifier[WebSiteRequest] identifier[req] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[WebPage] operator[SEP] operator[SEP] identifier[myPages] operator[=] identifier[getCachedPages] operator[SEP] identifier[req] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[myPages] operator[SEP] identifier[length] operator[SEP] Keyword[long] identifier[mostRecent] operator[=] identifier[getClassLastModified] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mostRecent] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[len] operator[SEP] identifier[c] operator[++] operator[SEP] {
Keyword[long] identifier[time] operator[=] identifier[myPages] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[getLastModified] operator[SEP] identifier[req] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[>] identifier[mostRecent] operator[SEP] identifier[mostRecent] operator[=] identifier[time] operator[SEP]
}
Keyword[return] identifier[mostRecent] operator[SEP]
}
|
public void setExpression(AstNode expression) {
assertNotNull(expression);
expr = expression;
expression.setParent(this);
setLineno(expression.getLineno());
} | class class_name[name] begin[{]
method[setExpression, return_type[void], modifier[public], parameter[expression]] begin[{]
call[.assertNotNull, parameter[member[.expression]]]
assign[member[.expr], member[.expression]]
call[expression.setParent, parameter[THIS[]]]
call[.setLineno, parameter[call[expression.getLineno, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setExpression] operator[SEP] identifier[AstNode] identifier[expression] operator[SEP] {
identifier[assertNotNull] operator[SEP] identifier[expression] operator[SEP] operator[SEP] identifier[expr] operator[=] identifier[expression] operator[SEP] identifier[expression] operator[SEP] identifier[setParent] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[setLineno] operator[SEP] identifier[expression] operator[SEP] identifier[getLineno] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Bean(name = "requestAttributeMergingDao")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getRequestAttributeMergingDao() {
final MergingPersonAttributeDaoImpl rslt = new MergingPersonAttributeDaoImpl();
rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
rslt.setMerger(new ReplacingAttributeAdder());
final List<IPersonAttributeDao> daos = new ArrayList<>();
daos.add(getRequestAttributesDao());
daos.add(getCachingPersonAttributeDao());
rslt.setPersonAttributeDaos(daos);
return rslt;
} | class class_name[name] begin[{]
method[getRequestAttributeMergingDao, return_type[type[IPersonAttributeDao]], modifier[public], parameter[]] begin[{]
local_variable[type[MergingPersonAttributeDaoImpl], rslt]
call[rslt.setUsernameAttributeProvider, parameter[call[.getUsernameAttributeProvider, parameter[]]]]
call[rslt.setMerger, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReplacingAttributeAdder, sub_type=None))]]
local_variable[type[List], daos]
call[daos.add, parameter[call[.getRequestAttributesDao, parameter[]]]]
call[daos.add, parameter[call[.getCachingPersonAttributeDao, parameter[]]]]
call[rslt.setPersonAttributeDaos, parameter[member[.daos]]]
return[member[.rslt]]
end[}]
END[}] | annotation[@] identifier[Bean] operator[SEP] identifier[name] operator[=] literal[String] operator[SEP] annotation[@] identifier[Qualifier] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[IPersonAttributeDao] identifier[getRequestAttributeMergingDao] operator[SEP] operator[SEP] {
Keyword[final] identifier[MergingPersonAttributeDaoImpl] identifier[rslt] operator[=] Keyword[new] identifier[MergingPersonAttributeDaoImpl] operator[SEP] operator[SEP] operator[SEP] identifier[rslt] operator[SEP] identifier[setUsernameAttributeProvider] operator[SEP] identifier[getUsernameAttributeProvider] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rslt] operator[SEP] identifier[setMerger] operator[SEP] Keyword[new] identifier[ReplacingAttributeAdder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[IPersonAttributeDao] operator[>] identifier[daos] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[daos] operator[SEP] identifier[add] operator[SEP] identifier[getRequestAttributesDao] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[daos] operator[SEP] identifier[add] operator[SEP] identifier[getCachingPersonAttributeDao] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rslt] operator[SEP] identifier[setPersonAttributeDaos] operator[SEP] identifier[daos] operator[SEP] operator[SEP] Keyword[return] identifier[rslt] operator[SEP]
}
|
private void hbasePutWithRetry(final PutRequest put, short attempts, short wait)
throws HBaseException {
put.setBufferable(false); // TODO(tsuna): Remove once this code is async.
while (attempts-- > 0) {
try {
client.put(put).joinUninterruptibly();
return;
} catch (HBaseException e) {
if (attempts > 0) {
LOG.error("Put failed, attempts left=" + attempts
+ " (retrying in " + wait + " ms), put=" + put, e);
try {
Thread.sleep(wait);
} catch (InterruptedException ie) {
throw new RuntimeException("interrupted", ie);
}
wait *= 2;
} else {
throw e;
}
} catch (Exception e) {
LOG.error("WTF? Unexpected exception type, put=" + put, e);
}
}
throw new IllegalStateException("This code should never be reached!");
} | class class_name[name] begin[{]
method[hbasePutWithRetry, return_type[void], modifier[private], parameter[put, attempts, wait]] begin[{]
call[put.setBufferable, parameter[literal[false]]]
while[binary_operation[member[.attempts], >, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[MethodInvocation(arguments=[], member=joinUninterruptibly, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=attempts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Put failed, attempts left="), operandr=MemberReference(member=attempts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (retrying in "), operator=+), operandr=MemberReference(member=wait, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ms), put="), operator=+), operandr=MemberReference(member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=wait, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="interrupted"), MemberReference(member=ie, 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=ie, types=['InterruptedException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wait, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=*=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['HBaseException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="WTF? Unexpected exception type, put="), operandr=MemberReference(member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This code should never be reached!")], 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)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[hbasePutWithRetry] operator[SEP] Keyword[final] identifier[PutRequest] identifier[put] , Keyword[short] identifier[attempts] , Keyword[short] identifier[wait] operator[SEP] Keyword[throws] identifier[HBaseException] {
identifier[put] operator[SEP] identifier[setBufferable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[attempts] operator[--] operator[>] Other[0] operator[SEP] {
Keyword[try] {
identifier[client] operator[SEP] identifier[put] operator[SEP] identifier[put] operator[SEP] operator[SEP] identifier[joinUninterruptibly] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[HBaseException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[attempts] operator[>] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[attempts] operator[+] literal[String] operator[+] identifier[wait] operator[+] literal[String] operator[+] identifier[put] , identifier[e] operator[SEP] operator[SEP] Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[wait] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[ie] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[ie] operator[SEP] operator[SEP]
}
identifier[wait] operator[*=] Other[2] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[put] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
protected String htmlTitle() {
boolean showTitle = isShowTitle();
Iterator<I_CmsListAction> itIndepActions = getMetadata().getIndependentActions().iterator();
while (!showTitle && itIndepActions.hasNext()) {
I_CmsListAction indepAction = itIndepActions.next();
showTitle = showTitle || indepAction.isVisible();
}
Iterator<CmsListItemDetails> itItemDetails = getMetadata().getItemDetailDefinitions().iterator();
while (!showTitle && itItemDetails.hasNext()) {
CmsListItemDetails itemDetail = itItemDetails.next();
showTitle = showTitle || itemDetail.getAction().isVisible();
}
if (!showTitle) {
// prevent empty table if there is nothing to display
return "";
}
StringBuffer html = new StringBuffer(512);
CmsMessages messages = Messages.get().getBundle(getWp().getLocale());
html.append("<table width='100%' cellspacing='0'>");
html.append("\t<tr>\n");
if (isShowTitle()) {
html.append("\t\t<td align='left'>\n");
html.append("\t\t\t");
boolean isNotSearching = true;
if (getMetadata().isSearchable()) {
isNotSearching = CmsStringUtil.isEmptyOrWhitespaceOnly(m_searchFilter);
}
if (getTotalNumberOfPages() > 1) {
if (isNotSearching) {
html.append(messages.key(
Messages.GUI_LIST_TITLE_TEXT_4,
new Object[] {
m_name.key(getWp().getLocale()),
new Integer(displayedFrom()),
new Integer(displayedTo()),
new Integer(getTotalSize())}));
} else {
html.append(messages.key(
Messages.GUI_LIST_TITLE_FILTERED_TEXT_5,
new Object[] {
m_name.key(getWp().getLocale()),
new Integer(displayedFrom()),
new Integer(displayedTo()),
new Integer(getSize()),
new Integer(getTotalSize())}));
}
} else {
if (isNotSearching) {
html.append(messages.key(
Messages.GUI_LIST_SINGLE_TITLE_TEXT_2,
new Object[] {m_name.key(getWp().getLocale()), new Integer(getTotalSize())}));
} else {
html.append(messages.key(
Messages.GUI_LIST_SINGLE_TITLE_FILTERED_TEXT_3,
new Object[] {
m_name.key(getWp().getLocale()),
new Integer(getSize()),
new Integer(getTotalSize())}));
}
}
html.append("\n");
html.append("\t\t</td>\n\t\t");
}
html.append(getMetadata().htmlActionBar());
html.append("\n\t</tr>\n");
html.append("</table>\n");
return html.toString();
} | class class_name[name] begin[{]
method[htmlTitle, return_type[type[String]], modifier[protected], parameter[]] begin[{]
local_variable[type[boolean], showTitle]
local_variable[type[Iterator], itIndepActions]
while[binary_operation[member[.showTitle], &&, call[itIndepActions.hasNext, parameter[]]]] begin[{]
local_variable[type[I_CmsListAction], indepAction]
assign[member[.showTitle], binary_operation[member[.showTitle], ||, call[indepAction.isVisible, parameter[]]]]
end[}]
local_variable[type[Iterator], itItemDetails]
while[binary_operation[member[.showTitle], &&, call[itItemDetails.hasNext, parameter[]]]] begin[{]
local_variable[type[CmsListItemDetails], itemDetail]
assign[member[.showTitle], binary_operation[member[.showTitle], ||, call[itemDetail.getAction, parameter[]]]]
end[}]
if[member[.showTitle]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[StringBuffer], html]
local_variable[type[CmsMessages], messages]
call[html.append, parameter[literal["<table width='100%' cellspacing='0'>"]]]
call[html.append, parameter[literal["\t<tr>\n"]]]
if[call[.isShowTitle, parameter[]]] begin[{]
call[html.append, parameter[literal["\t\t<td align='left'>\n"]]]
call[html.append, parameter[literal["\t\t\t"]]]
local_variable[type[boolean], isNotSearching]
if[call[.getMetadata, parameter[]]] begin[{]
assign[member[.isNotSearching], call[CmsStringUtil.isEmptyOrWhitespaceOnly, parameter[member[.m_searchFilter]]]]
else begin[{]
None
end[}]
if[binary_operation[call[.getTotalNumberOfPages, parameter[]], >, literal[1]]] begin[{]
if[member[.isNotSearching]] begin[{]
call[html.append, parameter[call[messages.key, parameter[member[Messages.GUI_LIST_TITLE_TEXT_4], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_name, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=displayedFrom, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=displayedTo, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTotalSize, 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=Integer, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
else begin[{]
call[html.append, parameter[call[messages.key, parameter[member[Messages.GUI_LIST_TITLE_FILTERED_TEXT_5], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_name, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=displayedFrom, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=displayedTo, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSize, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTotalSize, 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=Integer, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
end[}]
else begin[{]
if[member[.isNotSearching]] begin[{]
call[html.append, parameter[call[messages.key, parameter[member[Messages.GUI_LIST_SINGLE_TITLE_TEXT_2], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_name, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTotalSize, 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=Integer, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
else begin[{]
call[html.append, parameter[call[messages.key, parameter[member[Messages.GUI_LIST_SINGLE_TITLE_FILTERED_TEXT_3], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_name, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSize, 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=Integer, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTotalSize, 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=Integer, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
end[}]
end[}]
call[html.append, parameter[literal["\n"]]]
call[html.append, parameter[literal["\t\t</td>\n\t\t"]]]
else begin[{]
None
end[}]
call[html.append, parameter[call[.getMetadata, parameter[]]]]
call[html.append, parameter[literal["\n\t</tr>\n"]]]
call[html.append, parameter[literal["</table>\n"]]]
return[call[html.toString, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[htmlTitle] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[showTitle] operator[=] identifier[isShowTitle] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[I_CmsListAction] operator[>] identifier[itIndepActions] operator[=] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getIndependentActions] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[showTitle] operator[&&] identifier[itIndepActions] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[I_CmsListAction] identifier[indepAction] operator[=] identifier[itIndepActions] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[showTitle] operator[=] identifier[showTitle] operator[||] identifier[indepAction] operator[SEP] identifier[isVisible] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Iterator] operator[<] identifier[CmsListItemDetails] operator[>] identifier[itItemDetails] operator[=] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getItemDetailDefinitions] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[showTitle] operator[&&] identifier[itItemDetails] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsListItemDetails] identifier[itemDetail] operator[=] identifier[itItemDetails] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[showTitle] operator[=] identifier[showTitle] operator[||] identifier[itemDetail] operator[SEP] identifier[getAction] operator[SEP] operator[SEP] operator[SEP] identifier[isVisible] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[showTitle] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuffer] identifier[html] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[512] operator[SEP] operator[SEP] identifier[CmsMessages] identifier[messages] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] identifier[getWp] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isShowTitle] operator[SEP] operator[SEP] operator[SEP] {
identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[isNotSearching] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[isSearchable] operator[SEP] operator[SEP] operator[SEP] {
identifier[isNotSearching] operator[=] identifier[CmsStringUtil] operator[SEP] identifier[isEmptyOrWhitespaceOnly] operator[SEP] identifier[m_searchFilter] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getTotalNumberOfPages] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[isNotSearching] operator[SEP] {
identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[messages] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LIST_TITLE_TEXT_4] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[m_name] operator[SEP] identifier[key] operator[SEP] identifier[getWp] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[displayedFrom] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[displayedTo] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getTotalSize] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[messages] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LIST_TITLE_FILTERED_TEXT_5] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[m_name] operator[SEP] identifier[key] operator[SEP] identifier[getWp] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[displayedFrom] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[displayedTo] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getTotalSize] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[isNotSearching] operator[SEP] {
identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[messages] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LIST_SINGLE_TITLE_TEXT_2] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[m_name] operator[SEP] identifier[key] operator[SEP] identifier[getWp] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getTotalSize] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[messages] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LIST_SINGLE_TITLE_FILTERED_TEXT_3] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[m_name] operator[SEP] identifier[key] operator[SEP] identifier[getWp] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[getTotalSize] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[htmlActionBar] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[html] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
boolean migrateConversationData() throws SerializerException {
long start = System.currentTimeMillis();
File legacyConversationDataFile = Util.getUnencryptedFilename(conversationDataFile);
if (legacyConversationDataFile.exists()) {
try {
ApptentiveLog.d(CONVERSATION, "Migrating %sconversation data...", hasState(LOGGED_IN) ? "encrypted " : "");
FileSerializer serializer = isAuthenticated() ? new EncryptedFileSerializer(legacyConversationDataFile, getEncryptionKey()) :
new FileSerializer(legacyConversationDataFile);
conversationData = (ConversationData) serializer.deserialize();
ApptentiveLog.d(CONVERSATION, "Conversation data migrated (took %d ms)", System.currentTimeMillis() - start);
return true;
} finally {
boolean deleted = legacyConversationDataFile.delete();
ApptentiveLog.d(CONVERSATION, "Legacy conversation file deleted: %b", deleted);
}
}
return false;
} | class class_name[name] begin[{]
method[migrateConversationData, return_type[type[boolean]], modifier[default], parameter[]] begin[{]
local_variable[type[long], start]
local_variable[type[File], legacyConversationDataFile]
if[call[legacyConversationDataFile.exists, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CONVERSATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Migrating %sconversation data..."), TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=LOGGED_IN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="encrypted "))], member=d, postfix_operators=[], prefix_operators=[], qualifier=ApptentiveLog, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[], member=isAuthenticated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=ClassCreator(arguments=[MemberReference(member=legacyConversationDataFile, 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=FileSerializer, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=legacyConversationDataFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getEncryptionKey, 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=EncryptedFileSerializer, sub_type=None))), name=serializer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileSerializer, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=conversationData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=deserialize, postfix_operators=[], prefix_operators=[], qualifier=serializer, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ConversationData, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CONVERSATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Conversation data migrated (took %d ms)"), BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=d, postfix_operators=[], prefix_operators=[], qualifier=ApptentiveLog, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=None, finally_block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=delete, postfix_operators=[], prefix_operators=[], qualifier=legacyConversationDataFile, selectors=[], type_arguments=None), name=deleted)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CONVERSATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Legacy conversation file deleted: %b"), MemberReference(member=deleted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=d, postfix_operators=[], prefix_operators=[], qualifier=ApptentiveLog, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[boolean] identifier[migrateConversationData] operator[SEP] operator[SEP] Keyword[throws] identifier[SerializerException] {
Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[legacyConversationDataFile] operator[=] identifier[Util] operator[SEP] identifier[getUnencryptedFilename] operator[SEP] identifier[conversationDataFile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[legacyConversationDataFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[ApptentiveLog] operator[SEP] identifier[d] operator[SEP] identifier[CONVERSATION] , literal[String] , identifier[hasState] operator[SEP] identifier[LOGGED_IN] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] identifier[FileSerializer] identifier[serializer] operator[=] identifier[isAuthenticated] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[EncryptedFileSerializer] operator[SEP] identifier[legacyConversationDataFile] , identifier[getEncryptionKey] operator[SEP] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[FileSerializer] operator[SEP] identifier[legacyConversationDataFile] operator[SEP] operator[SEP] identifier[conversationData] operator[=] operator[SEP] identifier[ConversationData] operator[SEP] identifier[serializer] operator[SEP] identifier[deserialize] operator[SEP] operator[SEP] operator[SEP] identifier[ApptentiveLog] operator[SEP] identifier[d] operator[SEP] identifier[CONVERSATION] , literal[String] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[start] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[finally] {
Keyword[boolean] identifier[deleted] operator[=] identifier[legacyConversationDataFile] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] identifier[ApptentiveLog] operator[SEP] identifier[d] operator[SEP] identifier[CONVERSATION] , literal[String] , identifier[deleted] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
static VaultConfig loadExternalFile(File f) throws XMLStreamException {
if(f == null) {
throw new IllegalArgumentException("File is null");
}
if(!f.exists()) {
throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath());
}
final VaultConfig config = new VaultConfig();
BufferedInputStream input = null;
try {
final XMLMapper mapper = XMLMapper.Factory.create();
final XMLElementReader<VaultConfig> reader = new ExternalVaultConfigReader();
mapper.registerRootElement(new QName(VAULT), reader);
FileInputStream is = new FileInputStream(f);
input = new BufferedInputStream(is);
XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(input);
mapper.parseDocument(config, streamReader);
streamReader.close();
} catch(FileNotFoundException e) {
throw new XMLStreamException("Vault file not found", e);
} catch(XMLStreamException t) {
throw t;
} finally {
StreamUtils.safeClose(input);
}
return config;
} | class class_name[name] begin[{]
method[loadExternalFile, return_type[type[VaultConfig]], modifier[static], parameter[f]] begin[{]
if[binary_operation[member[.f], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="File is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[f.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to locate vault file "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=f, 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=XMLStreamException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[VaultConfig], config]
local_variable[type[BufferedInputStream], input]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=create, postfix_operators=[], prefix_operators=[], qualifier=XMLMapper.Factory, selectors=[], type_arguments=None), name=mapper)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=XMLMapper, 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=ExternalVaultConfigReader, sub_type=None)), name=reader)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=VaultConfig, sub_type=None))], dimensions=[], name=XMLElementReader, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=VAULT, 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=QName, sub_type=None)), MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerRootElement, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)), name=is)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileInputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=is, 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=BufferedInputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=XMLInputFactory, selectors=[MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createXMLStreamReader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=streamReader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XMLStreamReader, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=streamReader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseDocument, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=streamReader, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Vault file not found"), 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=XMLStreamException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileNotFoundException'])), CatchClause(block=[ThrowStatement(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['XMLStreamException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeClose, postfix_operators=[], prefix_operators=[], qualifier=StreamUtils, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.config]]
end[}]
END[}] | Keyword[static] identifier[VaultConfig] identifier[loadExternalFile] operator[SEP] identifier[File] identifier[f] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
Keyword[if] operator[SEP] identifier[f] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[f] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XMLStreamException] operator[SEP] literal[String] operator[+] identifier[f] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[VaultConfig] identifier[config] operator[=] Keyword[new] identifier[VaultConfig] operator[SEP] operator[SEP] operator[SEP] identifier[BufferedInputStream] identifier[input] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[XMLMapper] identifier[mapper] operator[=] identifier[XMLMapper] operator[SEP] identifier[Factory] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[XMLElementReader] operator[<] identifier[VaultConfig] operator[>] identifier[reader] operator[=] Keyword[new] identifier[ExternalVaultConfigReader] operator[SEP] operator[SEP] operator[SEP] identifier[mapper] operator[SEP] identifier[registerRootElement] operator[SEP] Keyword[new] identifier[QName] operator[SEP] identifier[VAULT] operator[SEP] , identifier[reader] operator[SEP] operator[SEP] identifier[FileInputStream] identifier[is] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[input] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] identifier[is] operator[SEP] operator[SEP] identifier[XMLStreamReader] identifier[streamReader] operator[=] identifier[XMLInputFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[createXMLStreamReader] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[mapper] operator[SEP] identifier[parseDocument] operator[SEP] identifier[config] , identifier[streamReader] operator[SEP] operator[SEP] identifier[streamReader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XMLStreamException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[XMLStreamException] identifier[t] operator[SEP] {
Keyword[throw] identifier[t] operator[SEP]
}
Keyword[finally] {
identifier[StreamUtils] operator[SEP] identifier[safeClose] operator[SEP] identifier[input] operator[SEP] operator[SEP]
}
Keyword[return] identifier[config] operator[SEP]
}
|
public void marshall(ProjectSource projectSource, ProtocolMarshaller protocolMarshaller) {
if (projectSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(projectSource.getType(), TYPE_BINDING);
protocolMarshaller.marshall(projectSource.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(projectSource.getGitCloneDepth(), GITCLONEDEPTH_BINDING);
protocolMarshaller.marshall(projectSource.getGitSubmodulesConfig(), GITSUBMODULESCONFIG_BINDING);
protocolMarshaller.marshall(projectSource.getBuildspec(), BUILDSPEC_BINDING);
protocolMarshaller.marshall(projectSource.getAuth(), AUTH_BINDING);
protocolMarshaller.marshall(projectSource.getReportBuildStatus(), REPORTBUILDSTATUS_BINDING);
protocolMarshaller.marshall(projectSource.getInsecureSsl(), INSECURESSL_BINDING);
protocolMarshaller.marshall(projectSource.getSourceIdentifier(), SOURCEIDENTIFIER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[projectSource, protocolMarshaller]] begin[{]
if[binary_operation[member[.projectSource], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=TYPE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=LOCATION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGitCloneDepth, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=GITCLONEDEPTH_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGitSubmodulesConfig, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=GITSUBMODULESCONFIG_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBuildspec, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=BUILDSPEC_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAuth, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=AUTH_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getReportBuildStatus, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=REPORTBUILDSTATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInsecureSsl, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=INSECURESSL_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceIdentifier, postfix_operators=[], prefix_operators=[], qualifier=projectSource, selectors=[], type_arguments=None), MemberReference(member=SOURCEIDENTIFIER_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ProjectSource] identifier[projectSource] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[projectSource] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[TYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] , identifier[LOCATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getGitCloneDepth] operator[SEP] operator[SEP] , identifier[GITCLONEDEPTH_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getGitSubmodulesConfig] operator[SEP] operator[SEP] , identifier[GITSUBMODULESCONFIG_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getBuildspec] operator[SEP] operator[SEP] , identifier[BUILDSPEC_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getAuth] operator[SEP] operator[SEP] , identifier[AUTH_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getReportBuildStatus] operator[SEP] operator[SEP] , identifier[REPORTBUILDSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getInsecureSsl] operator[SEP] operator[SEP] , identifier[INSECURESSL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectSource] operator[SEP] identifier[getSourceIdentifier] operator[SEP] operator[SEP] , identifier[SOURCEIDENTIFIER_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public int update(String sql, Object param) throws SQLException {
return this.update(sql, new Object[] { param });
} | class class_name[name] begin[{]
method[update, return_type[type[int]], modifier[public], parameter[sql, param]] begin[{]
return[THIS[call[None.update, parameter[member[.sql], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[update] operator[SEP] identifier[String] identifier[sql] , identifier[Object] identifier[param] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[return] Keyword[this] operator[SEP] identifier[update] operator[SEP] identifier[sql] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[param]
} operator[SEP] operator[SEP]
}
|
void recomposeIncludes(Stylesheet including)
{
int n = including.getIncludeCount();
if (n > 0)
{
if (null == m_includesComposed)
m_includesComposed = new Vector();
for (int i = 0; i < n; i++)
{
Stylesheet included = including.getInclude(i);
m_includesComposed.addElement(included);
recomposeIncludes(included);
}
}
} | class class_name[name] begin[{]
method[recomposeIncludes, return_type[void], modifier[default], parameter[including]] begin[{]
local_variable[type[int], n]
if[binary_operation[member[.n], >, literal[0]]] begin[{]
if[binary_operation[literal[null], ==, member[.m_includesComposed]]] begin[{]
assign[member[.m_includesComposed], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Vector, sub_type=None))]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInclude, postfix_operators=[], prefix_operators=[], qualifier=including, selectors=[], type_arguments=None), name=included)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Stylesheet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=included, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addElement, postfix_operators=[], prefix_operators=[], qualifier=m_includesComposed, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=included, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recomposeIncludes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[recomposeIncludes] operator[SEP] identifier[Stylesheet] identifier[including] operator[SEP] {
Keyword[int] identifier[n] operator[=] identifier[including] operator[SEP] identifier[getIncludeCount] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[m_includesComposed] operator[SEP] identifier[m_includesComposed] operator[=] Keyword[new] identifier[Vector] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[n] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Stylesheet] identifier[included] operator[=] identifier[including] operator[SEP] identifier[getInclude] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[m_includesComposed] operator[SEP] identifier[addElement] operator[SEP] identifier[included] operator[SEP] operator[SEP] identifier[recomposeIncludes] operator[SEP] identifier[included] operator[SEP] operator[SEP]
}
}
}
|
protected boolean createProxy(
Neighbour neighbour,
DestinationHandler destination,
MESubscription subscription,
SIBUuid12 topicSpace,
String topic,
boolean warmRestarted) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createProxy",
new Object[] { neighbour,
destination,
subscription,
topicSpace,
topic,
new Boolean(warmRestarted) });
boolean outputHandlerCreated = false;
// Assign this Handler to the MatchSpace (as long as the topic space
// exists, otherwise the proxy is in limbo until either D3 catches up
// with the topic space declaration, or the proxy is deleted.
if (destination != null)
{
// Get the PubSubHandler from the destination object.
PubSubOutputHandler handler = destination.getPubSubOutputHandler(neighbour.getUUID());
// If there isn't an OutputHandler, then create one.
if (handler == null)
{
handler = destination.createPubSubOutputHandler(neighbour);
}
// Set the forign topicspace mapping
handler.setTopicSpaceMapping(subscription.getForeignTSName());
// Set the topic in the output handler.
handler.addTopic(topic);
// Set the information needed for the commit
subscription.registerForPostCommit(_proxyHandler, destination, handler, neighbour);
outputHandlerCreated = true;
}
else
{
// Add a reference into the Neighbours class to indicate that we
// have a Proxy subscription, but no destination to add it to, so
// we will wait until this destination is created before adding it.
addTopicSpaceReference(neighbour.getUUID(), topicSpace, topic, warmRestarted);
subscription.registerForPostCommit(neighbour, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createProxy", new Boolean(outputHandlerCreated));
return outputHandlerCreated;
} | class class_name[name] begin[{]
method[createProxy, return_type[type[boolean]], modifier[protected], parameter[neighbour, destination, subscription, topicSpace, topic, warmRestarted]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["createProxy"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=neighbour, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subscription, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=topicSpace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=topic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=warmRestarted, 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=Boolean, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[boolean], outputHandlerCreated]
if[binary_operation[member[.destination], !=, literal[null]]] begin[{]
local_variable[type[PubSubOutputHandler], handler]
if[binary_operation[member[.handler], ==, literal[null]]] begin[{]
assign[member[.handler], call[destination.createPubSubOutputHandler, parameter[member[.neighbour]]]]
else begin[{]
None
end[}]
call[handler.setTopicSpaceMapping, parameter[call[subscription.getForeignTSName, parameter[]]]]
call[handler.addTopic, parameter[member[.topic]]]
call[subscription.registerForPostCommit, parameter[member[._proxyHandler], member[.destination], member[.handler], member[.neighbour]]]
assign[member[.outputHandlerCreated], literal[true]]
else begin[{]
call[.addTopicSpaceReference, parameter[call[neighbour.getUUID, parameter[]], member[.topicSpace], member[.topic], member[.warmRestarted]]]
call[subscription.registerForPostCommit, parameter[member[.neighbour], THIS[]]]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["createProxy"], ClassCreator(arguments=[MemberReference(member=outputHandlerCreated, 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=Boolean, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.outputHandlerCreated]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[createProxy] operator[SEP] identifier[Neighbour] identifier[neighbour] , identifier[DestinationHandler] identifier[destination] , identifier[MESubscription] identifier[subscription] , identifier[SIBUuid12] identifier[topicSpace] , identifier[String] identifier[topic] , Keyword[boolean] identifier[warmRestarted] operator[SEP] Keyword[throws] identifier[SIResourceException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[neighbour] , identifier[destination] , identifier[subscription] , identifier[topicSpace] , identifier[topic] , Keyword[new] identifier[Boolean] operator[SEP] identifier[warmRestarted] operator[SEP]
} operator[SEP] operator[SEP] Keyword[boolean] identifier[outputHandlerCreated] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[destination] operator[!=] Other[null] operator[SEP] {
identifier[PubSubOutputHandler] identifier[handler] operator[=] identifier[destination] operator[SEP] identifier[getPubSubOutputHandler] operator[SEP] identifier[neighbour] operator[SEP] identifier[getUUID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] operator[==] Other[null] operator[SEP] {
identifier[handler] operator[=] identifier[destination] operator[SEP] identifier[createPubSubOutputHandler] operator[SEP] identifier[neighbour] operator[SEP] operator[SEP]
}
identifier[handler] operator[SEP] identifier[setTopicSpaceMapping] operator[SEP] identifier[subscription] operator[SEP] identifier[getForeignTSName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[handler] operator[SEP] identifier[addTopic] operator[SEP] identifier[topic] operator[SEP] operator[SEP] identifier[subscription] operator[SEP] identifier[registerForPostCommit] operator[SEP] identifier[_proxyHandler] , identifier[destination] , identifier[handler] , identifier[neighbour] operator[SEP] operator[SEP] identifier[outputHandlerCreated] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[addTopicSpaceReference] operator[SEP] identifier[neighbour] operator[SEP] identifier[getUUID] operator[SEP] operator[SEP] , identifier[topicSpace] , identifier[topic] , identifier[warmRestarted] operator[SEP] operator[SEP] identifier[subscription] operator[SEP] identifier[registerForPostCommit] operator[SEP] identifier[neighbour] , Keyword[this] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Boolean] operator[SEP] identifier[outputHandlerCreated] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[outputHandlerCreated] operator[SEP]
}
|
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitStartElement(StartElementTree tree, Void ignore) {
final Name treeName = tree.getName();
final HtmlTag t = HtmlTag.get(treeName);
if (t == null) {
env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
} else if (t.allowedVersion != HtmlVersion.ALL && t.allowedVersion != env.htmlVersion) {
env.messages.error(HTML, tree, "dc.tag.not.supported", treeName);
} else {
boolean done = false;
for (TagStackItem tsi: tagStack) {
if (tsi.tag.accepts(t)) {
while (tagStack.peek() != tsi) {
warnIfEmpty(tagStack.peek(), null);
tagStack.pop();
}
done = true;
break;
} else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
done = true;
break;
}
}
if (!done && HtmlTag.BODY.accepts(t)) {
while (!tagStack.isEmpty()) {
warnIfEmpty(tagStack.peek(), null);
tagStack.pop();
}
}
markEnclosingTag(Flag.HAS_ELEMENT);
checkStructure(tree, t);
// tag specific checks
switch (t) {
// check for out of sequence headers, such as <h1>...</h1> <h3>...</h3>
case H1: case H2: case H3: case H4: case H5: case H6:
checkHeader(tree, t);
break;
}
if (t.flags.contains(HtmlTag.Flag.NO_NEST)) {
for (TagStackItem i: tagStack) {
if (t == i.tag) {
env.messages.warning(HTML, tree, "dc.tag.nested.not.allowed", treeName);
break;
}
}
}
}
// check for self closing tags, such as <a id="name"/>
if (tree.isSelfClosing()) {
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
}
try {
TagStackItem parent = tagStack.peek();
TagStackItem top = new TagStackItem(tree, t);
tagStack.push(top);
super.visitStartElement(tree, ignore);
// handle attributes that may or may not have been found in start element
if (t != null) {
switch (t) {
case CAPTION:
if (parent != null && parent.tag == HtmlTag.TABLE)
parent.flags.add(Flag.TABLE_HAS_CAPTION);
break;
case H1: case H2: case H3: case H4: case H5: case H6:
if (parent != null && (parent.tag == HtmlTag.SECTION || parent.tag == HtmlTag.ARTICLE)) {
parent.flags.add(Flag.HAS_HEADING);
}
break;
case IMG:
if (!top.attrs.contains(HtmlTag.Attr.ALT))
env.messages.error(ACCESSIBILITY, tree, "dc.no.alt.attr.for.image");
break;
}
}
return null;
} finally {
if (t == null || t.endKind == HtmlTag.EndKind.NONE)
tagStack.pop();
}
} | class class_name[name] begin[{]
method[visitStartElement, return_type[type[Void]], modifier[public], parameter[tree, ignore]] begin[{]
local_variable[type[Name], treeName]
local_variable[type[HtmlTag], t]
if[binary_operation[member[.t], ==, literal[null]]] begin[{]
call[env.messages.error, parameter[member[.HTML], member[.tree], literal["dc.tag.unknown"], member[.treeName]]]
else begin[{]
if[binary_operation[binary_operation[member[t.allowedVersion], !=, member[HtmlVersion.ALL]], &&, binary_operation[member[t.allowedVersion], !=, member[env.htmlVersion]]]] begin[{]
call[env.messages.error, parameter[member[.HTML], member[.tree], literal["dc.tag.not.supported"], member[.treeName]]]
else begin[{]
local_variable[type[boolean], done]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accepts, postfix_operators=[], prefix_operators=[], qualifier=tsi.tag, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=endKind, postfix_operators=[], prefix_operators=[], qualifier=tsi.tag, selectors=[]), operandr=MemberReference(member=OPTIONAL, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag.EndKind, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=warnIfEmpty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=pop, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), operandr=MemberReference(member=tsi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tagStack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tsi)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TagStackItem, sub_type=None))), label=None)
if[binary_operation[member[.done], &&, call[HtmlTag.BODY.accepts, parameter[member[.t]]]]] begin[{]
while[call[tagStack.isEmpty, parameter[]]] begin[{]
call[.warnIfEmpty, parameter[call[tagStack.peek, parameter[]], literal[null]]]
call[tagStack.pop, parameter[]]
end[}]
else begin[{]
None
end[}]
call[.markEnclosingTag, parameter[member[Flag.HAS_ELEMENT]]]
call[.checkStructure, parameter[member[.tree], member[.t]]]
SwitchStatement(cases=[SwitchStatementCase(case=['H1', 'H2', 'H3', 'H4', 'H5', 'H6'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[call[t.flags.contains, parameter[member[HtmlTag.Flag.NO_NEST]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HTML, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.tag.nested.not.allowed"), MemberReference(member=treeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=env.messages, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tagStack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TagStackItem, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
if[call[tree.isSelfClosing, parameter[]]] begin[{]
call[env.messages.error, parameter[member[.HTML], member[.tree], literal["dc.tag.self.closing"], member[.treeName]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), name=parent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TagStackItem, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, 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=TagStackItem, sub_type=None)), name=top)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TagStackItem, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=push, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), label=None), StatementExpression(expression=SuperMethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ignore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitStartElement, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None), 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=None, label=None, then_statement=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=['CAPTION'], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[]), operandr=MemberReference(member=TABLE, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag, selectors=[]), operator===), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TABLE_HAS_CAPTION, postfix_operators=[], prefix_operators=[], qualifier=Flag, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=parent.flags, selectors=[], type_arguments=None), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['H1', 'H2', 'H3', 'H4', 'H5', 'H6'], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[]), operandr=MemberReference(member=SECTION, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[]), operandr=MemberReference(member=ARTICLE, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag, selectors=[]), operator===), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HAS_HEADING, postfix_operators=[], prefix_operators=[], qualifier=Flag, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=parent.flags, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['IMG'], statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ALT, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag.Attr, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=top.attrs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ACCESSIBILITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.no.alt.attr.for.image")], member=error, postfix_operators=[], prefix_operators=[], qualifier=env.messages, selectors=[], type_arguments=None), label=None)), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MemberReference(member=endKind, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[]), operandr=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag.EndKind, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=pop, postfix_operators=[], prefix_operators=[], qualifier=tagStack, selectors=[], type_arguments=None), label=None))], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[DefinedBy] operator[SEP] identifier[Api] operator[SEP] identifier[COMPILER_TREE] operator[SEP] Keyword[public] identifier[Void] identifier[visitStartElement] operator[SEP] identifier[StartElementTree] identifier[tree] , identifier[Void] identifier[ignore] operator[SEP] {
Keyword[final] identifier[Name] identifier[treeName] operator[=] identifier[tree] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[HtmlTag] identifier[t] operator[=] identifier[HtmlTag] operator[SEP] identifier[get] operator[SEP] identifier[treeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] {
identifier[env] operator[SEP] identifier[messages] operator[SEP] identifier[error] operator[SEP] identifier[HTML] , identifier[tree] , literal[String] , identifier[treeName] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[allowedVersion] operator[!=] identifier[HtmlVersion] operator[SEP] identifier[ALL] operator[&&] identifier[t] operator[SEP] identifier[allowedVersion] operator[!=] identifier[env] operator[SEP] identifier[htmlVersion] operator[SEP] {
identifier[env] operator[SEP] identifier[messages] operator[SEP] identifier[error] operator[SEP] identifier[HTML] , identifier[tree] , literal[String] , identifier[treeName] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[boolean] identifier[done] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[TagStackItem] identifier[tsi] operator[:] identifier[tagStack] operator[SEP] {
Keyword[if] operator[SEP] identifier[tsi] operator[SEP] identifier[tag] operator[SEP] identifier[accepts] operator[SEP] identifier[t] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[tagStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[!=] identifier[tsi] operator[SEP] {
identifier[warnIfEmpty] operator[SEP] identifier[tagStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[tagStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP]
}
identifier[done] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[tsi] operator[SEP] identifier[tag] operator[SEP] identifier[endKind] operator[!=] identifier[HtmlTag] operator[SEP] identifier[EndKind] operator[SEP] identifier[OPTIONAL] operator[SEP] {
identifier[done] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[done] operator[&&] identifier[HtmlTag] operator[SEP] identifier[BODY] operator[SEP] identifier[accepts] operator[SEP] identifier[t] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] operator[!] identifier[tagStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[warnIfEmpty] operator[SEP] identifier[tagStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[tagStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[markEnclosingTag] operator[SEP] identifier[Flag] operator[SEP] identifier[HAS_ELEMENT] operator[SEP] operator[SEP] identifier[checkStructure] operator[SEP] identifier[tree] , identifier[t] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[t] operator[SEP] {
Keyword[case] identifier[H1] operator[:] Keyword[case] identifier[H2] operator[:] Keyword[case] identifier[H3] operator[:] Keyword[case] identifier[H4] operator[:] Keyword[case] identifier[H5] operator[:] Keyword[case] identifier[H6] operator[:] identifier[checkHeader] operator[SEP] identifier[tree] , identifier[t] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[flags] operator[SEP] identifier[contains] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[Flag] operator[SEP] identifier[NO_NEST] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[TagStackItem] identifier[i] operator[:] identifier[tagStack] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] identifier[i] operator[SEP] identifier[tag] operator[SEP] {
identifier[env] operator[SEP] identifier[messages] operator[SEP] identifier[warning] operator[SEP] identifier[HTML] , identifier[tree] , literal[String] , identifier[treeName] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[tree] operator[SEP] identifier[isSelfClosing] operator[SEP] operator[SEP] operator[SEP] {
identifier[env] operator[SEP] identifier[messages] operator[SEP] identifier[error] operator[SEP] identifier[HTML] , identifier[tree] , literal[String] , identifier[treeName] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[TagStackItem] identifier[parent] operator[=] identifier[tagStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] identifier[TagStackItem] identifier[top] operator[=] Keyword[new] identifier[TagStackItem] operator[SEP] identifier[tree] , identifier[t] operator[SEP] operator[SEP] identifier[tagStack] operator[SEP] identifier[push] operator[SEP] identifier[top] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitStartElement] operator[SEP] identifier[tree] , identifier[ignore] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
Keyword[switch] operator[SEP] identifier[t] operator[SEP] {
Keyword[case] identifier[CAPTION] operator[:] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[&&] identifier[parent] operator[SEP] identifier[tag] operator[==] identifier[HtmlTag] operator[SEP] identifier[TABLE] operator[SEP] identifier[parent] operator[SEP] identifier[flags] operator[SEP] identifier[add] operator[SEP] identifier[Flag] operator[SEP] identifier[TABLE_HAS_CAPTION] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[H1] operator[:] Keyword[case] identifier[H2] operator[:] Keyword[case] identifier[H3] operator[:] Keyword[case] identifier[H4] operator[:] Keyword[case] identifier[H5] operator[:] Keyword[case] identifier[H6] operator[:] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[&&] operator[SEP] identifier[parent] operator[SEP] identifier[tag] operator[==] identifier[HtmlTag] operator[SEP] identifier[SECTION] operator[||] identifier[parent] operator[SEP] identifier[tag] operator[==] identifier[HtmlTag] operator[SEP] identifier[ARTICLE] operator[SEP] operator[SEP] {
identifier[parent] operator[SEP] identifier[flags] operator[SEP] identifier[add] operator[SEP] identifier[Flag] operator[SEP] identifier[HAS_HEADING] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[IMG] operator[:] Keyword[if] operator[SEP] operator[!] identifier[top] operator[SEP] identifier[attrs] operator[SEP] identifier[contains] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[Attr] operator[SEP] identifier[ALT] operator[SEP] operator[SEP] identifier[env] operator[SEP] identifier[messages] operator[SEP] identifier[error] operator[SEP] identifier[ACCESSIBILITY] , identifier[tree] , literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[||] identifier[t] operator[SEP] identifier[endKind] operator[==] identifier[HtmlTag] operator[SEP] identifier[EndKind] operator[SEP] identifier[NONE] operator[SEP] identifier[tagStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public RandomVariable getValues(double evaluationTime, LIBORMarketModel model) {
if(evaluationTime > 0) {
throw new RuntimeException("Forward start evaluation currently not supported.");
}
double swapStart = swapTenor[0];
double swapEnd = swapTenor[swapTenor.length-1];
int swapStartIndex = model.getLiborPeriodIndex(swapStart);
int swapEndIndex = model.getLiborPeriodIndex(swapEnd);
int optionMaturityIndex = model.getCovarianceModel().getTimeDiscretization().getTimeIndex(swapStart)-1;
Map<String, double[]> logSwaprateDerivative = getLogSwaprateDerivative(model.getLiborPeriodDiscretization(), model.getForwardRateCurve(), swapTenor);
double[] swapCovarianceWeights = logSwaprateDerivative.get("values");
double[] discountFactors = logSwaprateDerivative.get("discountFactors");
double[] swapAnnuities = logSwaprateDerivative.get("swapAnnuities");
// Get the integrated libor covariance from the model
double[][] integratedLIBORCovariance = model.getIntegratedLIBORCovariance()[optionMaturityIndex];
// Calculate integrated swap rate covariance
double integratedSwapRateVariance = 0.0;
for(int componentIndex1 = swapStartIndex; componentIndex1 < swapEndIndex; componentIndex1++) {
// Sum the libor cross terms (use symmetry)
for(int componentIndex2 = componentIndex1+1; componentIndex2 < swapEndIndex; componentIndex2++) {
integratedSwapRateVariance += 2.0 * swapCovarianceWeights[componentIndex1-swapStartIndex] * swapCovarianceWeights[componentIndex2-swapStartIndex] * integratedLIBORCovariance[componentIndex1][componentIndex2];
}
// Add diagonal term (libor variance term)
integratedSwapRateVariance += swapCovarianceWeights[componentIndex1-swapStartIndex] * swapCovarianceWeights[componentIndex1-swapStartIndex] * integratedLIBORCovariance[componentIndex1][componentIndex1];
}
// Return integratedSwapRateVariance if requested
if(valueUnit == ValueUnit.INTEGRATEDVARIANCELOGNORMAL || valueUnit == ValueUnit.INTEGRATEDVARIANCE) {
return new Scalar(integratedSwapRateVariance);
}
double volatility = Math.sqrt(integratedSwapRateVariance / swapStart);
// Return integratedSwapRateVariance if requested
if(valueUnit == ValueUnit.VOLATILITYLOGNORMAL || valueUnit == ValueUnit.VOLATILITY) {
return new Scalar(volatility);
}
// Use black formula for swaption to calculate the price
double swapAnnuity = swapAnnuities[0];
double parSwaprate = (discountFactors[0] - discountFactors[swapEndIndex-swapStartIndex]) / swapAnnuity;
double optionMaturity = swapStart;
double valueSwaption = AnalyticFormulas.blackModelSwaptionValue(parSwaprate, volatility, optionMaturity, swaprate, swapAnnuity);
return new Scalar(valueSwaption);
} | class class_name[name] begin[{]
method[getValues, return_type[type[RandomVariable]], modifier[public], parameter[evaluationTime, model]] begin[{]
if[binary_operation[member[.evaluationTime], >, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Forward start evaluation currently not supported.")], 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[}]
local_variable[type[double], swapStart]
local_variable[type[double], swapEnd]
local_variable[type[int], swapStartIndex]
local_variable[type[int], swapEndIndex]
local_variable[type[int], optionMaturityIndex]
local_variable[type[Map], logSwaprateDerivative]
local_variable[type[double], swapCovarianceWeights]
local_variable[type[double], discountFactors]
local_variable[type[double], swapAnnuities]
local_variable[type[double], integratedLIBORCovariance]
local_variable[type[double], integratedSwapRateVariance]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=integratedSwapRateVariance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2.0), operandr=MemberReference(member=swapCovarianceWeights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), operator=*), operandr=MemberReference(member=swapCovarianceWeights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=componentIndex2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), operator=*), operandr=MemberReference(member=integratedLIBORCovariance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=componentIndex2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=componentIndex2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapEndIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=componentIndex2)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=componentIndex2, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=integratedSwapRateVariance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=swapCovarianceWeights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), operandr=MemberReference(member=swapCovarianceWeights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), operator=*), operandr=MemberReference(member=integratedLIBORCovariance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=componentIndex1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=swapEndIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=swapStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=componentIndex1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=componentIndex1, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[binary_operation[member[.valueUnit], ==, member[ValueUnit.INTEGRATEDVARIANCELOGNORMAL]], ||, binary_operation[member[.valueUnit], ==, member[ValueUnit.INTEGRATEDVARIANCE]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=integratedSwapRateVariance, 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=Scalar, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[double], volatility]
if[binary_operation[binary_operation[member[.valueUnit], ==, member[ValueUnit.VOLATILITYLOGNORMAL]], ||, binary_operation[member[.valueUnit], ==, member[ValueUnit.VOLATILITY]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=volatility, 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=Scalar, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[double], swapAnnuity]
local_variable[type[double], parSwaprate]
local_variable[type[double], optionMaturity]
local_variable[type[double], valueSwaption]
return[ClassCreator(arguments=[MemberReference(member=valueSwaption, 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=Scalar, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[RandomVariable] identifier[getValues] operator[SEP] Keyword[double] identifier[evaluationTime] , identifier[LIBORMarketModel] identifier[model] operator[SEP] {
Keyword[if] operator[SEP] identifier[evaluationTime] operator[>] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[double] identifier[swapStart] operator[=] identifier[swapTenor] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[double] identifier[swapEnd] operator[=] identifier[swapTenor] operator[SEP] identifier[swapTenor] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[swapStartIndex] operator[=] identifier[model] operator[SEP] identifier[getLiborPeriodIndex] operator[SEP] identifier[swapStart] operator[SEP] operator[SEP] Keyword[int] identifier[swapEndIndex] operator[=] identifier[model] operator[SEP] identifier[getLiborPeriodIndex] operator[SEP] identifier[swapEnd] operator[SEP] operator[SEP] Keyword[int] identifier[optionMaturityIndex] operator[=] identifier[model] operator[SEP] identifier[getCovarianceModel] operator[SEP] operator[SEP] operator[SEP] identifier[getTimeDiscretization] operator[SEP] operator[SEP] operator[SEP] identifier[getTimeIndex] operator[SEP] identifier[swapStart] operator[SEP] operator[-] Other[1] operator[SEP] identifier[Map] operator[<] identifier[String] , Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[logSwaprateDerivative] operator[=] identifier[getLogSwaprateDerivative] operator[SEP] identifier[model] operator[SEP] identifier[getLiborPeriodDiscretization] operator[SEP] operator[SEP] , identifier[model] operator[SEP] identifier[getForwardRateCurve] operator[SEP] operator[SEP] , identifier[swapTenor] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[swapCovarianceWeights] operator[=] identifier[logSwaprateDerivative] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[discountFactors] operator[=] identifier[logSwaprateDerivative] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[swapAnnuities] operator[=] identifier[logSwaprateDerivative] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[integratedLIBORCovariance] operator[=] identifier[model] operator[SEP] identifier[getIntegratedLIBORCovariance] operator[SEP] operator[SEP] operator[SEP] identifier[optionMaturityIndex] operator[SEP] operator[SEP] Keyword[double] identifier[integratedSwapRateVariance] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[componentIndex1] operator[=] identifier[swapStartIndex] operator[SEP] identifier[componentIndex1] operator[<] identifier[swapEndIndex] operator[SEP] identifier[componentIndex1] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[componentIndex2] operator[=] identifier[componentIndex1] operator[+] Other[1] operator[SEP] identifier[componentIndex2] operator[<] identifier[swapEndIndex] operator[SEP] identifier[componentIndex2] operator[++] operator[SEP] {
identifier[integratedSwapRateVariance] operator[+=] literal[Float] operator[*] identifier[swapCovarianceWeights] operator[SEP] identifier[componentIndex1] operator[-] identifier[swapStartIndex] operator[SEP] operator[*] identifier[swapCovarianceWeights] operator[SEP] identifier[componentIndex2] operator[-] identifier[swapStartIndex] operator[SEP] operator[*] identifier[integratedLIBORCovariance] operator[SEP] identifier[componentIndex1] operator[SEP] operator[SEP] identifier[componentIndex2] operator[SEP] operator[SEP]
}
identifier[integratedSwapRateVariance] operator[+=] identifier[swapCovarianceWeights] operator[SEP] identifier[componentIndex1] operator[-] identifier[swapStartIndex] operator[SEP] operator[*] identifier[swapCovarianceWeights] operator[SEP] identifier[componentIndex1] operator[-] identifier[swapStartIndex] operator[SEP] operator[*] identifier[integratedLIBORCovariance] operator[SEP] identifier[componentIndex1] operator[SEP] operator[SEP] identifier[componentIndex1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[valueUnit] operator[==] identifier[ValueUnit] operator[SEP] identifier[INTEGRATEDVARIANCELOGNORMAL] operator[||] identifier[valueUnit] operator[==] identifier[ValueUnit] operator[SEP] identifier[INTEGRATEDVARIANCE] operator[SEP] {
Keyword[return] Keyword[new] identifier[Scalar] operator[SEP] identifier[integratedSwapRateVariance] operator[SEP] operator[SEP]
}
Keyword[double] identifier[volatility] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[integratedSwapRateVariance] operator[/] identifier[swapStart] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[valueUnit] operator[==] identifier[ValueUnit] operator[SEP] identifier[VOLATILITYLOGNORMAL] operator[||] identifier[valueUnit] operator[==] identifier[ValueUnit] operator[SEP] identifier[VOLATILITY] operator[SEP] {
Keyword[return] Keyword[new] identifier[Scalar] operator[SEP] identifier[volatility] operator[SEP] operator[SEP]
}
Keyword[double] identifier[swapAnnuity] operator[=] identifier[swapAnnuities] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[double] identifier[parSwaprate] operator[=] operator[SEP] identifier[discountFactors] operator[SEP] Other[0] operator[SEP] operator[-] identifier[discountFactors] operator[SEP] identifier[swapEndIndex] operator[-] identifier[swapStartIndex] operator[SEP] operator[SEP] operator[/] identifier[swapAnnuity] operator[SEP] Keyword[double] identifier[optionMaturity] operator[=] identifier[swapStart] operator[SEP] Keyword[double] identifier[valueSwaption] operator[=] identifier[AnalyticFormulas] operator[SEP] identifier[blackModelSwaptionValue] operator[SEP] identifier[parSwaprate] , identifier[volatility] , identifier[optionMaturity] , identifier[swaprate] , identifier[swapAnnuity] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Scalar] operator[SEP] identifier[valueSwaption] operator[SEP] operator[SEP]
}
|
public ApplicationDefinition getApplication(String appName) {
checkServiceState();
Tenant tenant = TenantService.instance().getDefaultTenant();
return getApplicationDefinition(tenant, appName);
} | class class_name[name] begin[{]
method[getApplication, return_type[type[ApplicationDefinition]], modifier[public], parameter[appName]] begin[{]
call[.checkServiceState, parameter[]]
local_variable[type[Tenant], tenant]
return[call[.getApplicationDefinition, parameter[member[.tenant], member[.appName]]]]
end[}]
END[}] | Keyword[public] identifier[ApplicationDefinition] identifier[getApplication] operator[SEP] identifier[String] identifier[appName] operator[SEP] {
identifier[checkServiceState] operator[SEP] operator[SEP] operator[SEP] identifier[Tenant] identifier[tenant] operator[=] identifier[TenantService] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultTenant] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getApplicationDefinition] operator[SEP] identifier[tenant] , identifier[appName] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "rationals")
public JAXBElement<ConstantType> createRationals(ConstantType value) {
return new JAXBElement<ConstantType>(_Rationals_QNAME, ConstantType.class, null, value);
} | class class_name[name] begin[{]
method[createRationals, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Rationals_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstantType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ConstantType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[ConstantType] operator[>] identifier[createRationals] operator[SEP] identifier[ConstantType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[ConstantType] operator[>] operator[SEP] identifier[_Rationals_QNAME] , identifier[ConstantType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public static RRSIGRecord
sign(RRset rrset, DNSKEYRecord key, PrivateKey privkey,
Date inception, Date expiration, String provider) throws DNSSECException
{
int alg = key.getAlgorithm();
checkAlgorithm(privkey, alg);
RRSIGRecord rrsig = new RRSIGRecord(rrset.getName(), rrset.getDClass(),
rrset.getTTL(), rrset.getType(),
alg, rrset.getTTL(),
expiration, inception,
key.getFootprint(),
key.getName(), null);
rrsig.setSignature(sign(privkey, key.getPublicKey(), alg,
digestRRset(rrsig, rrset), provider));
return rrsig;
} | class class_name[name] begin[{]
method[sign, return_type[type[RRSIGRecord]], modifier[public static], parameter[rrset, key, privkey, inception, expiration, provider]] begin[{]
local_variable[type[int], alg]
call[.checkAlgorithm, parameter[member[.privkey], member[.alg]]]
local_variable[type[RRSIGRecord], rrsig]
call[rrsig.setSignature, parameter[call[.sign, parameter[member[.privkey], call[key.getPublicKey, parameter[]], member[.alg], call[.digestRRset, parameter[member[.rrsig], member[.rrset]]], member[.provider]]]]]
return[member[.rrsig]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RRSIGRecord] identifier[sign] operator[SEP] identifier[RRset] identifier[rrset] , identifier[DNSKEYRecord] identifier[key] , identifier[PrivateKey] identifier[privkey] , identifier[Date] identifier[inception] , identifier[Date] identifier[expiration] , identifier[String] identifier[provider] operator[SEP] Keyword[throws] identifier[DNSSECException] {
Keyword[int] identifier[alg] operator[=] identifier[key] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] operator[SEP] identifier[checkAlgorithm] operator[SEP] identifier[privkey] , identifier[alg] operator[SEP] operator[SEP] identifier[RRSIGRecord] identifier[rrsig] operator[=] Keyword[new] identifier[RRSIGRecord] operator[SEP] identifier[rrset] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[rrset] operator[SEP] identifier[getDClass] operator[SEP] operator[SEP] , identifier[rrset] operator[SEP] identifier[getTTL] operator[SEP] operator[SEP] , identifier[rrset] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[alg] , identifier[rrset] operator[SEP] identifier[getTTL] operator[SEP] operator[SEP] , identifier[expiration] , identifier[inception] , identifier[key] operator[SEP] identifier[getFootprint] operator[SEP] operator[SEP] , identifier[key] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[rrsig] operator[SEP] identifier[setSignature] operator[SEP] identifier[sign] operator[SEP] identifier[privkey] , identifier[key] operator[SEP] identifier[getPublicKey] operator[SEP] operator[SEP] , identifier[alg] , identifier[digestRRset] operator[SEP] identifier[rrsig] , identifier[rrset] operator[SEP] , identifier[provider] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[rrsig] operator[SEP]
}
|
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AfplibPackage.CFI__FIXED_LENGTH_RG:
return ((InternalEList<?>)getFixedLengthRG()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
} | class class_name[name] begin[{]
method[eInverseRemove, return_type[type[NotificationChain]], modifier[public], parameter[otherEnd, featureID, msgs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=CFI__FIXED_LENGTH_RG, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getFixedLengthRG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=InternalEList, sub_type=None)), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eInverseRemove, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[NotificationChain] identifier[eInverseRemove] operator[SEP] identifier[InternalEObject] identifier[otherEnd] , Keyword[int] identifier[featureID] , identifier[NotificationChain] identifier[msgs] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[CFI__FIXED_LENGTH_RG] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[InternalEList] operator[<] operator[?] operator[>] operator[SEP] identifier[getFixedLengthRG] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[basicRemove] operator[SEP] identifier[otherEnd] , identifier[msgs] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eInverseRemove] operator[SEP] identifier[otherEnd] , identifier[featureID] , identifier[msgs] operator[SEP] operator[SEP]
}
|
private void clearDeckDetail(TrackMetadataUpdate update) {
if (detailHotCache.remove(DeckReference.getDeckReference(update.player, 0)) != null) {
deliverWaveformDetailUpdate(update.player, null);
}
} | class class_name[name] begin[{]
method[clearDeckDetail, return_type[void], modifier[private], parameter[update]] begin[{]
if[binary_operation[call[detailHotCache.remove, parameter[call[DeckReference.getDeckReference, parameter[member[update.player], literal[0]]]]], !=, literal[null]]] begin[{]
call[.deliverWaveformDetailUpdate, parameter[member[update.player], literal[null]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[clearDeckDetail] operator[SEP] identifier[TrackMetadataUpdate] identifier[update] operator[SEP] {
Keyword[if] operator[SEP] identifier[detailHotCache] operator[SEP] identifier[remove] operator[SEP] identifier[DeckReference] operator[SEP] identifier[getDeckReference] operator[SEP] identifier[update] operator[SEP] identifier[player] , Other[0] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[deliverWaveformDetailUpdate] operator[SEP] identifier[update] operator[SEP] identifier[player] , Other[null] operator[SEP] operator[SEP]
}
}
|
public static String decodeHtmlEntities(String input, String encoding) {
Matcher matcher = ENTITIY_PATTERN.matcher(input);
StringBuffer result = new StringBuffer(input.length());
Charset charset = Charset.forName(encoding);
CharsetEncoder encoder = charset.newEncoder();
while (matcher.find()) {
String entity = matcher.group();
String value = entity.substring(2, entity.length() - 1);
int c = Integer.valueOf(value).intValue();
if (c < 128) {
// first 128 chars are contained in almost every charset
entity = new String(new char[] {(char)c});
// this is intended as performance improvement since
// the canEncode() operation appears quite CPU heavy
} else if (encoder.canEncode((char)c)) {
// encoder can encode this char
entity = new String(new char[] {(char)c});
}
matcher.appendReplacement(result, entity);
}
matcher.appendTail(result);
return result.toString();
} | class class_name[name] begin[{]
method[decodeHtmlEntities, return_type[type[String]], modifier[public static], parameter[input, encoding]] begin[{]
local_variable[type[Matcher], matcher]
local_variable[type[StringBuffer], result]
local_variable[type[Charset], charset]
local_variable[type[CharsetEncoder], encoder]
while[call[matcher.find, parameter[]]] begin[{]
local_variable[type[String], entity]
local_variable[type[String], value]
local_variable[type[int], c]
if[binary_operation[member[.c], <, literal[128]]] begin[{]
assign[member[.entity], ClassCreator(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Cast(expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=char))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
if[call[encoder.canEncode, parameter[Cast(expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]]] begin[{]
assign[member[.entity], ClassCreator(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Cast(expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=char))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
None
end[}]
end[}]
call[matcher.appendReplacement, parameter[member[.result], member[.entity]]]
end[}]
call[matcher.appendTail, parameter[member[.result]]]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[decodeHtmlEntities] operator[SEP] identifier[String] identifier[input] , identifier[String] identifier[encoding] operator[SEP] {
identifier[Matcher] identifier[matcher] operator[=] identifier[ENTITIY_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[result] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[input] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Charset] identifier[charset] operator[=] identifier[Charset] operator[SEP] identifier[forName] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] identifier[CharsetEncoder] identifier[encoder] operator[=] identifier[charset] operator[SEP] identifier[newEncoder] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[entity] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[entity] operator[SEP] identifier[substring] operator[SEP] Other[2] , identifier[entity] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[c] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[<] Other[128] operator[SEP] {
identifier[entity] operator[=] Keyword[new] identifier[String] operator[SEP] Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
operator[SEP] Keyword[char] operator[SEP] identifier[c]
} operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[encoder] operator[SEP] identifier[canEncode] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
identifier[entity] operator[=] Keyword[new] identifier[String] operator[SEP] Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
operator[SEP] Keyword[char] operator[SEP] identifier[c]
} operator[SEP] operator[SEP]
}
identifier[matcher] operator[SEP] identifier[appendReplacement] operator[SEP] identifier[result] , identifier[entity] operator[SEP] operator[SEP]
}
identifier[matcher] operator[SEP] identifier[appendTail] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void close() throws IOException {
fInputStream.close();
fInputStream = null;
fCharBuf = null;
fBuffer = null;
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
call[fInputStream.close, parameter[]]
assign[member[.fInputStream], literal[null]]
assign[member[.fCharBuf], literal[null]]
assign[member[.fBuffer], literal[null]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[fInputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[fInputStream] operator[=] Other[null] operator[SEP] identifier[fCharBuf] operator[=] Other[null] operator[SEP] identifier[fBuffer] operator[=] Other[null] operator[SEP]
}
|
@Override
public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
BLOB newBlob = null;
try {
if (attributeObject != null) {
newBlob = BLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, BLOB.DURATION_SESSION);
jpsf.AddReleasible(new OracleTemporaryBlob(newBlob));
//OutputStream os = newBlob.getBinaryOutputStream();
OutputStream os = newBlob.setBinaryStream(0);
os.write(attributeObject);
os.close();
}
} catch (Exception e) {
String msg = "Error BLOBing Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return newBlob;
} | class class_name[name] begin[{]
method[transformOut, return_type[type[Blob]], modifier[public], parameter[jpsf, attributeObject]] begin[{]
local_variable[type[BLOB], newBlob]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=attributeObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newBlob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPreparedStatement, postfix_operators=[], prefix_operators=[], qualifier=jpsf, selectors=[MethodInvocation(arguments=[], member=getConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=DURATION_SESSION, postfix_operators=[], prefix_operators=[], qualifier=BLOB, selectors=[])], member=createTemporary, postfix_operators=[], prefix_operators=[], qualifier=BLOB, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=newBlob, 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=OracleTemporaryBlob, sub_type=None))], member=AddReleasible, postfix_operators=[], prefix_operators=[], qualifier=jpsf, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setBinaryStream, postfix_operators=[], prefix_operators=[], qualifier=newBlob, selectors=[], type_arguments=None), name=os)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OutputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attributeObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error BLOBing Byte Array"), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, 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=CpoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.newBlob]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Blob] identifier[transformOut] operator[SEP] identifier[JdbcPreparedStatementFactory] identifier[jpsf] , Keyword[byte] operator[SEP] operator[SEP] identifier[attributeObject] operator[SEP] Keyword[throws] identifier[CpoException] {
identifier[BLOB] identifier[newBlob] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[attributeObject] operator[!=] Other[null] operator[SEP] {
identifier[newBlob] operator[=] identifier[BLOB] operator[SEP] identifier[createTemporary] operator[SEP] identifier[jpsf] operator[SEP] identifier[getPreparedStatement] operator[SEP] operator[SEP] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] , literal[boolean] , identifier[BLOB] operator[SEP] identifier[DURATION_SESSION] operator[SEP] operator[SEP] identifier[jpsf] operator[SEP] identifier[AddReleasible] operator[SEP] Keyword[new] identifier[OracleTemporaryBlob] operator[SEP] identifier[newBlob] operator[SEP] operator[SEP] operator[SEP] identifier[OutputStream] identifier[os] operator[=] identifier[newBlob] operator[SEP] identifier[setBinaryStream] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[os] operator[SEP] identifier[write] operator[SEP] identifier[attributeObject] operator[SEP] operator[SEP] identifier[os] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CpoException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newBlob] operator[SEP]
}
|
public Tags filter(Set<String> tag_names) {
return Tags.valueOf(tags_.entrySet().stream()
.filter(entry -> tag_names.contains(entry.getKey())));
} | class class_name[name] begin[{]
method[filter, return_type[type[Tags]], modifier[public], parameter[tag_names]] begin[{]
return[call[Tags.valueOf, parameter[call[tags_.entrySet, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[Tags] identifier[filter] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[tag_names] operator[SEP] {
Keyword[return] identifier[Tags] operator[SEP] identifier[valueOf] operator[SEP] identifier[tags_] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[entry] operator[->] identifier[tag_names] operator[SEP] identifier[contains] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(ResourceFilter resourceFilter, ProtocolMarshaller protocolMarshaller) {
if (resourceFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resourceFilter.getName(), NAME_BINDING);
protocolMarshaller.marshall(resourceFilter.getValues(), VALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[resourceFilter, protocolMarshaller]] begin[{]
if[binary_operation[member[.resourceFilter], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=resourceFilter, selectors=[], type_arguments=None), MemberReference(member=NAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=resourceFilter, selectors=[], type_arguments=None), MemberReference(member=VALUES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ResourceFilter] identifier[resourceFilter] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[resourceFilter] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resourceFilter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resourceFilter] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] , identifier[VALUES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Pathref getPathrefFromNoderef(
String layoutOwnerUsername, String dlmNoderef, org.dom4j.Element layout) {
Validate.notNull(layoutOwnerUsername, "Argument 'layoutOwnerUsername' cannot be null.");
Validate.notNull(dlmNoderef, "Argument 'dlmNoderef' cannot be null.");
if (log.isTraceEnabled()) {
StringBuilder msg = new StringBuilder();
msg.append("createPathref: [layoutOwnerUsername='")
.append(layoutOwnerUsername)
.append("', dlmNoderef='")
.append(dlmNoderef)
.append("']");
log.trace(msg.toString());
}
Pathref rslt = null; // default; signifies we can't match a node
final Matcher dlmNodeMatcher = DLM_NODE_PATTERN.matcher(dlmNoderef);
if (dlmNodeMatcher.matches()) {
final int userId = Integer.valueOf(dlmNodeMatcher.group(1));
final String nodeId = dlmNodeMatcher.group(2);
final String userName = this.userIdentityStore.getPortalUserName(userId);
final Tuple<String, DistributedUserLayout> userLayoutInfo =
getUserLayoutTuple(userName, userId);
if (userLayoutInfo.second == null) {
this.log.warn(
"no layout for fragment user '"
+ userLayoutInfo.first
+ "' Specified dlmNoderef "
+ dlmNoderef
+ " cannot be resolved.");
return null;
}
final Document fragmentLayout = userLayoutInfo.second.getLayout();
final Node targetElement =
this.xPathOperations.evaluate(
"//*[@ID = $nodeId]",
Collections.singletonMap("nodeId", nodeId),
fragmentLayout,
XPathConstants.NODE);
// We can only proceed if there's a valid match in the document
if (targetElement != null) {
String xpath = this.xmlUtilities.getUniqueXPath(targetElement);
// Pathref objects that refer to portlets are expected to include
// the fname as the 3rd element; other pathref objects should leave
// that element blank.
String fname = null;
Node fnameAttr = targetElement.getAttributes().getNamedItem("fname");
if (fnameAttr != null) {
fname = fnameAttr.getTextContent();
}
rslt = new Pathref(userLayoutInfo.first, xpath, fname);
}
}
final Matcher userNodeMatcher = USER_NODE_PATTERN.matcher(dlmNoderef);
if (userNodeMatcher.find()) {
// We need a pathref based on the new style of layout b/c on
// import this users own layout will not be in the database
// when the path is computed back to an Id...
final String structId = userNodeMatcher.group(1);
final org.dom4j.Node target = layout.selectSingleNode("//*[@ID = '" + structId + "']");
if (target == null) {
this.log.warn(
"no match found on layout for user '"
+ layoutOwnerUsername
+ "' for the specified dlmNoderef: "
+ dlmNoderef);
return null;
}
String fname = null;
if (target.getName().equals("channel")) {
fname = target.valueOf("@fname");
}
rslt = new Pathref(layoutOwnerUsername, target.getUniquePath(), fname);
}
return rslt;
} | class class_name[name] begin[{]
method[getPathrefFromNoderef, return_type[type[Pathref]], modifier[public], parameter[layoutOwnerUsername, dlmNoderef, layout]] begin[{]
call[Validate.notNull, parameter[member[.layoutOwnerUsername], literal["Argument 'layoutOwnerUsername' cannot be null."]]]
call[Validate.notNull, parameter[member[.dlmNoderef], literal["Argument 'dlmNoderef' cannot be null."]]]
if[call[log.isTraceEnabled, parameter[]]] begin[{]
local_variable[type[StringBuilder], msg]
call[msg.append, parameter[literal["createPathref: [layoutOwnerUsername='"]]]
call[log.trace, parameter[call[msg.toString, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Pathref], rslt]
local_variable[type[Matcher], dlmNodeMatcher]
if[call[dlmNodeMatcher.matches, parameter[]]] begin[{]
local_variable[type[int], userId]
local_variable[type[String], nodeId]
local_variable[type[String], userName]
local_variable[type[Tuple], userLayoutInfo]
if[binary_operation[member[userLayoutInfo.second], ==, literal[null]]] begin[{]
THIS[member[None.log]call[None.warn, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["no layout for fragment user '"], +, member[userLayoutInfo.first]], +, literal["' Specified dlmNoderef "]], +, member[.dlmNoderef]], +, literal[" cannot be resolved."]]]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Document], fragmentLayout]
local_variable[type[Node], targetElement]
if[binary_operation[member[.targetElement], !=, literal[null]]] begin[{]
local_variable[type[String], xpath]
local_variable[type[String], fname]
local_variable[type[Node], fnameAttr]
if[binary_operation[member[.fnameAttr], !=, literal[null]]] begin[{]
assign[member[.fname], call[fnameAttr.getTextContent, parameter[]]]
else begin[{]
None
end[}]
assign[member[.rslt], ClassCreator(arguments=[MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=userLayoutInfo, selectors=[]), MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fname, 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=Pathref, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[Matcher], userNodeMatcher]
if[call[userNodeMatcher.find, parameter[]]] begin[{]
local_variable[type[String], structId]
local_variable[type[org], target]
if[binary_operation[member[.target], ==, literal[null]]] begin[{]
THIS[member[None.log]call[None.warn, parameter[binary_operation[binary_operation[binary_operation[literal["no match found on layout for user '"], +, member[.layoutOwnerUsername]], +, literal["' for the specified dlmNoderef: "]], +, member[.dlmNoderef]]]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], fname]
if[call[target.getName, parameter[]]] begin[{]
assign[member[.fname], call[target.valueOf, parameter[literal["@fname"]]]]
else begin[{]
None
end[}]
assign[member[.rslt], ClassCreator(arguments=[MemberReference(member=layoutOwnerUsername, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getUniquePath, postfix_operators=[], prefix_operators=[], qualifier=target, selectors=[], type_arguments=None), MemberReference(member=fname, 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=Pathref, sub_type=None))]
else begin[{]
None
end[}]
return[member[.rslt]]
end[}]
END[}] | Keyword[public] identifier[Pathref] identifier[getPathrefFromNoderef] operator[SEP] identifier[String] identifier[layoutOwnerUsername] , identifier[String] identifier[dlmNoderef] , identifier[org] operator[SEP] identifier[dom4j] operator[SEP] identifier[Element] identifier[layout] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[layoutOwnerUsername] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[dlmNoderef] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[msg] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[layoutOwnerUsername] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[dlmNoderef] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Pathref] identifier[rslt] operator[=] Other[null] operator[SEP] Keyword[final] identifier[Matcher] identifier[dlmNodeMatcher] operator[=] identifier[DLM_NODE_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[dlmNoderef] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dlmNodeMatcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[userId] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[dlmNodeMatcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[nodeId] operator[=] identifier[dlmNodeMatcher] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[userName] operator[=] Keyword[this] operator[SEP] identifier[userIdentityStore] operator[SEP] identifier[getPortalUserName] operator[SEP] identifier[userId] operator[SEP] operator[SEP] Keyword[final] identifier[Tuple] operator[<] identifier[String] , identifier[DistributedUserLayout] operator[>] identifier[userLayoutInfo] operator[=] identifier[getUserLayoutTuple] operator[SEP] identifier[userName] , identifier[userId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[userLayoutInfo] operator[SEP] identifier[second] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[userLayoutInfo] operator[SEP] identifier[first] operator[+] literal[String] operator[+] identifier[dlmNoderef] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[Document] identifier[fragmentLayout] operator[=] identifier[userLayoutInfo] operator[SEP] identifier[second] operator[SEP] identifier[getLayout] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Node] identifier[targetElement] operator[=] Keyword[this] operator[SEP] identifier[xPathOperations] operator[SEP] identifier[evaluate] operator[SEP] literal[String] , identifier[Collections] operator[SEP] identifier[singletonMap] operator[SEP] literal[String] , identifier[nodeId] operator[SEP] , identifier[fragmentLayout] , identifier[XPathConstants] operator[SEP] identifier[NODE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetElement] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[xpath] operator[=] Keyword[this] operator[SEP] identifier[xmlUtilities] operator[SEP] identifier[getUniqueXPath] operator[SEP] identifier[targetElement] operator[SEP] operator[SEP] identifier[String] identifier[fname] operator[=] Other[null] operator[SEP] identifier[Node] identifier[fnameAttr] operator[=] identifier[targetElement] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[getNamedItem] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fnameAttr] operator[!=] Other[null] operator[SEP] {
identifier[fname] operator[=] identifier[fnameAttr] operator[SEP] identifier[getTextContent] operator[SEP] operator[SEP] operator[SEP]
}
identifier[rslt] operator[=] Keyword[new] identifier[Pathref] operator[SEP] identifier[userLayoutInfo] operator[SEP] identifier[first] , identifier[xpath] , identifier[fname] operator[SEP] operator[SEP]
}
}
Keyword[final] identifier[Matcher] identifier[userNodeMatcher] operator[=] identifier[USER_NODE_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[dlmNoderef] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[userNodeMatcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[structId] operator[=] identifier[userNodeMatcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[final] identifier[org] operator[SEP] identifier[dom4j] operator[SEP] identifier[Node] identifier[target] operator[=] identifier[layout] operator[SEP] identifier[selectSingleNode] operator[SEP] literal[String] operator[+] identifier[structId] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[target] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[layoutOwnerUsername] operator[+] literal[String] operator[+] identifier[dlmNoderef] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[fname] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[target] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[fname] operator[=] identifier[target] operator[SEP] identifier[valueOf] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[rslt] operator[=] Keyword[new] identifier[Pathref] operator[SEP] identifier[layoutOwnerUsername] , identifier[target] operator[SEP] identifier[getUniquePath] operator[SEP] operator[SEP] , identifier[fname] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rslt] operator[SEP]
}
|
@Override
public OffsetTime with(TemporalField field, long newValue) {
if (field instanceof ChronoField) {
if (field == OFFSET_SECONDS) {
ChronoField f = (ChronoField) field;
return with(time, ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
}
return with(time.with(field, newValue), offset);
}
return field.adjustInto(this, newValue);
} | class class_name[name] begin[{]
method[with, return_type[type[OffsetTime]], modifier[public], parameter[field, newValue]] begin[{]
if[binary_operation[member[.field], instanceof, type[ChronoField]]] begin[{]
if[binary_operation[member[.field], ==, member[.OFFSET_SECONDS]]] begin[{]
local_variable[type[ChronoField], f]
return[call[.with, parameter[member[.time], call[ZoneOffset.ofTotalSeconds, parameter[call[f.checkValidIntValue, parameter[member[.newValue]]]]]]]]
else begin[{]
None
end[}]
return[call[.with, parameter[call[time.with, parameter[member[.field], member[.newValue]]], member[.offset]]]]
else begin[{]
None
end[}]
return[call[field.adjustInto, parameter[THIS[], member[.newValue]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[OffsetTime] identifier[with] operator[SEP] identifier[TemporalField] identifier[field] , Keyword[long] identifier[newValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] Keyword[instanceof] identifier[ChronoField] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[==] identifier[OFFSET_SECONDS] operator[SEP] {
identifier[ChronoField] identifier[f] operator[=] operator[SEP] identifier[ChronoField] operator[SEP] identifier[field] operator[SEP] Keyword[return] identifier[with] operator[SEP] identifier[time] , identifier[ZoneOffset] operator[SEP] identifier[ofTotalSeconds] operator[SEP] identifier[f] operator[SEP] identifier[checkValidIntValue] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[with] operator[SEP] identifier[time] operator[SEP] identifier[with] operator[SEP] identifier[field] , identifier[newValue] operator[SEP] , identifier[offset] operator[SEP] operator[SEP]
}
Keyword[return] identifier[field] operator[SEP] identifier[adjustInto] operator[SEP] Keyword[this] , identifier[newValue] operator[SEP] operator[SEP]
}
|
public static appfwpolicy_appfwglobal_binding[] get(nitro_service service, String name) throws Exception{
appfwpolicy_appfwglobal_binding obj = new appfwpolicy_appfwglobal_binding();
obj.set_name(name);
appfwpolicy_appfwglobal_binding response[] = (appfwpolicy_appfwglobal_binding[]) obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[appfwpolicy_appfwglobal_binding]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[appfwpolicy_appfwglobal_binding], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[appfwpolicy_appfwglobal_binding], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[appfwpolicy_appfwglobal_binding] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[appfwpolicy_appfwglobal_binding] identifier[obj] operator[=] Keyword[new] identifier[appfwpolicy_appfwglobal_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[appfwpolicy_appfwglobal_binding] identifier[response] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[appfwpolicy_appfwglobal_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
protected void inject(final ActionRequest actionRequest) {
final Targets targets = actionRequest.getTargets();
final ServletContext servletContext = actionRequest.getHttpServletRequest().getServletContext();
scopeResolver.forEachScope(madvocScope -> madvocScope.inject(servletContext, targets));
scopeResolver.forEachScope(madvocScope -> madvocScope.inject(actionRequest, targets));
} | class class_name[name] begin[{]
method[inject, return_type[void], modifier[protected], parameter[actionRequest]] begin[{]
local_variable[type[Targets], targets]
local_variable[type[ServletContext], servletContext]
call[scopeResolver.forEachScope, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=servletContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=inject, postfix_operators=[], prefix_operators=[], qualifier=madvocScope, selectors=[], type_arguments=None), parameters=[MemberReference(member=madvocScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[scopeResolver.forEachScope, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=actionRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=inject, postfix_operators=[], prefix_operators=[], qualifier=madvocScope, selectors=[], type_arguments=None), parameters=[MemberReference(member=madvocScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[inject] operator[SEP] Keyword[final] identifier[ActionRequest] identifier[actionRequest] operator[SEP] {
Keyword[final] identifier[Targets] identifier[targets] operator[=] identifier[actionRequest] operator[SEP] identifier[getTargets] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ServletContext] identifier[servletContext] operator[=] identifier[actionRequest] operator[SEP] identifier[getHttpServletRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] operator[SEP] identifier[scopeResolver] operator[SEP] identifier[forEachScope] operator[SEP] identifier[madvocScope] operator[->] identifier[madvocScope] operator[SEP] identifier[inject] operator[SEP] identifier[servletContext] , identifier[targets] operator[SEP] operator[SEP] operator[SEP] identifier[scopeResolver] operator[SEP] identifier[forEachScope] operator[SEP] identifier[madvocScope] operator[->] identifier[madvocScope] operator[SEP] identifier[inject] operator[SEP] identifier[actionRequest] , identifier[targets] operator[SEP] operator[SEP] operator[SEP]
}
|
@Factory
public static <T extends Throwable> Matcher<T> withMessage(String message) {
return withMessage(is(message));
} | class class_name[name] begin[{]
method[withMessage, return_type[type[Matcher]], modifier[public static], parameter[message]] begin[{]
return[call[.withMessage, parameter[call[.is, parameter[member[.message]]]]]]
end[}]
END[}] | annotation[@] identifier[Factory] Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Throwable] operator[>] identifier[Matcher] operator[<] identifier[T] operator[>] identifier[withMessage] operator[SEP] identifier[String] identifier[message] operator[SEP] {
Keyword[return] identifier[withMessage] operator[SEP] identifier[is] operator[SEP] identifier[message] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean matches(T target) {
Set<TypeDescription> previous = new HashSet<TypeDescription>();
for (TypeDefinition typeDefinition : target) {
if (!previous.add(typeDefinition.asErasure())) { // Main type can be an interface.
return false; // Avoids a life-lock when encountering a recursive type-definition.
} else if (matcher.matches(typeDefinition.asGenericType())) {
return true;
}
LinkedList<TypeDefinition> interfaceTypes = new LinkedList<TypeDefinition>(typeDefinition.getInterfaces());
while (!interfaceTypes.isEmpty()) {
TypeDefinition interfaceType = interfaceTypes.removeFirst();
if (previous.add(interfaceType.asErasure())) {
if (matcher.matches(interfaceType.asGenericType())) {
return true;
} else {
interfaceTypes.addAll(interfaceType.getInterfaces());
}
}
}
}
return false;
} | class class_name[name] begin[{]
method[matches, return_type[type[boolean]], modifier[public], parameter[target]] begin[{]
local_variable[type[Set], previous]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asErasure, postfix_operators=[], prefix_operators=[], qualifier=typeDefinition, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=['!'], qualifier=previous, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asGenericType, postfix_operators=[], prefix_operators=[], qualifier=typeDefinition, selectors=[], type_arguments=None)], member=matches, postfix_operators=[], prefix_operators=[], qualifier=matcher, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=typeDefinition, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinition, sub_type=None))], dimensions=None, name=LinkedList, sub_type=None)), name=interfaceTypes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinition, sub_type=None))], dimensions=[], name=LinkedList, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=removeFirst, postfix_operators=[], prefix_operators=[], qualifier=interfaceTypes, selectors=[], type_arguments=None), name=interfaceType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinition, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asErasure, postfix_operators=[], prefix_operators=[], qualifier=interfaceType, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=previous, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asGenericType, postfix_operators=[], prefix_operators=[], qualifier=interfaceType, selectors=[], type_arguments=None)], member=matches, postfix_operators=[], prefix_operators=[], qualifier=matcher, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=interfaceType, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=interfaceTypes, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]))]), condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=interfaceTypes, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typeDefinition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinition, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[matches] operator[SEP] identifier[T] identifier[target] operator[SEP] {
identifier[Set] operator[<] identifier[TypeDescription] operator[>] identifier[previous] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[TypeDescription] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TypeDefinition] identifier[typeDefinition] operator[:] identifier[target] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[previous] operator[SEP] identifier[add] operator[SEP] identifier[typeDefinition] operator[SEP] identifier[asErasure] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] identifier[typeDefinition] operator[SEP] identifier[asGenericType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[LinkedList] operator[<] identifier[TypeDefinition] operator[>] identifier[interfaceTypes] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[TypeDefinition] operator[>] operator[SEP] identifier[typeDefinition] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[interfaceTypes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[TypeDefinition] identifier[interfaceType] operator[=] identifier[interfaceTypes] operator[SEP] identifier[removeFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[previous] operator[SEP] identifier[add] operator[SEP] identifier[interfaceType] operator[SEP] identifier[asErasure] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] identifier[interfaceType] operator[SEP] identifier[asGenericType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[interfaceTypes] operator[SEP] identifier[addAll] operator[SEP] identifier[interfaceType] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void main(String[] args) {
System.exit(execute(CLIParser.parse(args), System.out, System.err));
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
call[System.exit, parameter[call[.execute, parameter[call[CLIParser.parse, parameter[member[.args]]], member[System.out], member[System.err]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[System] operator[SEP] identifier[exit] operator[SEP] identifier[execute] operator[SEP] identifier[CLIParser] operator[SEP] identifier[parse] operator[SEP] identifier[args] operator[SEP] , identifier[System] operator[SEP] identifier[out] , identifier[System] operator[SEP] identifier[err] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean isInViewPort(Element element) {
double elementTop = $(element).offset().top;
double elementBottom = elementTop + $(element).outerHeight();
JQueryElement target = getContainerElement();
double viewportTop = target.scrollTop();
if (target.asElement() != getDefaultContainer()) {
viewportTop = target.offset().top;
}
double viewportBottom = viewportTop + target.height();
return elementBottom > viewportTop && elementTop < viewportBottom;
} | class class_name[name] begin[{]
method[isInViewPort, return_type[type[boolean]], modifier[public], parameter[element]] begin[{]
local_variable[type[double], elementTop]
local_variable[type[double], elementBottom]
local_variable[type[JQueryElement], target]
local_variable[type[double], viewportTop]
if[binary_operation[call[target.asElement, parameter[]], !=, call[.getDefaultContainer, parameter[]]]] begin[{]
assign[member[.viewportTop], call[target.offset, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[double], viewportBottom]
return[binary_operation[binary_operation[member[.elementBottom], >, member[.viewportTop]], &&, binary_operation[member[.elementTop], <, member[.viewportBottom]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isInViewPort] operator[SEP] identifier[Element] identifier[element] operator[SEP] {
Keyword[double] identifier[elementTop] operator[=] identifier[$] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[offset] operator[SEP] operator[SEP] operator[SEP] identifier[top] operator[SEP] Keyword[double] identifier[elementBottom] operator[=] identifier[elementTop] operator[+] identifier[$] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[outerHeight] operator[SEP] operator[SEP] operator[SEP] identifier[JQueryElement] identifier[target] operator[=] identifier[getContainerElement] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[viewportTop] operator[=] identifier[target] operator[SEP] identifier[scrollTop] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[target] operator[SEP] identifier[asElement] operator[SEP] operator[SEP] operator[!=] identifier[getDefaultContainer] operator[SEP] operator[SEP] operator[SEP] {
identifier[viewportTop] operator[=] identifier[target] operator[SEP] identifier[offset] operator[SEP] operator[SEP] operator[SEP] identifier[top] operator[SEP]
}
Keyword[double] identifier[viewportBottom] operator[=] identifier[viewportTop] operator[+] identifier[target] operator[SEP] identifier[height] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[elementBottom] operator[>] identifier[viewportTop] operator[&&] identifier[elementTop] operator[<] identifier[viewportBottom] operator[SEP]
}
|
@Disconnect
public void onDisconnect(AtmosphereResourceEvent event) {
if (event.isCancelled()) {
// We didn't get notified, so we remove the user.
users.values().remove(event.getResource().uuid());
logger.info("Browser {} unexpectedly disconnected", event.getResource().uuid());
} else if (event.isClosedByClient()) {
logger.info("Browser {} closed the connection", event.getResource().uuid());
}
} | class class_name[name] begin[{]
method[onDisconnect, return_type[void], modifier[public], parameter[event]] begin[{]
if[call[event.isCancelled, parameter[]]] begin[{]
call[users.values, parameter[]]
call[logger.info, parameter[literal["Browser {} unexpectedly disconnected"], call[event.getResource, parameter[]]]]
else begin[{]
if[call[event.isClosedByClient, parameter[]]] begin[{]
call[logger.info, parameter[literal["Browser {} closed the connection"], call[event.getResource, parameter[]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Disconnect] Keyword[public] Keyword[void] identifier[onDisconnect] operator[SEP] identifier[AtmosphereResourceEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] {
identifier[users] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[event] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[event] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[isClosedByClient] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[event] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void sortNode(TreeNode node, Comparator comparator) {
TreeNodeList children = (TreeNodeList) node.getChildren();
if (children != null && !children.isEmpty()) {
Object[] childrenArray = children.toArray();
Arrays.sort(childrenArray, comparator);
for (int i = 0; i < childrenArray.length; i++) {
children.setSibling(i, (TreeNode) childrenArray[i]);
}
for (int i = 0; i < children.size(); i++) {
sortNode(children.get(i), comparator);
}
}
} | class class_name[name] begin[{]
method[sortNode, return_type[void], modifier[public static], parameter[node, comparator]] begin[{]
local_variable[type[TreeNodeList], children]
if[binary_operation[binary_operation[member[.children], !=, literal[null]], &&, call[children.isEmpty, parameter[]]]] begin[{]
local_variable[type[Object], childrenArray]
call[Arrays.sort, parameter[member[.childrenArray], member[.comparator]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=childrenArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=ReferenceType(arguments=None, dimensions=[], name=TreeNode, sub_type=None))], member=setSibling, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=childrenArray, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[], type_arguments=None), MemberReference(member=comparator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sortNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[sortNode] operator[SEP] identifier[TreeNode] identifier[node] , identifier[Comparator] identifier[comparator] operator[SEP] {
identifier[TreeNodeList] identifier[children] operator[=] operator[SEP] identifier[TreeNodeList] operator[SEP] identifier[node] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[children] operator[!=] Other[null] operator[&&] operator[!] identifier[children] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[childrenArray] operator[=] identifier[children] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[childrenArray] , identifier[comparator] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[childrenArray] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[children] operator[SEP] identifier[setSibling] operator[SEP] identifier[i] , operator[SEP] identifier[TreeNode] operator[SEP] identifier[childrenArray] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[children] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sortNode] operator[SEP] identifier[children] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , identifier[comparator] operator[SEP] operator[SEP]
}
}
}
|
public boolean contains(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx >= data.length) {
return false;
}
return (data[idx] & (1 << ele)) != 0;
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[ele]] begin[{]
local_variable[type[int], idx]
assign[member[.idx], binary_operation[member[.ele], >>, member[.SHIFT]]]
if[binary_operation[member[.idx], >=, member[data.length]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[member[.data], &, binary_operation[literal[1], <<, member[.ele]]], !=, literal[0]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] Keyword[int] identifier[ele] operator[SEP] {
Keyword[int] identifier[idx] operator[SEP] identifier[idx] operator[=] identifier[ele] operator[>] operator[>] identifier[SHIFT] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>=] identifier[data] operator[SEP] identifier[length] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] operator[SEP] identifier[data] operator[SEP] identifier[idx] operator[SEP] operator[&] operator[SEP] Other[1] operator[<<] identifier[ele] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP]
}
|
private void log(Encoder encoder) throws IOException {
if(encoder==null) log.write("null");
else {
String className = encoder.getClass().getName();
// Some shortcuts from the ao-encoding project, classnames used here to avoid hard dependency
if("com.aoindustries.encoding.JavaScriptInXhtmlAttributeEncoder".equals(className)) {
log.write("javaScriptInXhtmlAttributeEncoder");
} else if("com.aoindustries.encoding.JavaScriptInXhtmlEncoder".equals(className)) {
log.write("javaScriptInXhtmlEncoder");
} else if("com.aoindustries.encoding.TextInXhtmlAttributeEncoder".equals(className)) {
log.write("textInXhtmlAttributeEncoder");
} else {
log.write(className);
}
}
} | class class_name[name] begin[{]
method[log, return_type[void], modifier[private], parameter[encoder]] begin[{]
if[binary_operation[member[.encoder], ==, literal[null]]] begin[{]
call[log.write, parameter[literal["null"]]]
else begin[{]
local_variable[type[String], className]
if[literal["com.aoindustries.encoding.JavaScriptInXhtmlAttributeEncoder"]] begin[{]
call[log.write, parameter[literal["javaScriptInXhtmlAttributeEncoder"]]]
else begin[{]
if[literal["com.aoindustries.encoding.JavaScriptInXhtmlEncoder"]] begin[{]
call[log.write, parameter[literal["javaScriptInXhtmlEncoder"]]]
else begin[{]
if[literal["com.aoindustries.encoding.TextInXhtmlAttributeEncoder"]] begin[{]
call[log.write, parameter[literal["textInXhtmlAttributeEncoder"]]]
else begin[{]
call[log.write, parameter[member[.className]]]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[log] operator[SEP] identifier[Encoder] identifier[encoder] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[encoder] operator[==] Other[null] operator[SEP] identifier[log] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] {
identifier[String] identifier[className] operator[=] identifier[encoder] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[write] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
}
}
|
public <T> FieldFormatter<T> findFormatter(final String fieldPath, final Class<T> requiredType) {
// 完全なパスで比較
FieldFormatter<T> formatter = getFormatter(fieldPath, requiredType);
if(formatter != null) {
return formatter;
}
// インデックスを除去した形式で比較
final List<String> strippedPaths = new ArrayList<>();
addStrippedPropertyPaths(strippedPaths, "", fieldPath);
for(String strippedPath : strippedPaths) {
formatter = getFormatter(strippedPath, requiredType);
if(formatter != null) {
return formatter;
}
}
// 見つからない場合は、タイプのみで比較した物を取得する
return getFormatter(requiredType);
} | class class_name[name] begin[{]
method[findFormatter, return_type[type[FieldFormatter]], modifier[public], parameter[fieldPath, requiredType]] begin[{]
local_variable[type[FieldFormatter], formatter]
if[binary_operation[member[.formatter], !=, literal[null]]] begin[{]
return[member[.formatter]]
else begin[{]
None
end[}]
local_variable[type[List], strippedPaths]
call[.addStrippedPropertyPaths, parameter[member[.strippedPaths], literal[""], member[.fieldPath]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=strippedPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requiredType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFormatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=formatter, 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=[ReturnStatement(expression=MemberReference(member=formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=strippedPaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=strippedPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[.getFormatter, parameter[member[.requiredType]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[FieldFormatter] operator[<] identifier[T] operator[>] identifier[findFormatter] operator[SEP] Keyword[final] identifier[String] identifier[fieldPath] , Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[requiredType] operator[SEP] {
identifier[FieldFormatter] operator[<] identifier[T] operator[>] identifier[formatter] operator[=] identifier[getFormatter] operator[SEP] identifier[fieldPath] , identifier[requiredType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formatter] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[formatter] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[strippedPaths] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addStrippedPropertyPaths] operator[SEP] identifier[strippedPaths] , literal[String] , identifier[fieldPath] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[strippedPath] operator[:] identifier[strippedPaths] operator[SEP] {
identifier[formatter] operator[=] identifier[getFormatter] operator[SEP] identifier[strippedPath] , identifier[requiredType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formatter] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[formatter] operator[SEP]
}
}
Keyword[return] identifier[getFormatter] operator[SEP] identifier[requiredType] operator[SEP] operator[SEP]
}
|
public Quaternionf rotateTo(float fromDirX, float fromDirY, float fromDirZ, float toDirX, float toDirY, float toDirZ) {
return rotateTo(fromDirX, fromDirY, fromDirZ, toDirX, toDirY, toDirZ, this);
} | class class_name[name] begin[{]
method[rotateTo, return_type[type[Quaternionf]], modifier[public], parameter[fromDirX, fromDirY, fromDirZ, toDirX, toDirY, toDirZ]] begin[{]
return[call[.rotateTo, parameter[member[.fromDirX], member[.fromDirY], member[.fromDirZ], member[.toDirX], member[.toDirY], member[.toDirZ], THIS[]]]]
end[}]
END[}] | Keyword[public] identifier[Quaternionf] identifier[rotateTo] operator[SEP] Keyword[float] identifier[fromDirX] , Keyword[float] identifier[fromDirY] , Keyword[float] identifier[fromDirZ] , Keyword[float] identifier[toDirX] , Keyword[float] identifier[toDirY] , Keyword[float] identifier[toDirZ] operator[SEP] {
Keyword[return] identifier[rotateTo] operator[SEP] identifier[fromDirX] , identifier[fromDirY] , identifier[fromDirZ] , identifier[toDirX] , identifier[toDirY] , identifier[toDirZ] , Keyword[this] operator[SEP] operator[SEP]
}
|
public Request getObjectOfflineAsync(@NonNull final String objectID, final @Nullable List<String> attributesToRetrieve, @NonNull CompletionHandler completionHandler) {
if (!mirrored) {
throw new IllegalStateException("Mirroring not activated on this index");
}
return getClient().new AsyncTaskRequest(completionHandler, getClient().localSearchExecutorService) {
@NonNull
@Override
protected JSONObject run() throws AlgoliaException {
return _getObjectOffline(objectID, attributesToRetrieve);
}
}.start();
} | class class_name[name] begin[{]
method[getObjectOfflineAsync, return_type[type[Request]], modifier[public], parameter[objectID, attributesToRetrieve, completionHandler]] begin[{]
if[member[.mirrored]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Mirroring not activated on this index")], 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[}]
return[call[.getClient, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[Request] identifier[getObjectOfflineAsync] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[String] identifier[objectID] , Keyword[final] annotation[@] identifier[Nullable] identifier[List] operator[<] identifier[String] operator[>] identifier[attributesToRetrieve] , annotation[@] identifier[NonNull] identifier[CompletionHandler] identifier[completionHandler] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[mirrored] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[AsyncTaskRequest] operator[SEP] identifier[completionHandler] , identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[localSearchExecutorService] operator[SEP] {
annotation[@] identifier[NonNull] annotation[@] identifier[Override] Keyword[protected] identifier[JSONObject] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[AlgoliaException] {
Keyword[return] identifier[_getObjectOffline] operator[SEP] identifier[objectID] , identifier[attributesToRetrieve] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
public Map<String, String> newKeys() {
Map<String, String> keys = getEntity(invokePost("_newkeys", null), Map.class);
if (keys != null && keys.containsKey("secretKey")) {
this.secretKey = keys.get("secretKey");
}
return keys;
} | class class_name[name] begin[{]
method[newKeys, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], keys]
if[binary_operation[binary_operation[member[.keys], !=, literal[null]], &&, call[keys.containsKey, parameter[literal["secretKey"]]]]] begin[{]
assign[THIS[member[None.secretKey]], call[keys.get, parameter[literal["secretKey"]]]]
else begin[{]
None
end[}]
return[member[.keys]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[newKeys] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[keys] operator[=] identifier[getEntity] operator[SEP] identifier[invokePost] operator[SEP] literal[String] , Other[null] operator[SEP] , identifier[Map] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keys] operator[!=] Other[null] operator[&&] identifier[keys] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[secretKey] operator[=] identifier[keys] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[keys] operator[SEP]
}
|
public static void setFieldValue(ODocument document, String fieldname, String value) {
document.field(fieldname, value);
} | class class_name[name] begin[{]
method[setFieldValue, return_type[void], modifier[public static], parameter[document, fieldname, value]] begin[{]
call[document.field, parameter[member[.fieldname], member[.value]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setFieldValue] operator[SEP] identifier[ODocument] identifier[document] , identifier[String] identifier[fieldname] , identifier[String] identifier[value] operator[SEP] {
identifier[document] operator[SEP] identifier[field] operator[SEP] identifier[fieldname] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public void watch(@Service DatabaseWatch watch, String sql,
Result<Cancel> result,
Object ...args)
{
_kraken.query(sql,
result.then((x,r)->{ x.watch(watch, r, args); }));
} | class class_name[name] begin[{]
method[watch, return_type[void], modifier[public], parameter[watch, sql, result, args]] begin[{]
call[_kraken.query, parameter[member[.sql], call[result.then, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=watch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=watch, postfix_operators=[], prefix_operators=[], qualifier=x, selectors=[], type_arguments=None), label=None)], parameters=[InferredFormalParameter(name=x), InferredFormalParameter(name=r)])]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[watch] operator[SEP] annotation[@] identifier[Service] identifier[DatabaseWatch] identifier[watch] , identifier[String] identifier[sql] , identifier[Result] operator[<] identifier[Cancel] operator[>] identifier[result] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[_kraken] operator[SEP] identifier[query] operator[SEP] identifier[sql] , identifier[result] operator[SEP] identifier[then] operator[SEP] operator[SEP] identifier[x] , identifier[r] operator[SEP] operator[->] {
identifier[x] operator[SEP] identifier[watch] operator[SEP] identifier[watch] , identifier[r] , identifier[args] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void setOutstream(OutputStream outstream) {
if ( buffout == null )
{
// try reuse
buffout = (FSTOutputStream) conf.getCachedObject(FSTOutputStream.class);
if ( buffout == null ) // if fail, alloc
buffout = new FSTOutputStream(1000, outstream);
else
buffout.reset(); // reset resued fstoutput
}
if ( outstream == null )
buffout.setOutstream(buffout);
else
buffout.setOutstream(outstream);
} | class class_name[name] begin[{]
method[setOutstream, return_type[void], modifier[public], parameter[outstream]] begin[{]
if[binary_operation[member[.buffout], ==, literal[null]]] begin[{]
assign[member[.buffout], Cast(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FSTOutputStream, sub_type=None))], member=getCachedObject, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FSTOutputStream, sub_type=None))]
if[binary_operation[member[.buffout], ==, literal[null]]] begin[{]
assign[member[.buffout], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), MemberReference(member=outstream, 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=FSTOutputStream, sub_type=None))]
else begin[{]
call[buffout.reset, parameter[]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.outstream], ==, literal[null]]] begin[{]
call[buffout.setOutstream, parameter[member[.buffout]]]
else begin[{]
call[buffout.setOutstream, parameter[member[.outstream]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setOutstream] operator[SEP] identifier[OutputStream] identifier[outstream] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffout] operator[==] Other[null] operator[SEP] {
identifier[buffout] operator[=] operator[SEP] identifier[FSTOutputStream] operator[SEP] identifier[conf] operator[SEP] identifier[getCachedObject] operator[SEP] identifier[FSTOutputStream] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[buffout] operator[==] Other[null] operator[SEP] identifier[buffout] operator[=] Keyword[new] identifier[FSTOutputStream] operator[SEP] Other[1000] , identifier[outstream] operator[SEP] operator[SEP] Keyword[else] identifier[buffout] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[outstream] operator[==] Other[null] operator[SEP] identifier[buffout] operator[SEP] identifier[setOutstream] operator[SEP] identifier[buffout] operator[SEP] operator[SEP] Keyword[else] identifier[buffout] operator[SEP] identifier[setOutstream] operator[SEP] identifier[outstream] operator[SEP] operator[SEP]
}
|
public void addPatientParticipantObject(String patientId, byte[] messageId, IHETransactionEventTypeCodes transaction)
{
List<TypeValuePairType> tvp = new LinkedList<>();
if (messageId != null) {
if (transaction.getCode().equalsIgnoreCase("ITI-44")) {
// v3 message
tvp.add(getTypeValuePair("II", messageId));
}
else {
// v2 message
tvp.add(getTypeValuePair("MSH-10", messageId));
}
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(),
null,
null,
tvp,
patientId,
RFC3881ParticipantObjectTypeCodes.PERSON,
RFC3881ParticipantObjectTypeRoleCodes.PATIENT,
null,
null);
} | class class_name[name] begin[{]
method[addPatientParticipantObject, return_type[void], modifier[public], parameter[patientId, messageId, transaction]] begin[{]
local_variable[type[List], tvp]
if[binary_operation[member[.messageId], !=, literal[null]]] begin[{]
if[call[transaction.getCode, parameter[]]] begin[{]
call[tvp.add, parameter[call[.getTypeValuePair, parameter[literal["II"], member[.messageId]]]]]
else begin[{]
call[tvp.add, parameter[call[.getTypeValuePair, parameter[literal["MSH-10"], member[.messageId]]]]]
end[}]
else begin[{]
None
end[}]
call[.addParticipantObjectIdentification, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RFC3881ParticipantObjectCodes, sub_type=ReferenceType(arguments=None, dimensions=None, name=RFC3881ParticipantObjectIDTypeCodes, sub_type=ReferenceType(arguments=None, dimensions=None, name=PatientNumber, sub_type=None)))), literal[null], literal[null], member[.tvp], member[.patientId], member[RFC3881ParticipantObjectTypeCodes.PERSON], member[RFC3881ParticipantObjectTypeRoleCodes.PATIENT], literal[null], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addPatientParticipantObject] operator[SEP] identifier[String] identifier[patientId] , Keyword[byte] operator[SEP] operator[SEP] identifier[messageId] , identifier[IHETransactionEventTypeCodes] identifier[transaction] operator[SEP] {
identifier[List] operator[<] identifier[TypeValuePairType] operator[>] identifier[tvp] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[messageId] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[transaction] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[tvp] operator[SEP] identifier[add] operator[SEP] identifier[getTypeValuePair] operator[SEP] literal[String] , identifier[messageId] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[tvp] operator[SEP] identifier[add] operator[SEP] identifier[getTypeValuePair] operator[SEP] literal[String] , identifier[messageId] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[addParticipantObjectIdentification] operator[SEP] Keyword[new] identifier[RFC3881ParticipantObjectCodes] operator[SEP] identifier[RFC3881ParticipantObjectIDTypeCodes] operator[SEP] identifier[PatientNumber] operator[SEP] operator[SEP] , Other[null] , Other[null] , identifier[tvp] , identifier[patientId] , identifier[RFC3881ParticipantObjectTypeCodes] operator[SEP] identifier[PERSON] , identifier[RFC3881ParticipantObjectTypeRoleCodes] operator[SEP] identifier[PATIENT] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public void copy(CacheEntry cacheEntry) {
if (cacheEntry == this)
return;
if (useByteBuffer && this.value != null) {
if (this.value instanceof DistributedNioMapObject) {
((DistributedNioMapObject) this.value).release();
}
}
this.value = cacheEntry.value;
this.valueHashcode = cacheEntry.valueHashcode;
this.serializedValue = cacheEntry.serializedValue;
this.serializedId = cacheEntry.serializedId;
timeStamp = cacheEntry.timeStamp;
expirationTime = cacheEntry.expirationTime;
validatorExpirationTime = cacheEntry.validatorExpirationTime;
timeLimit = cacheEntry.timeLimit;
inactivity = cacheEntry.inactivity;
drsClock = cacheEntry.drsClock;
id = cacheEntry.id;
priority = cacheEntry.priority;
if (priority < 0)
priority = 0;
if (priority > CacheConfig.MAX_PRIORITY)
priority = CacheConfig.MAX_PRIORITY;
_templates = cacheEntry._templates;
_dataIds = cacheEntry._dataIds;
_serializedDataIds = cacheEntry._serializedDataIds;
sharingPolicy = cacheEntry.sharingPolicy;
persistToDisk = cacheEntry.persistToDisk;
refCount = new AtomicInteger(cacheEntry.refCount.get());
aliasList = cacheEntry.aliasList;
serializedAliasList = cacheEntry.serializedAliasList;
useByteBuffer = cacheEntry.useByteBuffer;
userMetaData = cacheEntry.userMetaData;
serializedUserMetaData = cacheEntry.serializedUserMetaData;
loadedFromDisk = cacheEntry.loadedFromDisk;
cacheType = cacheEntry.cacheType;
skipValueSerialized = cacheEntry.skipValueSerialized;
skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk;
skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode;
vbcSource = cacheEntry.vbcSource;
externalCacheGroupId = cacheEntry.externalCacheGroupId;
//Note: clock is not set here because it's really owned
//by the cache. Only the cache should say when the clock
//changes. It makes the cache code more readable.
} | class class_name[name] begin[{]
method[copy, return_type[void], modifier[public], parameter[cacheEntry]] begin[{]
if[binary_operation[member[.cacheEntry], ==, THIS[]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.useByteBuffer], &&, binary_operation[THIS[member[None.value]], !=, literal[null]]]] begin[{]
if[binary_operation[THIS[member[None.value]], instanceof, type[DistributedNioMapObject]]] begin[{]
Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=value, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type=ReferenceType(arguments=None, dimensions=[], name=DistributedNioMapObject, sub_type=None))
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[THIS[member[None.value]], member[cacheEntry.value]]
assign[THIS[member[None.valueHashcode]], member[cacheEntry.valueHashcode]]
assign[THIS[member[None.serializedValue]], member[cacheEntry.serializedValue]]
assign[THIS[member[None.serializedId]], member[cacheEntry.serializedId]]
assign[member[.timeStamp], member[cacheEntry.timeStamp]]
assign[member[.expirationTime], member[cacheEntry.expirationTime]]
assign[member[.validatorExpirationTime], member[cacheEntry.validatorExpirationTime]]
assign[member[.timeLimit], member[cacheEntry.timeLimit]]
assign[member[.inactivity], member[cacheEntry.inactivity]]
assign[member[.drsClock], member[cacheEntry.drsClock]]
assign[member[.id], member[cacheEntry.id]]
assign[member[.priority], member[cacheEntry.priority]]
if[binary_operation[member[.priority], <, literal[0]]] begin[{]
assign[member[.priority], literal[0]]
else begin[{]
None
end[}]
if[binary_operation[member[.priority], >, member[CacheConfig.MAX_PRIORITY]]] begin[{]
assign[member[.priority], member[CacheConfig.MAX_PRIORITY]]
else begin[{]
None
end[}]
assign[member[._templates], member[cacheEntry._templates]]
assign[member[._dataIds], member[cacheEntry._dataIds]]
assign[member[._serializedDataIds], member[cacheEntry._serializedDataIds]]
assign[member[.sharingPolicy], member[cacheEntry.sharingPolicy]]
assign[member[.persistToDisk], member[cacheEntry.persistToDisk]]
assign[member[.refCount], ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=cacheEntry.refCount, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtomicInteger, sub_type=None))]
assign[member[.aliasList], member[cacheEntry.aliasList]]
assign[member[.serializedAliasList], member[cacheEntry.serializedAliasList]]
assign[member[.useByteBuffer], member[cacheEntry.useByteBuffer]]
assign[member[.userMetaData], member[cacheEntry.userMetaData]]
assign[member[.serializedUserMetaData], member[cacheEntry.serializedUserMetaData]]
assign[member[.loadedFromDisk], member[cacheEntry.loadedFromDisk]]
assign[member[.cacheType], member[cacheEntry.cacheType]]
assign[member[.skipValueSerialized], member[cacheEntry.skipValueSerialized]]
assign[member[.skipMemoryAndWriteToDisk], member[cacheEntry.skipMemoryAndWriteToDisk]]
assign[member[.skipMemoryAndWriteToDiskErrorCode], member[cacheEntry.skipMemoryAndWriteToDiskErrorCode]]
assign[member[.vbcSource], member[cacheEntry.vbcSource]]
assign[member[.externalCacheGroupId], member[cacheEntry.externalCacheGroupId]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[copy] operator[SEP] identifier[CacheEntry] identifier[cacheEntry] operator[SEP] {
Keyword[if] operator[SEP] identifier[cacheEntry] operator[==] Keyword[this] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[useByteBuffer] operator[&&] Keyword[this] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[value] Keyword[instanceof] identifier[DistributedNioMapObject] operator[SEP] {
operator[SEP] operator[SEP] identifier[DistributedNioMapObject] operator[SEP] Keyword[this] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[value] operator[=] identifier[cacheEntry] operator[SEP] identifier[value] operator[SEP] Keyword[this] operator[SEP] identifier[valueHashcode] operator[=] identifier[cacheEntry] operator[SEP] identifier[valueHashcode] operator[SEP] Keyword[this] operator[SEP] identifier[serializedValue] operator[=] identifier[cacheEntry] operator[SEP] identifier[serializedValue] operator[SEP] Keyword[this] operator[SEP] identifier[serializedId] operator[=] identifier[cacheEntry] operator[SEP] identifier[serializedId] operator[SEP] identifier[timeStamp] operator[=] identifier[cacheEntry] operator[SEP] identifier[timeStamp] operator[SEP] identifier[expirationTime] operator[=] identifier[cacheEntry] operator[SEP] identifier[expirationTime] operator[SEP] identifier[validatorExpirationTime] operator[=] identifier[cacheEntry] operator[SEP] identifier[validatorExpirationTime] operator[SEP] identifier[timeLimit] operator[=] identifier[cacheEntry] operator[SEP] identifier[timeLimit] operator[SEP] identifier[inactivity] operator[=] identifier[cacheEntry] operator[SEP] identifier[inactivity] operator[SEP] identifier[drsClock] operator[=] identifier[cacheEntry] operator[SEP] identifier[drsClock] operator[SEP] identifier[id] operator[=] identifier[cacheEntry] operator[SEP] identifier[id] operator[SEP] identifier[priority] operator[=] identifier[cacheEntry] operator[SEP] identifier[priority] operator[SEP] Keyword[if] operator[SEP] identifier[priority] operator[<] Other[0] operator[SEP] identifier[priority] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[priority] operator[>] identifier[CacheConfig] operator[SEP] identifier[MAX_PRIORITY] operator[SEP] identifier[priority] operator[=] identifier[CacheConfig] operator[SEP] identifier[MAX_PRIORITY] operator[SEP] identifier[_templates] operator[=] identifier[cacheEntry] operator[SEP] identifier[_templates] operator[SEP] identifier[_dataIds] operator[=] identifier[cacheEntry] operator[SEP] identifier[_dataIds] operator[SEP] identifier[_serializedDataIds] operator[=] identifier[cacheEntry] operator[SEP] identifier[_serializedDataIds] operator[SEP] identifier[sharingPolicy] operator[=] identifier[cacheEntry] operator[SEP] identifier[sharingPolicy] operator[SEP] identifier[persistToDisk] operator[=] identifier[cacheEntry] operator[SEP] identifier[persistToDisk] operator[SEP] identifier[refCount] operator[=] Keyword[new] identifier[AtomicInteger] operator[SEP] identifier[cacheEntry] operator[SEP] identifier[refCount] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[aliasList] operator[=] identifier[cacheEntry] operator[SEP] identifier[aliasList] operator[SEP] identifier[serializedAliasList] operator[=] identifier[cacheEntry] operator[SEP] identifier[serializedAliasList] operator[SEP] identifier[useByteBuffer] operator[=] identifier[cacheEntry] operator[SEP] identifier[useByteBuffer] operator[SEP] identifier[userMetaData] operator[=] identifier[cacheEntry] operator[SEP] identifier[userMetaData] operator[SEP] identifier[serializedUserMetaData] operator[=] identifier[cacheEntry] operator[SEP] identifier[serializedUserMetaData] operator[SEP] identifier[loadedFromDisk] operator[=] identifier[cacheEntry] operator[SEP] identifier[loadedFromDisk] operator[SEP] identifier[cacheType] operator[=] identifier[cacheEntry] operator[SEP] identifier[cacheType] operator[SEP] identifier[skipValueSerialized] operator[=] identifier[cacheEntry] operator[SEP] identifier[skipValueSerialized] operator[SEP] identifier[skipMemoryAndWriteToDisk] operator[=] identifier[cacheEntry] operator[SEP] identifier[skipMemoryAndWriteToDisk] operator[SEP] identifier[skipMemoryAndWriteToDiskErrorCode] operator[=] identifier[cacheEntry] operator[SEP] identifier[skipMemoryAndWriteToDiskErrorCode] operator[SEP] identifier[vbcSource] operator[=] identifier[cacheEntry] operator[SEP] identifier[vbcSource] operator[SEP] identifier[externalCacheGroupId] operator[=] identifier[cacheEntry] operator[SEP] identifier[externalCacheGroupId] operator[SEP]
}
|
public void free()
{
if (m_recordOwnerCollection != null)
m_recordOwnerCollection.free();
m_recordOwnerCollection = null;
if (m_messageFilterList != null)
m_messageFilterList.free();
m_messageFilterList = null;
// Close all records associated with this SessionObject
if (m_vRecordList != null)
m_vRecordList.free(this); // Free the records that belong to me
m_vRecordList = null;
if (m_databaseCollection != null)
m_databaseCollection.free();
m_databaseCollection = null;
// try {
// UnicastRemoteObject.unexportObject(this, false); // I'm no longer available for remote calls (RMI, not EJB)
// } catch (NoSuchObjectException ex) {
// ex.printStackTrace();
// }
if (m_sessionObjectParent != null)
m_sessionObjectParent.removeRecordOwner(this);
m_sessionObjectParent = null;
} | class class_name[name] begin[{]
method[free, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_recordOwnerCollection], !=, literal[null]]] begin[{]
call[m_recordOwnerCollection.free, parameter[]]
else begin[{]
None
end[}]
assign[member[.m_recordOwnerCollection], literal[null]]
if[binary_operation[member[.m_messageFilterList], !=, literal[null]]] begin[{]
call[m_messageFilterList.free, parameter[]]
else begin[{]
None
end[}]
assign[member[.m_messageFilterList], literal[null]]
if[binary_operation[member[.m_vRecordList], !=, literal[null]]] begin[{]
call[m_vRecordList.free, parameter[THIS[]]]
else begin[{]
None
end[}]
assign[member[.m_vRecordList], literal[null]]
if[binary_operation[member[.m_databaseCollection], !=, literal[null]]] begin[{]
call[m_databaseCollection.free, parameter[]]
else begin[{]
None
end[}]
assign[member[.m_databaseCollection], literal[null]]
if[binary_operation[member[.m_sessionObjectParent], !=, literal[null]]] begin[{]
call[m_sessionObjectParent.removeRecordOwner, parameter[THIS[]]]
else begin[{]
None
end[}]
assign[member[.m_sessionObjectParent], literal[null]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[free] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_recordOwnerCollection] operator[!=] Other[null] operator[SEP] identifier[m_recordOwnerCollection] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] identifier[m_recordOwnerCollection] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[m_messageFilterList] operator[!=] Other[null] operator[SEP] identifier[m_messageFilterList] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] identifier[m_messageFilterList] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[m_vRecordList] operator[!=] Other[null] operator[SEP] identifier[m_vRecordList] operator[SEP] identifier[free] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[m_vRecordList] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[m_databaseCollection] operator[!=] Other[null] operator[SEP] identifier[m_databaseCollection] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] identifier[m_databaseCollection] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[m_sessionObjectParent] operator[!=] Other[null] operator[SEP] identifier[m_sessionObjectParent] operator[SEP] identifier[removeRecordOwner] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[m_sessionObjectParent] operator[=] Other[null] operator[SEP]
}
|
@Override
public void doSerialize( JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params ) {
getSerializer( writer, value, ctx ).serializeInternally( writer, value, ctx, params, defaultIdentityInfo, defaultTypeInfo );
} | class class_name[name] begin[{]
method[doSerialize, return_type[void], modifier[public], parameter[writer, value, ctx, params]] begin[{]
call[.getSerializer, parameter[member[.writer], member[.value], member[.ctx]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doSerialize] operator[SEP] identifier[JsonWriter] identifier[writer] , identifier[T] identifier[value] , identifier[JsonSerializationContext] identifier[ctx] , identifier[JsonSerializerParameters] identifier[params] operator[SEP] {
identifier[getSerializer] operator[SEP] identifier[writer] , identifier[value] , identifier[ctx] operator[SEP] operator[SEP] identifier[serializeInternally] operator[SEP] identifier[writer] , identifier[value] , identifier[ctx] , identifier[params] , identifier[defaultIdentityInfo] , identifier[defaultTypeInfo] operator[SEP] operator[SEP]
}
|
public static int encodeSequence(int contentLength, ByteBuffer buf) {
int headerLength = DerUtils.encodeIdAndLength(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED,
ASN1_SEQUENCE_TAG_NUM, contentLength, buf);
return headerLength + contentLength;
} | class class_name[name] begin[{]
method[encodeSequence, return_type[type[int]], modifier[public static], parameter[contentLength, buf]] begin[{]
local_variable[type[int], headerLength]
return[binary_operation[member[.headerLength], +, member[.contentLength]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[encodeSequence] operator[SEP] Keyword[int] identifier[contentLength] , identifier[ByteBuffer] identifier[buf] operator[SEP] {
Keyword[int] identifier[headerLength] operator[=] identifier[DerUtils] operator[SEP] identifier[encodeIdAndLength] operator[SEP] identifier[DerId] operator[SEP] identifier[TagClass] operator[SEP] identifier[UNIVERSAL] , identifier[DerId] operator[SEP] identifier[EncodingType] operator[SEP] identifier[CONSTRUCTED] , identifier[ASN1_SEQUENCE_TAG_NUM] , identifier[contentLength] , identifier[buf] operator[SEP] operator[SEP] Keyword[return] identifier[headerLength] operator[+] identifier[contentLength] operator[SEP]
}
|
public Observable<Page<DataLakeStoreAccountInfoInner>> listDataLakeStoreAccountsAsync(final String resourceGroupName, final String accountName) {
return listDataLakeStoreAccountsWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Page<DataLakeStoreAccountInfoInner>>() {
@Override
public Page<DataLakeStoreAccountInfoInner> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listDataLakeStoreAccountsAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, accountName]] begin[{]
return[call[.listDataLakeStoreAccountsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[DataLakeStoreAccountInfoInner] operator[>] operator[>] identifier[listDataLakeStoreAccountsAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[accountName] operator[SEP] {
Keyword[return] identifier[listDataLakeStoreAccountsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[DataLakeStoreAccountInfoInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[DataLakeStoreAccountInfoInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[DataLakeStoreAccountInfoInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[DataLakeStoreAccountInfoInner] 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 DateTimeFormatter ofLocalizedDateTime(FormatStyle dateStyle, FormatStyle timeStyle) {
Objects.requireNonNull(dateStyle, "dateStyle");
Objects.requireNonNull(timeStyle, "timeStyle");
return new DateTimeFormatterBuilder().appendLocalized(dateStyle, timeStyle)
.toFormatter(ResolverStyle.SMART, IsoChronology.INSTANCE);
} | class class_name[name] begin[{]
method[ofLocalizedDateTime, return_type[type[DateTimeFormatter]], modifier[public static], parameter[dateStyle, timeStyle]] begin[{]
call[Objects.requireNonNull, parameter[member[.dateStyle], literal["dateStyle"]]]
call[Objects.requireNonNull, parameter[member[.timeStyle], literal["timeStyle"]]]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=dateStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendLocalized, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=SMART, postfix_operators=[], prefix_operators=[], qualifier=ResolverStyle, selectors=[]), MemberReference(member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=IsoChronology, selectors=[])], member=toFormatter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeFormatterBuilder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DateTimeFormatter] identifier[ofLocalizedDateTime] operator[SEP] identifier[FormatStyle] identifier[dateStyle] , identifier[FormatStyle] identifier[timeStyle] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[dateStyle] , literal[String] operator[SEP] operator[SEP] identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[timeStyle] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DateTimeFormatterBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[appendLocalized] operator[SEP] identifier[dateStyle] , identifier[timeStyle] operator[SEP] operator[SEP] identifier[toFormatter] operator[SEP] identifier[ResolverStyle] operator[SEP] identifier[SMART] , identifier[IsoChronology] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP]
}
|
public void setEc2InstanceIds(java.util.Collection<String> ec2InstanceIds) {
if (ec2InstanceIds == null) {
this.ec2InstanceIds = null;
return;
}
this.ec2InstanceIds = new com.amazonaws.internal.SdkInternalList<String>(ec2InstanceIds);
} | class class_name[name] begin[{]
method[setEc2InstanceIds, return_type[void], modifier[public], parameter[ec2InstanceIds]] begin[{]
if[binary_operation[member[.ec2InstanceIds], ==, literal[null]]] begin[{]
assign[THIS[member[None.ec2InstanceIds]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.ec2InstanceIds]], ClassCreator(arguments=[MemberReference(member=ec2InstanceIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setEc2InstanceIds] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[ec2InstanceIds] operator[SEP] {
Keyword[if] operator[SEP] identifier[ec2InstanceIds] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[ec2InstanceIds] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[ec2InstanceIds] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[ec2InstanceIds] operator[SEP] operator[SEP]
}
|
public static <T> List<T> toSorted(Iterable<T> self, Comparator<T> comparator) {
List<T> list = toList(self);
Collections.sort(list, comparator);
return list;
} | class class_name[name] begin[{]
method[toSorted, return_type[type[List]], modifier[public static], parameter[self, comparator]] begin[{]
local_variable[type[List], list]
call[Collections.sort, parameter[member[.list], member[.comparator]]]
return[member[.list]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[toSorted] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[self] , identifier[Comparator] operator[<] identifier[T] operator[>] identifier[comparator] operator[SEP] {
identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[=] identifier[toList] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[list] , identifier[comparator] operator[SEP] operator[SEP] Keyword[return] identifier[list] operator[SEP]
}
|
void addIQResultListener(String id, IQResultListener listener,
long timeoutmillis) {
// be generated by the server and simulate like the client sent it. This
// will let listeners
// react and be removed from the collection
resultListeners.put(id, listener);
resultTimeout.put(id, System.currentTimeMillis() + timeoutmillis);
} | class class_name[name] begin[{]
method[addIQResultListener, return_type[void], modifier[default], parameter[id, listener, timeoutmillis]] begin[{]
call[resultListeners.put, parameter[member[.id], member[.listener]]]
call[resultTimeout.put, parameter[member[.id], binary_operation[call[System.currentTimeMillis, parameter[]], +, member[.timeoutmillis]]]]
end[}]
END[}] | Keyword[void] identifier[addIQResultListener] operator[SEP] identifier[String] identifier[id] , identifier[IQResultListener] identifier[listener] , Keyword[long] identifier[timeoutmillis] operator[SEP] {
identifier[resultListeners] operator[SEP] identifier[put] operator[SEP] identifier[id] , identifier[listener] operator[SEP] operator[SEP] identifier[resultTimeout] operator[SEP] identifier[put] operator[SEP] identifier[id] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[+] identifier[timeoutmillis] operator[SEP] operator[SEP]
}
|
private List<TileMatrix> getTileMatrices(BoundingBox projectedRequestBoundingBox) {
List<TileMatrix> tileMatrices = new ArrayList<>();
// Check if the request overlaps the tile matrix set
if (!tileDao.getTileMatrices().isEmpty()
&& projectedRequestBoundingBox.intersects(
tileSetBoundingBox)) {
// Get the tile distance
double distanceWidth = projectedRequestBoundingBox
.getMaxLongitude()
- projectedRequestBoundingBox.getMinLongitude();
double distanceHeight = projectedRequestBoundingBox
.getMaxLatitude()
- projectedRequestBoundingBox.getMinLatitude();
// Get the zoom level to request based upon the tile size
Long requestZoomLevel = null;
if (scaling != null) {
// When options are provided, get the approximate zoom level regardless of whether a tile level exists
requestZoomLevel = tileDao.getApproximateZoomLevel(distanceWidth, distanceHeight);
} else {
// Get the closest existing zoom level
requestZoomLevel = tileDao.getZoomLevel(distanceWidth, distanceHeight);
}
// If there is a matching zoom level
if (requestZoomLevel != null) {
List<Long> zoomLevels = null;
// If options are configured, build the possible zoom levels in order to request
if (scaling != null && scaling.getScalingType() != null) {
// Find zoom in levels
List<Long> zoomInLevels = new ArrayList<>();
if (scaling.isZoomIn()) {
long zoomIn = scaling.getZoomIn() != null ? requestZoomLevel + scaling.getZoomIn() : tileDao.getMaxZoom();
for (long zoomLevel = requestZoomLevel + 1; zoomLevel <= zoomIn; zoomLevel++) {
zoomInLevels.add(zoomLevel);
}
}
// Find zoom out levels
List<Long> zoomOutLevels = new ArrayList<>();
if (scaling.isZoomOut()) {
long zoomOut = scaling.getZoomOut() != null ? requestZoomLevel - scaling.getZoomOut() : tileDao.getMinZoom();
for (long zoomLevel = requestZoomLevel - 1; zoomLevel >= zoomOut; zoomLevel--) {
zoomOutLevels.add(zoomLevel);
}
}
if (zoomInLevels.isEmpty()) {
// Only zooming out
zoomLevels = zoomOutLevels;
} else if (zoomOutLevels.isEmpty()) {
// Only zooming in
zoomLevels = zoomInLevels;
} else {
// Determine how to order the zoom in and zoom out levels
TileScalingType type = scaling.getScalingType();
switch (type) {
case IN:
case IN_OUT:
// Order zoom in levels before zoom out levels
zoomLevels = zoomInLevels;
zoomLevels.addAll(zoomOutLevels);
break;
case OUT:
case OUT_IN:
// Order zoom out levels before zoom in levels
zoomLevels = zoomOutLevels;
zoomLevels.addAll(zoomInLevels);
break;
case CLOSEST_IN_OUT:
case CLOSEST_OUT_IN:
// Alternate the zoom in and out levels
List<Long> firstLevels;
List<Long> secondLevels;
if (type == TileScalingType.CLOSEST_IN_OUT) {
// Alternate starting with zoom in
firstLevels = zoomInLevels;
secondLevels = zoomOutLevels;
} else {
// Alternate starting with zoom out
firstLevels = zoomOutLevels;
secondLevels = zoomInLevels;
}
zoomLevels = new ArrayList<>();
int maxLevels = Math.max(firstLevels.size(), secondLevels.size());
for (int i = 0; i < maxLevels; i++) {
if (i < firstLevels.size()) {
zoomLevels.add(firstLevels.get(i));
}
if (i < secondLevels.size()) {
zoomLevels.add(secondLevels.get(i));
}
}
break;
default:
throw new GeoPackageException("Unsupported " + TileScalingType.class.getSimpleName()
+ ": " + type);
}
}
} else {
zoomLevels = new ArrayList<>();
}
// Always check the request zoom level first
zoomLevels.add(0, requestZoomLevel);
// Build a list of tile matrices that exist for the zoom levels
for (long zoomLevel : zoomLevels) {
TileMatrix tileMatrix = tileDao.getTileMatrix(zoomLevel);
if (tileMatrix != null) {
tileMatrices.add(tileMatrix);
}
}
}
}
return tileMatrices;
} | class class_name[name] begin[{]
method[getTileMatrices, return_type[type[List]], modifier[private], parameter[projectedRequestBoundingBox]] begin[{]
local_variable[type[List], tileMatrices]
if[binary_operation[call[tileDao.getTileMatrices, parameter[]], &&, call[projectedRequestBoundingBox.intersects, parameter[member[.tileSetBoundingBox]]]]] begin[{]
local_variable[type[double], distanceWidth]
local_variable[type[double], distanceHeight]
local_variable[type[Long], requestZoomLevel]
if[binary_operation[member[.scaling], !=, literal[null]]] begin[{]
assign[member[.requestZoomLevel], call[tileDao.getApproximateZoomLevel, parameter[member[.distanceWidth], member[.distanceHeight]]]]
else begin[{]
assign[member[.requestZoomLevel], call[tileDao.getZoomLevel, parameter[member[.distanceWidth], member[.distanceHeight]]]]
end[}]
if[binary_operation[member[.requestZoomLevel], !=, literal[null]]] begin[{]
local_variable[type[List], zoomLevels]
if[binary_operation[binary_operation[member[.scaling], !=, literal[null]], &&, binary_operation[call[scaling.getScalingType, parameter[]], !=, literal[null]]]] begin[{]
local_variable[type[List], zoomInLevels]
if[call[scaling.isZoomIn, parameter[]]] begin[{]
local_variable[type[long], zoomIn]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=zoomInLevels, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=zoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=zoomIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=requestZoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=zoomLevel)], modifiers=set(), type=BasicType(dimensions=[], name=long)), update=[MemberReference(member=zoomLevel, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
local_variable[type[List], zoomOutLevels]
if[call[scaling.isZoomOut, parameter[]]] begin[{]
local_variable[type[long], zoomOut]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=zoomOutLevels, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=zoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=zoomOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=requestZoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=zoomLevel)], modifiers=set(), type=BasicType(dimensions=[], name=long)), update=[MemberReference(member=zoomLevel, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
if[call[zoomInLevels.isEmpty, parameter[]]] begin[{]
assign[member[.zoomLevels], member[.zoomOutLevels]]
else begin[{]
if[call[zoomOutLevels.isEmpty, parameter[]]] begin[{]
assign[member[.zoomLevels], member[.zoomInLevels]]
else begin[{]
local_variable[type[TileScalingType], type]
SwitchStatement(cases=[SwitchStatementCase(case=['IN', 'IN_OUT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=zoomLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomInLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zoomOutLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=zoomLevels, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OUT', 'OUT_IN'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=zoomLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomOutLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zoomInLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=zoomLevels, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CLOSEST_IN_OUT', 'CLOSEST_OUT_IN'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=firstLevels)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=secondLevels)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=CLOSEST_IN_OUT, postfix_operators=[], prefix_operators=[], qualifier=TileScalingType, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=firstLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomOutLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=secondLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomInLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=firstLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomInLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=secondLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=zoomOutLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=zoomLevels, 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=[], dimensions=None, name=ArrayList, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=firstLevels, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=secondLevels, selectors=[], type_arguments=None)], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=maxLevels)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=firstLevels, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=firstLevels, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=zoomLevels, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=secondLevels, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=secondLevels, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=zoomLevels, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported "), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=TileScalingType, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MemberReference(member=type, 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=GeoPackageException, sub_type=None)), label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
end[}]
else begin[{]
assign[member[.zoomLevels], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
call[zoomLevels.add, parameter[literal[0], member[.requestZoomLevel]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=zoomLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTileMatrix, postfix_operators=[], prefix_operators=[], qualifier=tileDao, selectors=[], type_arguments=None), name=tileMatrix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TileMatrix, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tileMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tileMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=tileMatrices, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=zoomLevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=zoomLevel)], modifiers=set(), type=BasicType(dimensions=[], name=long))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.tileMatrices]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[TileMatrix] operator[>] identifier[getTileMatrices] operator[SEP] identifier[BoundingBox] identifier[projectedRequestBoundingBox] operator[SEP] {
identifier[List] operator[<] identifier[TileMatrix] operator[>] identifier[tileMatrices] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[tileDao] operator[SEP] identifier[getTileMatrices] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[projectedRequestBoundingBox] operator[SEP] identifier[intersects] operator[SEP] identifier[tileSetBoundingBox] operator[SEP] operator[SEP] {
Keyword[double] identifier[distanceWidth] operator[=] identifier[projectedRequestBoundingBox] operator[SEP] identifier[getMaxLongitude] operator[SEP] operator[SEP] operator[-] identifier[projectedRequestBoundingBox] operator[SEP] identifier[getMinLongitude] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[distanceHeight] operator[=] identifier[projectedRequestBoundingBox] operator[SEP] identifier[getMaxLatitude] operator[SEP] operator[SEP] operator[-] identifier[projectedRequestBoundingBox] operator[SEP] identifier[getMinLatitude] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[requestZoomLevel] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[scaling] operator[!=] Other[null] operator[SEP] {
identifier[requestZoomLevel] operator[=] identifier[tileDao] operator[SEP] identifier[getApproximateZoomLevel] operator[SEP] identifier[distanceWidth] , identifier[distanceHeight] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[requestZoomLevel] operator[=] identifier[tileDao] operator[SEP] identifier[getZoomLevel] operator[SEP] identifier[distanceWidth] , identifier[distanceHeight] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[requestZoomLevel] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[Long] operator[>] identifier[zoomLevels] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[scaling] operator[!=] Other[null] operator[&&] identifier[scaling] operator[SEP] identifier[getScalingType] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[Long] operator[>] identifier[zoomInLevels] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scaling] operator[SEP] identifier[isZoomIn] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[zoomIn] operator[=] identifier[scaling] operator[SEP] identifier[getZoomIn] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[requestZoomLevel] operator[+] identifier[scaling] operator[SEP] identifier[getZoomIn] operator[SEP] operator[SEP] operator[:] identifier[tileDao] operator[SEP] identifier[getMaxZoom] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[zoomLevel] operator[=] identifier[requestZoomLevel] operator[+] Other[1] operator[SEP] identifier[zoomLevel] operator[<=] identifier[zoomIn] operator[SEP] identifier[zoomLevel] operator[++] operator[SEP] {
identifier[zoomInLevels] operator[SEP] identifier[add] operator[SEP] identifier[zoomLevel] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[Long] operator[>] identifier[zoomOutLevels] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scaling] operator[SEP] identifier[isZoomOut] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[zoomOut] operator[=] identifier[scaling] operator[SEP] identifier[getZoomOut] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[requestZoomLevel] operator[-] identifier[scaling] operator[SEP] identifier[getZoomOut] operator[SEP] operator[SEP] operator[:] identifier[tileDao] operator[SEP] identifier[getMinZoom] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[zoomLevel] operator[=] identifier[requestZoomLevel] operator[-] Other[1] operator[SEP] identifier[zoomLevel] operator[>=] identifier[zoomOut] operator[SEP] identifier[zoomLevel] operator[--] operator[SEP] {
identifier[zoomOutLevels] operator[SEP] identifier[add] operator[SEP] identifier[zoomLevel] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[zoomInLevels] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[zoomLevels] operator[=] identifier[zoomOutLevels] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[zoomOutLevels] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[zoomLevels] operator[=] identifier[zoomInLevels] operator[SEP]
}
Keyword[else] {
identifier[TileScalingType] identifier[type] operator[=] identifier[scaling] operator[SEP] identifier[getScalingType] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[IN] operator[:] Keyword[case] identifier[IN_OUT] operator[:] identifier[zoomLevels] operator[=] identifier[zoomInLevels] operator[SEP] identifier[zoomLevels] operator[SEP] identifier[addAll] operator[SEP] identifier[zoomOutLevels] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OUT] operator[:] Keyword[case] identifier[OUT_IN] operator[:] identifier[zoomLevels] operator[=] identifier[zoomOutLevels] operator[SEP] identifier[zoomLevels] operator[SEP] identifier[addAll] operator[SEP] identifier[zoomInLevels] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CLOSEST_IN_OUT] operator[:] Keyword[case] identifier[CLOSEST_OUT_IN] operator[:] identifier[List] operator[<] identifier[Long] operator[>] identifier[firstLevels] operator[SEP] identifier[List] operator[<] identifier[Long] operator[>] identifier[secondLevels] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[TileScalingType] operator[SEP] identifier[CLOSEST_IN_OUT] operator[SEP] {
identifier[firstLevels] operator[=] identifier[zoomInLevels] operator[SEP] identifier[secondLevels] operator[=] identifier[zoomOutLevels] operator[SEP]
}
Keyword[else] {
identifier[firstLevels] operator[=] identifier[zoomOutLevels] operator[SEP] identifier[secondLevels] operator[=] identifier[zoomInLevels] operator[SEP]
}
identifier[zoomLevels] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[maxLevels] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[firstLevels] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[secondLevels] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[maxLevels] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[<] identifier[firstLevels] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[zoomLevels] operator[SEP] identifier[add] operator[SEP] identifier[firstLevels] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[<] identifier[secondLevels] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[zoomLevels] operator[SEP] identifier[add] operator[SEP] identifier[secondLevels] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[TileScalingType] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[type] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[zoomLevels] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[zoomLevels] operator[SEP] identifier[add] operator[SEP] Other[0] , identifier[requestZoomLevel] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[zoomLevel] operator[:] identifier[zoomLevels] operator[SEP] {
identifier[TileMatrix] identifier[tileMatrix] operator[=] identifier[tileDao] operator[SEP] identifier[getTileMatrix] operator[SEP] identifier[zoomLevel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tileMatrix] operator[!=] Other[null] operator[SEP] {
identifier[tileMatrices] operator[SEP] identifier[add] operator[SEP] identifier[tileMatrix] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] identifier[tileMatrices] operator[SEP]
}
|
public static String urlToString(URL url) {
return Checker.isNull(url) ? "" : url.toString().replaceAll("file:" + (Checker.isWindows() ? "/?" : ""), "");
} | class class_name[name] begin[{]
method[urlToString, return_type[type[String]], modifier[public static], parameter[url]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNull, postfix_operators=[], prefix_operators=[], qualifier=Checker, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file:"), operandr=TernaryExpression(condition=MethodInvocation(arguments=[], member=isWindows, postfix_operators=[], prefix_operators=[], qualifier=Checker, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/?")), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replaceAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[urlToString] operator[SEP] identifier[URL] identifier[url] operator[SEP] {
Keyword[return] identifier[Checker] operator[SEP] identifier[isNull] operator[SEP] identifier[url] operator[SEP] operator[?] literal[String] operator[:] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[+] operator[SEP] identifier[Checker] operator[SEP] identifier[isWindows] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
|
public PagedList<StorageAccountInformationInner> listByAccount(final String resourceGroupName, final String accountName) {
ServiceResponse<Page<StorageAccountInformationInner>> response = listByAccountSinglePageAsync(resourceGroupName, accountName).toBlocking().single();
return new PagedList<StorageAccountInformationInner>(response.body()) {
@Override
public Page<StorageAccountInformationInner> nextPage(String nextPageLink) {
return listByAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
} | class class_name[name] begin[{]
method[listByAccount, return_type[type[PagedList]], modifier[public], parameter[resourceGroupName, accountName]] begin[{]
local_variable[type[ServiceResponse], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listByAccountNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toBlocking, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=single, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextPage, parameters=[FormalParameter(annotations=[], modifiers=set(), name=nextPageLink, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StorageAccountInformationInner, sub_type=None))], dimensions=[], name=Page, 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=StorageAccountInformationInner, sub_type=None))], dimensions=None, name=PagedList, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[PagedList] operator[<] identifier[StorageAccountInformationInner] operator[>] identifier[listByAccount] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[accountName] operator[SEP] {
identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[StorageAccountInformationInner] operator[>] operator[>] identifier[response] operator[=] identifier[listByAccountSinglePageAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PagedList] operator[<] identifier[StorageAccountInformationInner] operator[>] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[StorageAccountInformationInner] operator[>] identifier[nextPage] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listByAccountNextSinglePageAsync] operator[SEP] identifier[nextPageLink] 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]
}
} operator[SEP]
}
|
public void updateDefinition(long srsId, String definition) {
connection.execSQL("UPDATE " + SpatialReferenceSystem.TABLE_NAME
+ " SET " + COLUMN_NAME + " = '" + definition + "' WHERE "
+ SpatialReferenceSystem.COLUMN_SRS_ID + " = " + srsId);
} | class class_name[name] begin[{]
method[updateDefinition, return_type[void], modifier[public], parameter[srsId, definition]] begin[{]
call[connection.execSQL, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["UPDATE "], +, member[SpatialReferenceSystem.TABLE_NAME]], +, literal[" SET "]], +, member[.COLUMN_NAME]], +, literal[" = '"]], +, member[.definition]], +, literal["' WHERE "]], +, member[SpatialReferenceSystem.COLUMN_SRS_ID]], +, literal[" = "]], +, member[.srsId]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateDefinition] operator[SEP] Keyword[long] identifier[srsId] , identifier[String] identifier[definition] operator[SEP] {
identifier[connection] operator[SEP] identifier[execSQL] operator[SEP] literal[String] operator[+] identifier[SpatialReferenceSystem] operator[SEP] identifier[TABLE_NAME] operator[+] literal[String] operator[+] identifier[COLUMN_NAME] operator[+] literal[String] operator[+] identifier[definition] operator[+] literal[String] operator[+] identifier[SpatialReferenceSystem] operator[SEP] identifier[COLUMN_SRS_ID] operator[+] literal[String] operator[+] identifier[srsId] operator[SEP] operator[SEP]
}
|
public void run(String[] args) {
LOG.info("Starting GA4GHPicardRunner");
try {
parseCmdLine(args);
buildPicardCommand();
startProcess();
pumpInputData();
waitForProcessEnd();
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[args]] begin[{]
call[LOG.info, parameter[literal["Starting GA4GHPicardRunner"]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseCmdLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=buildPicardCommand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=startProcess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=pumpInputData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=waitForProcessEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), 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=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[run] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[parseCmdLine] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[buildPicardCommand] operator[SEP] operator[SEP] operator[SEP] identifier[startProcess] operator[SEP] operator[SEP] operator[SEP] identifier[pumpInputData] operator[SEP] operator[SEP] operator[SEP] identifier[waitForProcessEnd] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public RuleConditionElement build(final RuleBuildContext context,
final BaseDescr descr,
final Pattern prefixPattern) {
boolean typesafe = context.isTypesafe();
// it must be an EvalDescr
final EvalDescr evalDescr = (EvalDescr) descr;
try {
MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
Map<String, Declaration> decls = context.getDeclarationResolver().getDeclarations(context.getRule());
AnalysisResult analysis = context.getDialect().analyzeExpression( context,
evalDescr,
evalDescr.getContent(),
new BoundIdentifiers( DeclarationScopeResolver.getDeclarationClasses( decls ),
context ) );
final BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();
int i = usedIdentifiers.getDeclrClasses().keySet().size();
Declaration[] previousDeclarations = new Declaration[i];
i = 0;
for ( String id : usedIdentifiers.getDeclrClasses().keySet() ) {
previousDeclarations[i++] = decls.get( id );
}
Arrays.sort( previousDeclarations, SortDeclarations.instance );
MVELCompilationUnit unit = dialect.getMVELCompilationUnit( (String) evalDescr.getContent(),
analysis,
previousDeclarations,
null,
null,
context,
"drools",
KnowledgeHelper.class,
false,
MVELCompilationUnit.Scope.EXPRESSION );
final EvalCondition eval = new EvalCondition( previousDeclarations );
MVELEvalExpression expr = new MVELEvalExpression( unit,
dialect.getId() );
eval.setEvalExpression( KiePolicyHelper.isPolicyEnabled() ? new SafeEvalExpression(expr) : expr );
MVELDialectRuntimeData data = (MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
data.addCompileable( eval,
expr );
expr.compile( data, context.getRule() );
return eval;
} catch ( final Exception e ) {
copyErrorLocation(e, evalDescr);
context.addError( new DescrBuildError( context.getParentDescr(),
evalDescr,
e,
"Unable to build expression for 'eval':" + e.getMessage() + " '" + evalDescr.getContent() + "'" ) );
return null;
} finally {
context.setTypesafe( typesafe );
}
} | class class_name[name] begin[{]
method[build, return_type[type[RuleConditionElement]], modifier[public], parameter[context, descr, prefixPattern]] begin[{]
local_variable[type[boolean], typesafe]
local_variable[type[EvalDescr], evalDescr]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mvel")], member=getDialect, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MVELDialect, sub_type=None)), name=dialect)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MVELDialect, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDeclarationResolver, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRule, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None)], member=getDeclarations, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=decls)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Declaration, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDialect, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=evalDescr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=evalDescr, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=decls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclarationClasses, postfix_operators=[], prefix_operators=[], qualifier=DeclarationScopeResolver, selectors=[], type_arguments=None), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BoundIdentifiers, sub_type=None))], member=analyzeExpression, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=analysis)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnalysisResult, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBoundIdentifiers, postfix_operators=[], prefix_operators=[], qualifier=analysis, selectors=[], type_arguments=None), name=usedIdentifiers)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BoundIdentifiers, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDeclrClasses, postfix_operators=[], prefix_operators=[], qualifier=usedIdentifiers, selectors=[MethodInvocation(arguments=[], member=keySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Declaration, sub_type=None)), name=previousDeclarations)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Declaration, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=previousDeclarations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=decls, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclrClasses, postfix_operators=[], prefix_operators=[], qualifier=usedIdentifiers, 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=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=previousDeclarations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=SortDeclarations, selectors=[])], member=sort, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=evalDescr, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), MemberReference(member=analysis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previousDeclarations, 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), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="drools"), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KnowledgeHelper, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=EXPRESSION, postfix_operators=[], prefix_operators=[], qualifier=MVELCompilationUnit.Scope, selectors=[])], member=getMVELCompilationUnit, postfix_operators=[], prefix_operators=[], qualifier=dialect, selectors=[], type_arguments=None), name=unit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MVELCompilationUnit, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=previousDeclarations, 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=EvalCondition, sub_type=None)), name=eval)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=EvalCondition, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=dialect, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MVELEvalExpression, sub_type=None)), name=expr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MVELEvalExpression, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[TernaryExpression(condition=MethodInvocation(arguments=[], member=isPolicyEnabled, postfix_operators=[], prefix_operators=[], qualifier=KiePolicyHelper, selectors=[], type_arguments=None), if_false=MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=ClassCreator(arguments=[MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SafeEvalExpression, sub_type=None)))], member=setEvalExpression, postfix_operators=[], prefix_operators=[], qualifier=eval, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getPkg, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[], member=getDialectRuntimeRegistry, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mvel")], member=getDialectData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MVELDialectRuntimeData, sub_type=None)), name=data)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MVELDialectRuntimeData, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=eval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCompileable, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRule, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None)], member=compile, postfix_operators=[], prefix_operators=[], qualifier=expr, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=eval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=evalDescr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyErrorLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getParentDescr, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), MemberReference(member=evalDescr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to build expression for 'eval':"), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" '"), operator=+), operandr=MethodInvocation(arguments=[], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=evalDescr, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DescrBuildError, sub_type=None))], member=addError, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=typesafe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTypesafe, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[RuleConditionElement] identifier[build] operator[SEP] Keyword[final] identifier[RuleBuildContext] identifier[context] , Keyword[final] identifier[BaseDescr] identifier[descr] , Keyword[final] identifier[Pattern] identifier[prefixPattern] operator[SEP] {
Keyword[boolean] identifier[typesafe] operator[=] identifier[context] operator[SEP] identifier[isTypesafe] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[EvalDescr] identifier[evalDescr] operator[=] operator[SEP] identifier[EvalDescr] operator[SEP] identifier[descr] operator[SEP] Keyword[try] {
identifier[MVELDialect] identifier[dialect] operator[=] operator[SEP] identifier[MVELDialect] operator[SEP] identifier[context] operator[SEP] identifier[getDialect] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Declaration] operator[>] identifier[decls] operator[=] identifier[context] operator[SEP] identifier[getDeclarationResolver] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclarations] operator[SEP] identifier[context] operator[SEP] identifier[getRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[AnalysisResult] identifier[analysis] operator[=] identifier[context] operator[SEP] identifier[getDialect] operator[SEP] operator[SEP] operator[SEP] identifier[analyzeExpression] operator[SEP] identifier[context] , identifier[evalDescr] , identifier[evalDescr] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] , Keyword[new] identifier[BoundIdentifiers] operator[SEP] identifier[DeclarationScopeResolver] operator[SEP] identifier[getDeclarationClasses] operator[SEP] identifier[decls] operator[SEP] , identifier[context] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[BoundIdentifiers] identifier[usedIdentifiers] operator[=] identifier[analysis] operator[SEP] identifier[getBoundIdentifiers] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[usedIdentifiers] operator[SEP] identifier[getDeclrClasses] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[Declaration] operator[SEP] operator[SEP] identifier[previousDeclarations] operator[=] Keyword[new] identifier[Declaration] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[id] operator[:] identifier[usedIdentifiers] operator[SEP] identifier[getDeclrClasses] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[previousDeclarations] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[decls] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[previousDeclarations] , identifier[SortDeclarations] operator[SEP] identifier[instance] operator[SEP] operator[SEP] identifier[MVELCompilationUnit] identifier[unit] operator[=] identifier[dialect] operator[SEP] identifier[getMVELCompilationUnit] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[evalDescr] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] , identifier[analysis] , identifier[previousDeclarations] , Other[null] , Other[null] , identifier[context] , literal[String] , identifier[KnowledgeHelper] operator[SEP] Keyword[class] , literal[boolean] , identifier[MVELCompilationUnit] operator[SEP] identifier[Scope] operator[SEP] identifier[EXPRESSION] operator[SEP] operator[SEP] Keyword[final] identifier[EvalCondition] identifier[eval] operator[=] Keyword[new] identifier[EvalCondition] operator[SEP] identifier[previousDeclarations] operator[SEP] operator[SEP] identifier[MVELEvalExpression] identifier[expr] operator[=] Keyword[new] identifier[MVELEvalExpression] operator[SEP] identifier[unit] , identifier[dialect] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[eval] operator[SEP] identifier[setEvalExpression] operator[SEP] identifier[KiePolicyHelper] operator[SEP] identifier[isPolicyEnabled] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[SafeEvalExpression] operator[SEP] identifier[expr] operator[SEP] operator[:] identifier[expr] operator[SEP] operator[SEP] identifier[MVELDialectRuntimeData] identifier[data] operator[=] operator[SEP] identifier[MVELDialectRuntimeData] operator[SEP] identifier[context] operator[SEP] identifier[getPkg] operator[SEP] operator[SEP] operator[SEP] identifier[getDialectRuntimeRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[getDialectData] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[addCompileable] operator[SEP] identifier[eval] , identifier[expr] operator[SEP] operator[SEP] identifier[expr] operator[SEP] identifier[compile] operator[SEP] identifier[data] , identifier[context] operator[SEP] identifier[getRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[eval] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[copyErrorLocation] operator[SEP] identifier[e] , identifier[evalDescr] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[addError] operator[SEP] Keyword[new] identifier[DescrBuildError] operator[SEP] identifier[context] operator[SEP] identifier[getParentDescr] operator[SEP] operator[SEP] , identifier[evalDescr] , identifier[e] , literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[evalDescr] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[finally] {
identifier[context] operator[SEP] identifier[setTypesafe] operator[SEP] identifier[typesafe] operator[SEP] operator[SEP]
}
}
|
public void removeChannel(
T channel,
String functionalityName,
String requesterID,
String conversationID)
{
synchronized (this.channelsWithId)
{
this.channelsWithId.remove(calculateId(functionalityName, requesterID, conversationID));
}
synchronized (this.channelsWithFunctionalityName)
{
this.channelsWithFunctionalityName.get(functionalityName).remove(channel);
}
} | class class_name[name] begin[{]
method[removeChannel, return_type[void], modifier[public], parameter[channel, functionalityName, requesterID, conversationID]] begin[{]
SYNCHRONIZED[THIS[member[None.channelsWithId]]] BEGIN[{]
THIS[member[None.channelsWithId]call[None.remove, parameter[call[.calculateId, parameter[member[.functionalityName], member[.requesterID], member[.conversationID]]]]]]
END[}]
SYNCHRONIZED[THIS[member[None.channelsWithFunctionalityName]]] BEGIN[{]
THIS[member[None.channelsWithFunctionalityName]call[None.get, parameter[member[.functionalityName]]]call[None.remove, parameter[member[.channel]]]]
END[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeChannel] operator[SEP] identifier[T] identifier[channel] , identifier[String] identifier[functionalityName] , identifier[String] identifier[requesterID] , identifier[String] identifier[conversationID] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[channelsWithId] operator[SEP] {
Keyword[this] operator[SEP] identifier[channelsWithId] operator[SEP] identifier[remove] operator[SEP] identifier[calculateId] operator[SEP] identifier[functionalityName] , identifier[requesterID] , identifier[conversationID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[channelsWithFunctionalityName] operator[SEP] {
Keyword[this] operator[SEP] identifier[channelsWithFunctionalityName] operator[SEP] identifier[get] operator[SEP] identifier[functionalityName] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[channel] operator[SEP] operator[SEP]
}
}
|
public void delete(String url, Object... urlVariables) throws RestClientException {
execute(url, HttpMethod.DELETE, null, null, urlVariables);
} | class class_name[name] begin[{]
method[delete, return_type[void], modifier[public], parameter[url, urlVariables]] begin[{]
call[.execute, parameter[member[.url], member[HttpMethod.DELETE], literal[null], literal[null], member[.urlVariables]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[delete] operator[SEP] identifier[String] identifier[url] , identifier[Object] operator[...] identifier[urlVariables] operator[SEP] Keyword[throws] identifier[RestClientException] {
identifier[execute] operator[SEP] identifier[url] , identifier[HttpMethod] operator[SEP] identifier[DELETE] , Other[null] , Other[null] , identifier[urlVariables] operator[SEP] operator[SEP]
}
|
@Override
public void visitCode(Code obj) {
try {
Method m = getMethod();
if (m.isSynthetic()) {
return;
}
if (m.isStatic() || m.isPrivate() || Values.CONSTRUCTOR.equals(m.getName())) {
parmSigs = SignatureUtils.getParameterSlotAndSignatures(m.isStatic(), m.getSignature());
if (!parmSigs.isEmpty() && prescreen(m)) {
state = State.SAW_NOTHING;
bugs = new HashMap<>();
downwardBranchTarget = -1;
super.visitCode(obj);
for (BugInfo bi : bugs.values()) {
bugReporter.reportBug(bi.bug);
}
}
}
} finally {
bugs = null;
}
} | class class_name[name] begin[{]
method[visitCode, return_type[void], modifier[public], parameter[obj]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isSynthetic, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isStatic, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isPrivate, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operator=||), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Values.CONSTRUCTOR, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parmSigs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isStatic, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getSignature, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=getParameterSlotAndSignatures, postfix_operators=[], prefix_operators=[], qualifier=SignatureUtils, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=parmSigs, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prescreen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=SAW_NOTHING, postfix_operators=[], prefix_operators=[], qualifier=State, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bugs, 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=[], dimensions=None, name=HashMap, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=downwardBranchTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)), label=None), StatementExpression(expression=SuperMethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitCode, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bug, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[])], member=reportBug, postfix_operators=[], prefix_operators=[], qualifier=bugReporter, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=bugs, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bi)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BugInfo, sub_type=None))), label=None)]))]))], catches=None, finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bugs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visitCode] operator[SEP] identifier[Code] identifier[obj] operator[SEP] {
Keyword[try] {
identifier[Method] identifier[m] operator[=] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[isSynthetic] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] operator[||] identifier[m] operator[SEP] identifier[isPrivate] operator[SEP] operator[SEP] operator[||] identifier[Values] operator[SEP] identifier[CONSTRUCTOR] operator[SEP] identifier[equals] operator[SEP] identifier[m] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[parmSigs] operator[=] identifier[SignatureUtils] operator[SEP] identifier[getParameterSlotAndSignatures] operator[SEP] identifier[m] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] , identifier[m] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[parmSigs] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[prescreen] operator[SEP] identifier[m] operator[SEP] operator[SEP] {
identifier[state] operator[=] identifier[State] operator[SEP] identifier[SAW_NOTHING] operator[SEP] identifier[bugs] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[downwardBranchTarget] operator[=] operator[-] Other[1] operator[SEP] Keyword[super] operator[SEP] identifier[visitCode] operator[SEP] identifier[obj] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BugInfo] identifier[bi] operator[:] identifier[bugs] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[bugReporter] operator[SEP] identifier[reportBug] operator[SEP] identifier[bi] operator[SEP] identifier[bug] operator[SEP] operator[SEP]
}
}
}
}
Keyword[finally] {
identifier[bugs] operator[=] Other[null] operator[SEP]
}
}
|
private boolean genProxyCovariantBridgeMethod( DynamicFunctionSymbol dfs, DynamicFunctionSymbol superDfs )
{
IGosuClassInternal superType = (IGosuClassInternal)superDfs.getScriptPart().getContainingType();
if( superType.isProxy() )
{
IJavaType javaType = superType.getJavaType();
javaType = (IJavaType)TypeLord.getDefaultParameterizedType( javaType );
IType[] dfsArgTypes = dfs.getArgTypes();
IType[] defDfsArgTypes = new IType[dfsArgTypes.length];
for( int i = 0; i < dfsArgTypes.length; i++ )
{
defDfsArgTypes[i] = TypeLord.getDefaultParameterizedTypeWithTypeVars( dfsArgTypes[i] );
}
IJavaMethodInfo mi = (IJavaMethodInfo)((IRelativeTypeInfo)javaType.getTypeInfo()).getMethod( javaType, NameResolver.getFunctionName( dfs ), defDfsArgTypes );
if( mi == null )
{
// Probably a generic method; the caller will gen bridge method for this
return false;
}
IJavaClassMethod method = mi.getMethod();
IJavaClassInfo[] paramClasses = method.getParameterTypes();
for( int i = 0; i < paramClasses.length; i++ )
{
if( !AbstractElementTransformer.isBytecodeType( defDfsArgTypes[i] ) )
{
String dfsParamClass = getDescriptor( defDfsArgTypes[i] ).getName().replace( '$', '.' );
if( !dfsParamClass.equals( paramClasses[i].getName().replace( '$', '.' ) ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method );
return true;
}
}
}
if( !AbstractElementTransformer.isBytecodeType( superDfs.getReturnType() ) )
{
String returnClassName = getDescriptor( method.getReturnClassInfo() ).getName();
String superReturnClassName = getDescriptor( superDfs.getReturnType() ).getName();
if( !returnClassName.equals( superReturnClassName ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method );
return true;
}
}
}
return false;
} | class class_name[name] begin[{]
method[genProxyCovariantBridgeMethod, return_type[type[boolean]], modifier[private], parameter[dfs, superDfs]] begin[{]
local_variable[type[IGosuClassInternal], superType]
if[call[superType.isProxy, parameter[]]] begin[{]
local_variable[type[IJavaType], javaType]
assign[member[.javaType], Cast(expression=MethodInvocation(arguments=[MemberReference(member=javaType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDefaultParameterizedType, postfix_operators=[], prefix_operators=[], qualifier=TypeLord, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IJavaType, sub_type=None))]
local_variable[type[IType], dfsArgTypes]
local_variable[type[IType], defDfsArgTypes]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=defDfsArgTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=dfsArgTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getDefaultParameterizedTypeWithTypeVars, postfix_operators=[], prefix_operators=[], qualifier=TypeLord, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=dfsArgTypes, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[IJavaMethodInfo], mi]
if[binary_operation[member[.mi], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[IJavaClassMethod], method]
local_variable[type[IJavaClassInfo], paramClasses]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=defDfsArgTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isBytecodeType, postfix_operators=[], prefix_operators=['!'], qualifier=AbstractElementTransformer, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=defDfsArgTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=dfsParamClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=paramClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=dfsParamClass, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dfs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=superDfs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeCovariantParamBridgeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=paramClasses, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[AbstractElementTransformer.isBytecodeType, parameter[call[superDfs.getReturnType, parameter[]]]]] begin[{]
local_variable[type[String], returnClassName]
local_variable[type[String], superReturnClassName]
if[call[returnClassName.equals, parameter[member[.superReturnClassName]]]] begin[{]
call[.makeCovariantParamBridgeMethod, parameter[member[.dfs], member[.superDfs], member[.method]]]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[genProxyCovariantBridgeMethod] operator[SEP] identifier[DynamicFunctionSymbol] identifier[dfs] , identifier[DynamicFunctionSymbol] identifier[superDfs] operator[SEP] {
identifier[IGosuClassInternal] identifier[superType] operator[=] operator[SEP] identifier[IGosuClassInternal] operator[SEP] identifier[superDfs] operator[SEP] identifier[getScriptPart] operator[SEP] operator[SEP] operator[SEP] identifier[getContainingType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superType] operator[SEP] identifier[isProxy] operator[SEP] operator[SEP] operator[SEP] {
identifier[IJavaType] identifier[javaType] operator[=] identifier[superType] operator[SEP] identifier[getJavaType] operator[SEP] operator[SEP] operator[SEP] identifier[javaType] operator[=] operator[SEP] identifier[IJavaType] operator[SEP] identifier[TypeLord] operator[SEP] identifier[getDefaultParameterizedType] operator[SEP] identifier[javaType] operator[SEP] operator[SEP] identifier[IType] operator[SEP] operator[SEP] identifier[dfsArgTypes] operator[=] identifier[dfs] operator[SEP] identifier[getArgTypes] operator[SEP] operator[SEP] operator[SEP] identifier[IType] operator[SEP] operator[SEP] identifier[defDfsArgTypes] operator[=] Keyword[new] identifier[IType] operator[SEP] identifier[dfsArgTypes] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[dfsArgTypes] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[defDfsArgTypes] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[TypeLord] operator[SEP] identifier[getDefaultParameterizedTypeWithTypeVars] operator[SEP] identifier[dfsArgTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[IJavaMethodInfo] identifier[mi] operator[=] operator[SEP] identifier[IJavaMethodInfo] operator[SEP] operator[SEP] operator[SEP] identifier[IRelativeTypeInfo] operator[SEP] identifier[javaType] operator[SEP] identifier[getTypeInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] identifier[javaType] , identifier[NameResolver] operator[SEP] identifier[getFunctionName] operator[SEP] identifier[dfs] operator[SEP] , identifier[defDfsArgTypes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mi] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[IJavaClassMethod] identifier[method] operator[=] identifier[mi] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[IJavaClassInfo] operator[SEP] operator[SEP] identifier[paramClasses] operator[=] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[paramClasses] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[AbstractElementTransformer] operator[SEP] identifier[isBytecodeType] operator[SEP] identifier[defDfsArgTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[dfsParamClass] operator[=] identifier[getDescriptor] operator[SEP] identifier[defDfsArgTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dfsParamClass] operator[SEP] identifier[equals] operator[SEP] identifier[paramClasses] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[makeCovariantParamBridgeMethod] operator[SEP] identifier[dfs] , identifier[superDfs] , identifier[method] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[AbstractElementTransformer] operator[SEP] identifier[isBytecodeType] operator[SEP] identifier[superDfs] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[returnClassName] operator[=] identifier[getDescriptor] operator[SEP] identifier[method] operator[SEP] identifier[getReturnClassInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[superReturnClassName] operator[=] identifier[getDescriptor] operator[SEP] identifier[superDfs] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[returnClassName] operator[SEP] identifier[equals] operator[SEP] identifier[superReturnClassName] operator[SEP] operator[SEP] {
identifier[makeCovariantParamBridgeMethod] operator[SEP] identifier[dfs] , identifier[superDfs] , identifier[method] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
// If we are past the end of the file split, tell the reader not to read any more new blocks.
// Then continue reading until the last of the reader's already-parsed values are used up.
while (true) { // loop to skip over bad records
if (pos_ > end_) {
reader_.markNoMoreNewBlocks();
// Why not pos_ >= end_, stop when we just reach the end?
// we don't know if we have read all the bytes uncompressed in the current lzo block,
// only way to make sure that we have read all of the split is to read till the
// first record that has at least one byte in the next split.
// As a consequence of this, next split reader skips at least one byte
// (i.e. skips either partial or full record at the beginning).
}
byte[] byteArray = reader_.readNextProtoBytes();
if(byteArray == null) {
return false;
}
errorTracker.incRecords();
M decoded = null;
try {
decoded = deserializer_.fromBytes(byteArray);
} catch (DecodeException e) {
errorTracker.incErrors(e);
HadoopCompat.incrementCounter(recordErrorsCounter, 1);
continue;
}
if (updatePosition) {
pos_ = getLzoFilePos();
updatePosition = false;
}
if (decoded != null) {
key_.set(pos_);
value_.set(decoded);
pos_ = getLzoFilePos();
HadoopCompat.incrementCounter(recordsReadCounter, 1);
return true;
} else {
HadoopCompat.incrementCounter(recordsSkippedCounter, 1);
}
}
} | class class_name[name] begin[{]
method[nextKeyValue, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
while[literal[true]] begin[{]
if[binary_operation[member[.pos_], >, member[.end_]]] begin[{]
call[reader_.markNoMoreNewBlocks, parameter[]]
else begin[{]
None
end[}]
local_variable[type[byte], byteArray]
if[binary_operation[member[.byteArray], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
call[errorTracker.incRecords, parameter[]]
local_variable[type[M], decoded]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=decoded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=byteArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromBytes, postfix_operators=[], prefix_operators=[], qualifier=deserializer_, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incErrors, postfix_operators=[], prefix_operators=[], qualifier=errorTracker, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=recordErrorsCounter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=incrementCounter, postfix_operators=[], prefix_operators=[], qualifier=HadoopCompat, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DecodeException']))], finally_block=None, label=None, resources=None)
if[member[.updatePosition]] begin[{]
assign[member[.pos_], call[.getLzoFilePos, parameter[]]]
assign[member[.updatePosition], literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.decoded], !=, literal[null]]] begin[{]
call[key_.set, parameter[member[.pos_]]]
call[value_.set, parameter[member[.decoded]]]
assign[member[.pos_], call[.getLzoFilePos, parameter[]]]
call[HadoopCompat.incrementCounter, parameter[member[.recordsReadCounter], literal[1]]]
return[literal[true]]
else begin[{]
call[HadoopCompat.incrementCounter, parameter[member[.recordsSkippedCounter], literal[1]]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[nextKeyValue] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[pos_] operator[>] identifier[end_] operator[SEP] {
identifier[reader_] operator[SEP] identifier[markNoMoreNewBlocks] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[byteArray] operator[=] identifier[reader_] operator[SEP] identifier[readNextProtoBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[byteArray] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[errorTracker] operator[SEP] identifier[incRecords] operator[SEP] operator[SEP] operator[SEP] identifier[M] identifier[decoded] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[decoded] operator[=] identifier[deserializer_] operator[SEP] identifier[fromBytes] operator[SEP] identifier[byteArray] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DecodeException] identifier[e] operator[SEP] {
identifier[errorTracker] operator[SEP] identifier[incErrors] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[HadoopCompat] operator[SEP] identifier[incrementCounter] operator[SEP] identifier[recordErrorsCounter] , Other[1] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[updatePosition] operator[SEP] {
identifier[pos_] operator[=] identifier[getLzoFilePos] operator[SEP] operator[SEP] operator[SEP] identifier[updatePosition] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[decoded] operator[!=] Other[null] operator[SEP] {
identifier[key_] operator[SEP] identifier[set] operator[SEP] identifier[pos_] operator[SEP] operator[SEP] identifier[value_] operator[SEP] identifier[set] operator[SEP] identifier[decoded] operator[SEP] operator[SEP] identifier[pos_] operator[=] identifier[getLzoFilePos] operator[SEP] operator[SEP] operator[SEP] identifier[HadoopCompat] operator[SEP] identifier[incrementCounter] operator[SEP] identifier[recordsReadCounter] , Other[1] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[HadoopCompat] operator[SEP] identifier[incrementCounter] operator[SEP] identifier[recordsSkippedCounter] , Other[1] operator[SEP] operator[SEP]
}
}
}
|
public void marshall(ResolverRuleAssociation resolverRuleAssociation, ProtocolMarshaller protocolMarshaller) {
if (resolverRuleAssociation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resolverRuleAssociation.getId(), ID_BINDING);
protocolMarshaller.marshall(resolverRuleAssociation.getResolverRuleId(), RESOLVERRULEID_BINDING);
protocolMarshaller.marshall(resolverRuleAssociation.getName(), NAME_BINDING);
protocolMarshaller.marshall(resolverRuleAssociation.getVPCId(), VPCID_BINDING);
protocolMarshaller.marshall(resolverRuleAssociation.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(resolverRuleAssociation.getStatusMessage(), STATUSMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[resolverRuleAssociation, protocolMarshaller]] begin[{]
if[binary_operation[member[.resolverRuleAssociation], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=ID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResolverRuleId, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=RESOLVERRULEID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=NAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getVPCId, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=VPCID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=STATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStatusMessage, postfix_operators=[], prefix_operators=[], qualifier=resolverRuleAssociation, selectors=[], type_arguments=None), MemberReference(member=STATUSMESSAGE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ResolverRuleAssociation] identifier[resolverRuleAssociation] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[resolverRuleAssociation] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getResolverRuleId] operator[SEP] operator[SEP] , identifier[RESOLVERRULEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getVPCId] operator[SEP] operator[SEP] , identifier[VPCID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] , identifier[STATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[resolverRuleAssociation] operator[SEP] identifier[getStatusMessage] operator[SEP] operator[SEP] , identifier[STATUSMESSAGE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public alluxio.grpc.RegisterMasterPOptionsOrBuilder getOptionsOrBuilder() {
return options_ == null ? alluxio.grpc.RegisterMasterPOptions.getDefaultInstance() : options_;
} | class class_name[name] begin[{]
method[getOptionsOrBuilder, return_type[type[alluxio]], modifier[public], parameter[]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=options_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=options_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=getDefaultInstance, postfix_operators=[], prefix_operators=[], qualifier=alluxio.grpc.RegisterMasterPOptions, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[RegisterMasterPOptionsOrBuilder] identifier[getOptionsOrBuilder] operator[SEP] operator[SEP] {
Keyword[return] identifier[options_] operator[==] Other[null] operator[?] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[RegisterMasterPOptions] operator[SEP] identifier[getDefaultInstance] operator[SEP] operator[SEP] operator[:] identifier[options_] operator[SEP]
}
|
private void validateGroupByItem(SqlSelect select, SqlNode groupByItem) {
final SqlValidatorScope groupByScope = getGroupScope(select);
groupByScope.validateExpr(groupByItem);
} | class class_name[name] begin[{]
method[validateGroupByItem, return_type[void], modifier[private], parameter[select, groupByItem]] begin[{]
local_variable[type[SqlValidatorScope], groupByScope]
call[groupByScope.validateExpr, parameter[member[.groupByItem]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[validateGroupByItem] operator[SEP] identifier[SqlSelect] identifier[select] , identifier[SqlNode] identifier[groupByItem] operator[SEP] {
Keyword[final] identifier[SqlValidatorScope] identifier[groupByScope] operator[=] identifier[getGroupScope] operator[SEP] identifier[select] operator[SEP] operator[SEP] identifier[groupByScope] operator[SEP] identifier[validateExpr] operator[SEP] identifier[groupByItem] operator[SEP] operator[SEP]
}
|
public static void readTarGz(Path dirPath, InputStream input) throws IOException {
InputStream zipStream = new GzipCompressorInputStream(input);
TarArchiveInputStream archiveStream = new TarArchiveInputStream(zipStream);
TarArchiveEntry entry;
while ((entry = (TarArchiveEntry) archiveStream.getNextEntry()) != null) {
File outputFile = new File(dirPath.toFile(), entry.getName());
if (entry.isDirectory()) {
outputFile.mkdirs();
} else {
outputFile.getParentFile().mkdirs();
try (FileOutputStream fileOut = new FileOutputStream(outputFile)) {
IOUtils.copy(archiveStream, fileOut);
}
}
}
} | class class_name[name] begin[{]
method[readTarGz, return_type[void], modifier[public static], parameter[dirPath, input]] begin[{]
local_variable[type[InputStream], zipStream]
local_variable[type[TarArchiveInputStream], archiveStream]
local_variable[type[TarArchiveEntry], entry]
while[binary_operation[assign[member[.entry], Cast(expression=MethodInvocation(arguments=[], member=getNextEntry, postfix_operators=[], prefix_operators=[], qualifier=archiveStream, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=TarArchiveEntry, sub_type=None))], !=, literal[null]]] begin[{]
local_variable[type[File], outputFile]
if[call[entry.isDirectory, parameter[]]] begin[{]
call[outputFile.mkdirs, parameter[]]
else begin[{]
call[outputFile.getParentFile, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=archiveStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=fileOut, type=ReferenceType(arguments=None, dimensions=[], name=FileOutputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=outputFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None)))])
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[readTarGz] operator[SEP] identifier[Path] identifier[dirPath] , identifier[InputStream] identifier[input] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStream] identifier[zipStream] operator[=] Keyword[new] identifier[GzipCompressorInputStream] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[TarArchiveInputStream] identifier[archiveStream] operator[=] Keyword[new] identifier[TarArchiveInputStream] operator[SEP] identifier[zipStream] operator[SEP] operator[SEP] identifier[TarArchiveEntry] identifier[entry] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[entry] operator[=] operator[SEP] identifier[TarArchiveEntry] operator[SEP] identifier[archiveStream] operator[SEP] identifier[getNextEntry] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[File] identifier[outputFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[dirPath] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
identifier[outputFile] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[outputFile] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[FileOutputStream] identifier[fileOut] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[outputFile] operator[SEP] operator[SEP] {
identifier[IOUtils] operator[SEP] identifier[copy] operator[SEP] identifier[archiveStream] , identifier[fileOut] operator[SEP] operator[SEP]
}
}
}
}
|
public int readFromSkipPayload(ByteArrayDataInputStream in) throws IOException, ClassNotFoundException {
// 1. read the leading byte first
byte leading=in.readByte();
// 2. the flags
flags=in.readShort();
// 3. dest_addr
if(Util.isFlagSet(leading, DEST_SET))
dest=Util.readAddress(in);
// 4. src_addr
if(Util.isFlagSet(leading, SRC_SET))
sender=Util.readAddress(in);
// 5. headers
int len=in.readShort();
headers=createHeaders(len);
for(int i=0; i < len; i++) {
short id=in.readShort();
Header hdr=readHeader(in).setProtId(id);
this.headers[i]=hdr;
}
// 6. buf
if(!Util.isFlagSet(leading, BUF_SET))
return -1;
length=in.readInt();
return in.position();
} | class class_name[name] begin[{]
method[readFromSkipPayload, return_type[type[int]], modifier[public], parameter[in]] begin[{]
local_variable[type[byte], leading]
assign[member[.flags], call[in.readShort, parameter[]]]
if[call[Util.isFlagSet, parameter[member[.leading], member[.DEST_SET]]]] begin[{]
assign[member[.dest], call[Util.readAddress, parameter[member[.in]]]]
else begin[{]
None
end[}]
if[call[Util.isFlagSet, parameter[member[.leading], member[.SRC_SET]]]] begin[{]
assign[member[.sender], call[Util.readAddress, parameter[member[.in]]]]
else begin[{]
None
end[}]
local_variable[type[int], len]
assign[member[.headers], call[.createHeaders, parameter[member[.len]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readShort, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=BasicType(dimensions=[], name=short)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProtId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=hdr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Header, sub_type=None)), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=headers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=hdr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[Util.isFlagSet, parameter[member[.leading], member[.BUF_SET]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
assign[member[.length], call[in.readInt, parameter[]]]
return[call[in.position, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[readFromSkipPayload] operator[SEP] identifier[ByteArrayDataInputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
Keyword[byte] identifier[leading] operator[=] identifier[in] operator[SEP] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] identifier[flags] operator[=] identifier[in] operator[SEP] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Util] operator[SEP] identifier[isFlagSet] operator[SEP] identifier[leading] , identifier[DEST_SET] operator[SEP] operator[SEP] identifier[dest] operator[=] identifier[Util] operator[SEP] identifier[readAddress] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Util] operator[SEP] identifier[isFlagSet] operator[SEP] identifier[leading] , identifier[SRC_SET] operator[SEP] operator[SEP] identifier[sender] operator[=] identifier[Util] operator[SEP] identifier[readAddress] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[in] operator[SEP] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[=] identifier[createHeaders] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[short] identifier[id] operator[=] identifier[in] operator[SEP] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] identifier[Header] identifier[hdr] operator[=] identifier[readHeader] operator[SEP] identifier[in] operator[SEP] operator[SEP] identifier[setProtId] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[headers] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[hdr] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[Util] operator[SEP] identifier[isFlagSet] operator[SEP] identifier[leading] , identifier[BUF_SET] operator[SEP] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] identifier[length] operator[=] identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[in] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP]
}
|
public Promise<PeerSession> pickSession(final int uid,
final int keyGroupId,
final long ownKeyId,
final long theirKeyId) {
return pickCachedSession(uid, keyGroupId, ownKeyId, theirKeyId)
.fallback(new Function<Exception, Promise<PeerSession>>() {
@Override
public Promise<PeerSession> apply(Exception e) {
return Promises.tuple(
keyManager.getOwnIdentity(),
keyManager.getOwnPreKey(ownKeyId),
keyManager.getUserKeyGroups(uid),
keyManager.getUserPreKey(uid, keyGroupId, theirKeyId))
.map(new FunctionTupled4<KeyManagerActor.OwnIdentity, PrivateKey, UserKeys, PublicKey, PeerSession>() {
@Override
public PeerSession apply(KeyManagerActor.OwnIdentity ownIdentity, PrivateKey ownPreKey, UserKeys userKeys, PublicKey theirPreKey) {
UserKeysGroup keysGroup = ManagedList.of(userKeys.getUserKeysGroups())
.filter(UserKeysGroup.BY_KEY_GROUP(keyGroupId))
.first();
return spawnSession(uid,
ownIdentity.getKeyGroup(),
keyGroupId,
ownIdentity.getIdentityKey(),
keysGroup.getIdentityKey(),
ownPreKey,
theirPreKey);
}
});
}
});
} | class class_name[name] begin[{]
method[pickSession, return_type[type[Promise]], modifier[public], parameter[uid, keyGroupId, ownKeyId, theirKeyId]] begin[{]
return[call[.pickCachedSession, parameter[member[.uid], member[.keyGroupId], member[.ownKeyId], member[.theirKeyId]]]]
end[}]
END[}] | Keyword[public] identifier[Promise] operator[<] identifier[PeerSession] operator[>] identifier[pickSession] operator[SEP] Keyword[final] Keyword[int] identifier[uid] , Keyword[final] Keyword[int] identifier[keyGroupId] , Keyword[final] Keyword[long] identifier[ownKeyId] , Keyword[final] Keyword[long] identifier[theirKeyId] operator[SEP] {
Keyword[return] identifier[pickCachedSession] operator[SEP] identifier[uid] , identifier[keyGroupId] , identifier[ownKeyId] , identifier[theirKeyId] operator[SEP] operator[SEP] identifier[fallback] operator[SEP] Keyword[new] identifier[Function] operator[<] identifier[Exception] , identifier[Promise] operator[<] identifier[PeerSession] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Promise] operator[<] identifier[PeerSession] operator[>] identifier[apply] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] identifier[Promises] operator[SEP] identifier[tuple] operator[SEP] identifier[keyManager] operator[SEP] identifier[getOwnIdentity] operator[SEP] operator[SEP] , identifier[keyManager] operator[SEP] identifier[getOwnPreKey] operator[SEP] identifier[ownKeyId] operator[SEP] , identifier[keyManager] operator[SEP] identifier[getUserKeyGroups] operator[SEP] identifier[uid] operator[SEP] , identifier[keyManager] operator[SEP] identifier[getUserPreKey] operator[SEP] identifier[uid] , identifier[keyGroupId] , identifier[theirKeyId] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[FunctionTupled4] operator[<] identifier[KeyManagerActor] operator[SEP] identifier[OwnIdentity] , identifier[PrivateKey] , identifier[UserKeys] , identifier[PublicKey] , identifier[PeerSession] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[PeerSession] identifier[apply] operator[SEP] identifier[KeyManagerActor] operator[SEP] identifier[OwnIdentity] identifier[ownIdentity] , identifier[PrivateKey] identifier[ownPreKey] , identifier[UserKeys] identifier[userKeys] , identifier[PublicKey] identifier[theirPreKey] operator[SEP] {
identifier[UserKeysGroup] identifier[keysGroup] operator[=] identifier[ManagedList] operator[SEP] identifier[of] operator[SEP] identifier[userKeys] operator[SEP] identifier[getUserKeysGroups] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[UserKeysGroup] operator[SEP] identifier[BY_KEY_GROUP] operator[SEP] identifier[keyGroupId] operator[SEP] operator[SEP] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[spawnSession] operator[SEP] identifier[uid] , identifier[ownIdentity] operator[SEP] identifier[getKeyGroup] operator[SEP] operator[SEP] , identifier[keyGroupId] , identifier[ownIdentity] operator[SEP] identifier[getIdentityKey] operator[SEP] operator[SEP] , identifier[keysGroup] operator[SEP] identifier[getIdentityKey] operator[SEP] operator[SEP] , identifier[ownPreKey] , identifier[theirPreKey] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public String getManifestAttribute(String attributeName) {
if (attributeName != null) {
Map<Object,Object> mf = getManifestAttributes();
for (Object att : mf.keySet()) {
if (attributeName.equals(att.toString())) {
return mf.get(att).toString();
}
}
}
//In case not found return null;
return null;
} | class class_name[name] begin[{]
method[getManifestAttribute, return_type[type[String]], modifier[public], parameter[attributeName]] begin[{]
if[binary_operation[member[.attributeName], !=, literal[null]]] begin[{]
local_variable[type[Map], mf]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=att, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=attributeName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=att, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=att)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getManifestAttribute] operator[SEP] identifier[String] identifier[attributeName] operator[SEP] {
Keyword[if] operator[SEP] identifier[attributeName] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[mf] operator[=] identifier[getManifestAttributes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[att] operator[:] identifier[mf] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[attributeName] operator[SEP] identifier[equals] operator[SEP] identifier[att] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[mf] operator[SEP] identifier[get] operator[SEP] identifier[att] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.