code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static Consumer throwAssertionError(String format) {
return object -> {
throw new AssertionError(String.format(format, object));
};
}
|
class class_name[name] begin[{]
method[throwAssertionError, return_type[type[Consumer]], modifier[public static], parameter[format]] begin[{]
return[LambdaExpression(body=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssertionError, sub_type=None)), label=None)], parameters=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Consumer] identifier[throwAssertionError] operator[SEP] identifier[String] identifier[format] operator[SEP] {
Keyword[return] identifier[object] operator[->] {
Keyword[throw] Keyword[new] identifier[AssertionError] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[format] , identifier[object] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP]
}
|
public static <TimeInstantT extends TimeInstant> TimePickerFragment newInstance(int pickerId, TimeInstantT selectedInstant) {
TimePickerFragment f = new TimePickerFragment();
Bundle args = new Bundle();
args.putInt(ARG_PICKER_ID, pickerId);
args.putParcelable(ARG_SELECTED_INSTANT, selectedInstant);
f.setArguments(args);
return f;
}
|
class class_name[name] begin[{]
method[newInstance, return_type[type[TimePickerFragment]], modifier[public static], parameter[pickerId, selectedInstant]] begin[{]
local_variable[type[TimePickerFragment], f]
local_variable[type[Bundle], args]
call[args.putInt, parameter[member[.ARG_PICKER_ID], member[.pickerId]]]
call[args.putParcelable, parameter[member[.ARG_SELECTED_INSTANT], member[.selectedInstant]]]
call[f.setArguments, parameter[member[.args]]]
return[member[.f]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[TimeInstantT] Keyword[extends] identifier[TimeInstant] operator[>] identifier[TimePickerFragment] identifier[newInstance] operator[SEP] Keyword[int] identifier[pickerId] , identifier[TimeInstantT] identifier[selectedInstant] operator[SEP] {
identifier[TimePickerFragment] identifier[f] operator[=] Keyword[new] identifier[TimePickerFragment] operator[SEP] operator[SEP] operator[SEP] identifier[Bundle] identifier[args] operator[=] Keyword[new] identifier[Bundle] operator[SEP] operator[SEP] operator[SEP] identifier[args] operator[SEP] identifier[putInt] operator[SEP] identifier[ARG_PICKER_ID] , identifier[pickerId] operator[SEP] operator[SEP] identifier[args] operator[SEP] identifier[putParcelable] operator[SEP] identifier[ARG_SELECTED_INSTANT] , identifier[selectedInstant] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[setArguments] operator[SEP] identifier[args] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP]
}
|
private void buildGlobalResponseMessage(SwaggerProperties swaggerProperties, Docket docketForBuilder) {
SwaggerProperties.GlobalResponseMessage globalResponseMessages =
swaggerProperties.getGlobalResponseMessage();
/* POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE 响应消息体 **/
List<ResponseMessage> postResponseMessages = getResponseMessageList(globalResponseMessages.getPost());
List<ResponseMessage> getResponseMessages = getResponseMessageList(globalResponseMessages.getGet());
List<ResponseMessage> putResponseMessages = getResponseMessageList(globalResponseMessages.getPut());
List<ResponseMessage> patchResponseMessages = getResponseMessageList(globalResponseMessages.getPatch());
List<ResponseMessage> deleteResponseMessages = getResponseMessageList(globalResponseMessages.getDelete());
List<ResponseMessage> headResponseMessages = getResponseMessageList(globalResponseMessages.getHead());
List<ResponseMessage> optionsResponseMessages = getResponseMessageList(globalResponseMessages.getOptions());
List<ResponseMessage> trackResponseMessages = getResponseMessageList(globalResponseMessages.getTrace());
docketForBuilder.useDefaultResponseMessages(swaggerProperties.getApplyDefaultResponseMessages())
.globalResponseMessage(RequestMethod.POST, postResponseMessages)
.globalResponseMessage(RequestMethod.GET, getResponseMessages)
.globalResponseMessage(RequestMethod.PUT, putResponseMessages)
.globalResponseMessage(RequestMethod.PATCH, patchResponseMessages)
.globalResponseMessage(RequestMethod.DELETE, deleteResponseMessages)
.globalResponseMessage(RequestMethod.HEAD, headResponseMessages)
.globalResponseMessage(RequestMethod.OPTIONS, optionsResponseMessages)
.globalResponseMessage(RequestMethod.TRACE, trackResponseMessages);
}
|
class class_name[name] begin[{]
method[buildGlobalResponseMessage, return_type[void], modifier[private], parameter[swaggerProperties, docketForBuilder]] begin[{]
local_variable[type[SwaggerProperties], globalResponseMessages]
local_variable[type[List], postResponseMessages]
local_variable[type[List], getResponseMessages]
local_variable[type[List], putResponseMessages]
local_variable[type[List], patchResponseMessages]
local_variable[type[List], deleteResponseMessages]
local_variable[type[List], headResponseMessages]
local_variable[type[List], optionsResponseMessages]
local_variable[type[List], trackResponseMessages]
call[docketForBuilder.useDefaultResponseMessages, parameter[call[swaggerProperties.getApplyDefaultResponseMessages, parameter[]]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[buildGlobalResponseMessage] operator[SEP] identifier[SwaggerProperties] identifier[swaggerProperties] , identifier[Docket] identifier[docketForBuilder] operator[SEP] {
identifier[SwaggerProperties] operator[SEP] identifier[GlobalResponseMessage] identifier[globalResponseMessages] operator[=] identifier[swaggerProperties] operator[SEP] identifier[getGlobalResponseMessage] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[postResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getPost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[getResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getGet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[putResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getPut] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[patchResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getPatch] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[deleteResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getDelete] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[headResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getHead] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[optionsResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ResponseMessage] operator[>] identifier[trackResponseMessages] operator[=] identifier[getResponseMessageList] operator[SEP] identifier[globalResponseMessages] operator[SEP] identifier[getTrace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[docketForBuilder] operator[SEP] identifier[useDefaultResponseMessages] operator[SEP] identifier[swaggerProperties] operator[SEP] identifier[getApplyDefaultResponseMessages] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[POST] , identifier[postResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[GET] , identifier[getResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[PUT] , identifier[putResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[PATCH] , identifier[patchResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[DELETE] , identifier[deleteResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[HEAD] , identifier[headResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[OPTIONS] , identifier[optionsResponseMessages] operator[SEP] operator[SEP] identifier[globalResponseMessage] operator[SEP] identifier[RequestMethod] operator[SEP] identifier[TRACE] , identifier[trackResponseMessages] operator[SEP] operator[SEP]
}
|
public Assignments cluster(Matrix matrix, Properties props) {
int endSize = Integer.parseInt(props.getProperty(
NUM_CLUSTERS_END, DEFAULT_NUM_CLUSTERS_END));
return cluster(matrix, endSize, props);
}
|
class class_name[name] begin[{]
method[cluster, return_type[type[Assignments]], modifier[public], parameter[matrix, props]] begin[{]
local_variable[type[int], endSize]
return[call[.cluster, parameter[member[.matrix], member[.endSize], member[.props]]]]
end[}]
END[}]
|
Keyword[public] identifier[Assignments] identifier[cluster] operator[SEP] identifier[Matrix] identifier[matrix] , identifier[Properties] identifier[props] operator[SEP] {
Keyword[int] identifier[endSize] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[NUM_CLUSTERS_END] , identifier[DEFAULT_NUM_CLUSTERS_END] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cluster] operator[SEP] identifier[matrix] , identifier[endSize] , identifier[props] operator[SEP] operator[SEP]
}
|
public C placeEndFromEnd(int itemIndex, double endOffEnd) {
C cell = getSizedCell(itemIndex);
double y = sizeTracker.getViewportLength() + endOffEnd - orientation.length(cell);
relocate(cell, 0, y);
cell.getNode().setVisible(true);
return cell;
}
|
class class_name[name] begin[{]
method[placeEndFromEnd, return_type[type[C]], modifier[public], parameter[itemIndex, endOffEnd]] begin[{]
local_variable[type[C], cell]
local_variable[type[double], y]
call[.relocate, parameter[member[.cell], literal[0], member[.y]]]
call[cell.getNode, parameter[]]
return[member[.cell]]
end[}]
END[}]
|
Keyword[public] identifier[C] identifier[placeEndFromEnd] operator[SEP] Keyword[int] identifier[itemIndex] , Keyword[double] identifier[endOffEnd] operator[SEP] {
identifier[C] identifier[cell] operator[=] identifier[getSizedCell] operator[SEP] identifier[itemIndex] operator[SEP] operator[SEP] Keyword[double] identifier[y] operator[=] identifier[sizeTracker] operator[SEP] identifier[getViewportLength] operator[SEP] operator[SEP] operator[+] identifier[endOffEnd] operator[-] identifier[orientation] operator[SEP] identifier[length] operator[SEP] identifier[cell] operator[SEP] operator[SEP] identifier[relocate] operator[SEP] identifier[cell] , Other[0] , identifier[y] operator[SEP] operator[SEP] identifier[cell] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[setVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[cell] operator[SEP]
}
|
@RequiresPermission(Manifest.permission.INTERNET)
public static Observable<Boolean> observeInternetConnectivity() {
InternetObservingSettings settings = InternetObservingSettings.create();
return observeInternetConnectivity(settings.strategy(), settings.initialInterval(),
settings.interval(), settings.host(), settings.port(),
settings.timeout(), settings.httpResponse(), settings.errorHandler());
}
|
class class_name[name] begin[{]
method[observeInternetConnectivity, return_type[type[Observable]], modifier[public static], parameter[]] begin[{]
local_variable[type[InternetObservingSettings], settings]
return[call[.observeInternetConnectivity, parameter[call[settings.strategy, parameter[]], call[settings.initialInterval, parameter[]], call[settings.interval, parameter[]], call[settings.host, parameter[]], call[settings.port, parameter[]], call[settings.timeout, parameter[]], call[settings.httpResponse, parameter[]], call[settings.errorHandler, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[RequiresPermission] operator[SEP] identifier[Manifest] operator[SEP] identifier[permission] operator[SEP] identifier[INTERNET] operator[SEP] Keyword[public] Keyword[static] identifier[Observable] operator[<] identifier[Boolean] operator[>] identifier[observeInternetConnectivity] operator[SEP] operator[SEP] {
identifier[InternetObservingSettings] identifier[settings] operator[=] identifier[InternetObservingSettings] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[observeInternetConnectivity] operator[SEP] identifier[settings] operator[SEP] identifier[strategy] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[initialInterval] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[interval] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[host] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[port] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[timeout] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[httpResponse] operator[SEP] operator[SEP] , identifier[settings] operator[SEP] identifier[errorHandler] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private OrderedMap<String, Pom> sortSubmodulesToReflectDependencies(Pom pom)
{
Set<MavenCoord> dependenciesMet = new HashSet();
dependenciesMet.add(pom.coord);
SortedSet<MavenCoord> dependenciesSatisfied = new TreeSet<>();
for (Dependency dep : pom.dependencies)
{
// Traverse the tree, depth-first, take items at node exit.
}
throw new UnsupportedOperationException("Not implemented yet.");
}
|
class class_name[name] begin[{]
method[sortSubmodulesToReflectDependencies, return_type[type[OrderedMap]], modifier[private], parameter[pom]] begin[{]
local_variable[type[Set], dependenciesMet]
call[dependenciesMet.add, parameter[member[pom.coord]]]
local_variable[type[SortedSet], dependenciesSatisfied]
ForStatement(body=BlockStatement(label=None, statements=[]), control=EnhancedForControl(iterable=MemberReference(member=dependencies, postfix_operators=[], prefix_operators=[], qualifier=pom, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dep)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Dependency, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not implemented yet.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[private] identifier[OrderedMap] operator[<] identifier[String] , identifier[Pom] operator[>] identifier[sortSubmodulesToReflectDependencies] operator[SEP] identifier[Pom] identifier[pom] operator[SEP] {
identifier[Set] operator[<] identifier[MavenCoord] operator[>] identifier[dependenciesMet] operator[=] Keyword[new] identifier[HashSet] operator[SEP] operator[SEP] operator[SEP] identifier[dependenciesMet] operator[SEP] identifier[add] operator[SEP] identifier[pom] operator[SEP] identifier[coord] operator[SEP] operator[SEP] identifier[SortedSet] operator[<] identifier[MavenCoord] operator[>] identifier[dependenciesSatisfied] operator[=] Keyword[new] identifier[TreeSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Dependency] identifier[dep] operator[:] identifier[pom] operator[SEP] identifier[dependencies] operator[SEP] {
}
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
private void addFourEyesTaskListener(ActivityImpl activity) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
boolean listenerAlreadyExists = false;
// check that the listener wasn't added in the XML explicitly
List<TaskListener> existingListeners = userTaskActivityBehavior.getTaskDefinition().getTaskListeners().get("complete");
for (TaskListener taskListener : existingListeners) {
if (taskListener instanceof ClassDelegate &&
((ClassDelegate)taskListener).getClassName().equals(TaskCompletionListener.class.getName())) {
listenerAlreadyExists = true;
logger.info(TaskCompletionListener.class.getSimpleName() + " was already explicitly added to usertask in the bpmn xml.");
break;
}
}
if (!listenerAlreadyExists) {
logger.info("Adding " + TaskCompletionListener.class.getSimpleName() + " implicitly to usertask.");
ClassDelegate taskListener = new ClassDelegate(TaskCompletionListener.class, null);
userTaskActivityBehavior.getTaskDefinition().addTaskListener("complete", taskListener);
}
}
|
class class_name[name] begin[{]
method[addFourEyesTaskListener, return_type[void], modifier[private], parameter[activity]] begin[{]
local_variable[type[UserTaskActivityBehavior], userTaskActivityBehavior]
local_variable[type[boolean], listenerAlreadyExists]
local_variable[type[List], existingListeners]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=taskListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ClassDelegate, sub_type=None), operator=instanceof), operandr=Cast(expression=MemberReference(member=taskListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ClassDelegate, sub_type=None)), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=listenerAlreadyExists, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=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=TaskCompletionListener, sub_type=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" was already explicitly added to usertask in the bpmn xml."), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=existingListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=taskListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskListener, sub_type=None))), label=None)
if[member[.listenerAlreadyExists]] begin[{]
call[logger.info, parameter[binary_operation[binary_operation[literal["Adding "], +, 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=TaskCompletionListener, sub_type=None))], +, literal[" implicitly to usertask."]]]]
local_variable[type[ClassDelegate], taskListener]
call[userTaskActivityBehavior.getTaskDefinition, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[addFourEyesTaskListener] operator[SEP] identifier[ActivityImpl] identifier[activity] operator[SEP] {
identifier[UserTaskActivityBehavior] identifier[userTaskActivityBehavior] operator[=] operator[SEP] identifier[UserTaskActivityBehavior] operator[SEP] identifier[activity] operator[SEP] identifier[getActivityBehavior] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[listenerAlreadyExists] operator[=] literal[boolean] operator[SEP] identifier[List] operator[<] identifier[TaskListener] operator[>] identifier[existingListeners] operator[=] identifier[userTaskActivityBehavior] operator[SEP] identifier[getTaskDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[getTaskListeners] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TaskListener] identifier[taskListener] operator[:] identifier[existingListeners] operator[SEP] {
Keyword[if] operator[SEP] identifier[taskListener] Keyword[instanceof] identifier[ClassDelegate] operator[&&] operator[SEP] operator[SEP] identifier[ClassDelegate] operator[SEP] identifier[taskListener] operator[SEP] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[TaskCompletionListener] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[listenerAlreadyExists] operator[=] literal[boolean] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[TaskCompletionListener] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[listenerAlreadyExists] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[TaskCompletionListener] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[ClassDelegate] identifier[taskListener] operator[=] Keyword[new] identifier[ClassDelegate] operator[SEP] identifier[TaskCompletionListener] operator[SEP] Keyword[class] , Other[null] operator[SEP] operator[SEP] identifier[userTaskActivityBehavior] operator[SEP] identifier[getTaskDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[addTaskListener] operator[SEP] literal[String] , identifier[taskListener] operator[SEP] operator[SEP]
}
}
|
protected RelationKey parseRelationKey(String id) {
Matcher matcher = RELATION_PATTERN.matcher(id);
matcher.find();
CmsUUID src = new CmsUUID(matcher.group(1));
CmsUUID tgt = new CmsUUID(matcher.group(2));
String tp = matcher.group(3);
return new RelationKey(src, tgt, tp);
}
|
class class_name[name] begin[{]
method[parseRelationKey, return_type[type[RelationKey]], modifier[protected], parameter[id]] begin[{]
local_variable[type[Matcher], matcher]
call[matcher.find, parameter[]]
local_variable[type[CmsUUID], src]
local_variable[type[CmsUUID], tgt]
local_variable[type[String], tp]
return[ClassCreator(arguments=[MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tgt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tp, 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=RelationKey, sub_type=None))]
end[}]
END[}]
|
Keyword[protected] identifier[RelationKey] identifier[parseRelationKey] operator[SEP] identifier[String] identifier[id] operator[SEP] {
identifier[Matcher] identifier[matcher] operator[=] identifier[RELATION_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] identifier[CmsUUID] identifier[src] operator[=] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[CmsUUID] identifier[tgt] operator[=] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[tp] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[RelationKey] operator[SEP] identifier[src] , identifier[tgt] , identifier[tp] operator[SEP] operator[SEP]
}
|
private URL generateMetatypePropertiesName(String metatypeName, String locale) {
String lookupName;
if (locale != null && locale.length() > 0) {
lookupName = metatypeName + LOCALE_SEPARATOR + locale + PROP_EXT;
} else {
lookupName = metatypeName + PROP_EXT;
}
URL url = bundle.getEntry(lookupName);
if (url == null) {
int pos = locale == null ? -1 : locale.lastIndexOf(LOCALE_SEPARATOR);
if (pos != -1) {
url = generateMetatypePropertiesName(metatypeName, locale.substring(0, pos));
}
}
return url;
}
|
class class_name[name] begin[{]
method[generateMetatypePropertiesName, return_type[type[URL]], modifier[private], parameter[metatypeName, locale]] begin[{]
local_variable[type[String], lookupName]
if[binary_operation[binary_operation[member[.locale], !=, literal[null]], &&, binary_operation[call[locale.length, parameter[]], >, literal[0]]]] begin[{]
assign[member[.lookupName], binary_operation[binary_operation[binary_operation[member[.metatypeName], +, member[.LOCALE_SEPARATOR]], +, member[.locale]], +, member[.PROP_EXT]]]
else begin[{]
assign[member[.lookupName], binary_operation[member[.metatypeName], +, member[.PROP_EXT]]]
end[}]
local_variable[type[URL], url]
if[binary_operation[member[.url], ==, literal[null]]] begin[{]
local_variable[type[int], pos]
if[binary_operation[member[.pos], !=, literal[1]]] begin[{]
assign[member[.url], call[.generateMetatypePropertiesName, parameter[member[.metatypeName], call[locale.substring, parameter[literal[0], member[.pos]]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.url]]
end[}]
END[}]
|
Keyword[private] identifier[URL] identifier[generateMetatypePropertiesName] operator[SEP] identifier[String] identifier[metatypeName] , identifier[String] identifier[locale] operator[SEP] {
identifier[String] identifier[lookupName] operator[SEP] Keyword[if] operator[SEP] identifier[locale] operator[!=] Other[null] operator[&&] identifier[locale] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[lookupName] operator[=] identifier[metatypeName] operator[+] identifier[LOCALE_SEPARATOR] operator[+] identifier[locale] operator[+] identifier[PROP_EXT] operator[SEP]
}
Keyword[else] {
identifier[lookupName] operator[=] identifier[metatypeName] operator[+] identifier[PROP_EXT] operator[SEP]
}
identifier[URL] identifier[url] operator[=] identifier[bundle] operator[SEP] identifier[getEntry] operator[SEP] identifier[lookupName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[==] Other[null] operator[SEP] {
Keyword[int] identifier[pos] operator[=] identifier[locale] operator[==] Other[null] operator[?] operator[-] Other[1] operator[:] identifier[locale] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[LOCALE_SEPARATOR] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[url] operator[=] identifier[generateMetatypePropertiesName] operator[SEP] identifier[metatypeName] , identifier[locale] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pos] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[url] operator[SEP]
}
|
public void addResourceType(I_CmsResourceType resourceType) throws CmsConfigurationException {
// check if new resource types can still be added
if (m_frozen) {
throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0));
}
I_CmsResourceType conflictingType = null;
if (resourceType.getTypeId() == CmsResourceTypeUnknownFile.RESOURCE_TYPE_ID) {
// default unknown file resource type
if (m_restypeUnknownFile != null) {
// error: already set
conflictingType = m_restypeUnknownFile;
} else {
m_restypeUnknownFile = resourceType;
return;
}
} else if (resourceType.getTypeId() == CmsResourceTypeUnknownFolder.RESOURCE_TYPE_ID) {
// default unknown folder resource type
if (m_restypeUnknownFolder != null) {
// error: already set
conflictingType = m_restypeUnknownFolder;
} else {
m_restypeUnknownFolder = resourceType;
return;
}
} else {
// normal resource types
int conflictIndex = m_resourceTypesFromXml.indexOf(resourceType);
if (conflictIndex >= 0) {
conflictingType = m_resourceTypesFromXml.get(conflictIndex);
}
}
if (conflictingType != null) {
// configuration problem: the resource type (or at least the id or the name) is already configured
throw new CmsConfigurationException(
Messages.get().container(
Messages.ERR_CONFLICTING_RESOURCE_TYPES_4,
new Object[] {
resourceType.getTypeName(),
new Integer(resourceType.getTypeId()),
conflictingType.getTypeName(),
new Integer(conflictingType.getTypeId())}));
}
m_resourceTypesFromXml.add(resourceType);
}
|
class class_name[name] begin[{]
method[addResourceType, return_type[void], modifier[public], parameter[resourceType]] begin[{]
if[member[.m_frozen]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_NO_CONFIG_AFTER_STARTUP_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsConfigurationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[I_CmsResourceType], conflictingType]
if[binary_operation[call[resourceType.getTypeId, parameter[]], ==, member[CmsResourceTypeUnknownFile.RESOURCE_TYPE_ID]]] begin[{]
if[binary_operation[member[.m_restypeUnknownFile], !=, literal[null]]] begin[{]
assign[member[.conflictingType], member[.m_restypeUnknownFile]]
else begin[{]
assign[member[.m_restypeUnknownFile], member[.resourceType]]
return[None]
end[}]
else begin[{]
if[binary_operation[call[resourceType.getTypeId, parameter[]], ==, member[CmsResourceTypeUnknownFolder.RESOURCE_TYPE_ID]]] begin[{]
if[binary_operation[member[.m_restypeUnknownFolder], !=, literal[null]]] begin[{]
assign[member[.conflictingType], member[.m_restypeUnknownFolder]]
else begin[{]
assign[member[.m_restypeUnknownFolder], member[.resourceType]]
return[None]
end[}]
else begin[{]
local_variable[type[int], conflictIndex]
if[binary_operation[member[.conflictIndex], >=, literal[0]]] begin[{]
assign[member[.conflictingType], call[m_resourceTypesFromXml.get, parameter[member[.conflictIndex]]]]
else begin[{]
None
end[}]
end[}]
end[}]
if[binary_operation[member[.conflictingType], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_CONFLICTING_RESOURCE_TYPES_4, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getTypeName, postfix_operators=[], prefix_operators=[], qualifier=resourceType, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTypeId, postfix_operators=[], prefix_operators=[], qualifier=resourceType, 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)), MethodInvocation(arguments=[], member=getTypeName, postfix_operators=[], prefix_operators=[], qualifier=conflictingType, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTypeId, postfix_operators=[], prefix_operators=[], qualifier=conflictingType, 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))], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsConfigurationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[m_resourceTypesFromXml.add, parameter[member[.resourceType]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addResourceType] operator[SEP] identifier[I_CmsResourceType] identifier[resourceType] operator[SEP] Keyword[throws] identifier[CmsConfigurationException] {
Keyword[if] operator[SEP] identifier[m_frozen] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CmsConfigurationException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_NO_CONFIG_AFTER_STARTUP_0] operator[SEP] operator[SEP] operator[SEP]
}
identifier[I_CmsResourceType] identifier[conflictingType] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resourceType] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[==] identifier[CmsResourceTypeUnknownFile] operator[SEP] identifier[RESOURCE_TYPE_ID] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_restypeUnknownFile] operator[!=] Other[null] operator[SEP] {
identifier[conflictingType] operator[=] identifier[m_restypeUnknownFile] operator[SEP]
}
Keyword[else] {
identifier[m_restypeUnknownFile] operator[=] identifier[resourceType] operator[SEP] Keyword[return] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[resourceType] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[==] identifier[CmsResourceTypeUnknownFolder] operator[SEP] identifier[RESOURCE_TYPE_ID] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_restypeUnknownFolder] operator[!=] Other[null] operator[SEP] {
identifier[conflictingType] operator[=] identifier[m_restypeUnknownFolder] operator[SEP]
}
Keyword[else] {
identifier[m_restypeUnknownFolder] operator[=] identifier[resourceType] operator[SEP] Keyword[return] operator[SEP]
}
}
Keyword[else] {
Keyword[int] identifier[conflictIndex] operator[=] identifier[m_resourceTypesFromXml] operator[SEP] identifier[indexOf] operator[SEP] identifier[resourceType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[conflictIndex] operator[>=] Other[0] operator[SEP] {
identifier[conflictingType] operator[=] identifier[m_resourceTypesFromXml] operator[SEP] identifier[get] operator[SEP] identifier[conflictIndex] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[conflictingType] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CmsConfigurationException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_CONFLICTING_RESOURCE_TYPES_4] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[resourceType] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[resourceType] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP] , identifier[conflictingType] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] , Keyword[new] identifier[Integer] operator[SEP] identifier[conflictingType] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP]
}
identifier[m_resourceTypesFromXml] operator[SEP] identifier[add] operator[SEP] identifier[resourceType] operator[SEP] operator[SEP]
}
|
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, ByteBuffer bb) throws IOException {
final int partitionColIndex = bb.getInt();
final int columnCount = bb.getInt();
assert(columnCount <= DDLCompiler.MAX_COLUMNS);
boolean[] is_null = extractNullFlags(bb, columnCount);
assert(previous != null);
if (previous == null) {
throw new IOException("Export block with no schema found without prior block with schema.");
}
final long generation = previous.generation;
final String tableName = previous.tableName;
final List<String> colNames = previous.names;
final List<VoltType> colTypes = previous.types;
final List<Integer> colLengths = previous.lengths;
Object[] retval = new Object[colNames.size()];
Object pval = null;
for (int i = 0; i < colNames.size(); ++i) {
if (is_null[i]) {
retval[i] = null;
} else {
retval[i] = decodeNextColumn(bb, colTypes.get(i));
}
if (i == partitionColIndex) {
pval = retval[i];
}
}
return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation);
}
|
class class_name[name] begin[{]
method[decodeRow, return_type[type[ExportRow]], modifier[public static], parameter[previous, partition, startTS, bb]] begin[{]
local_variable[type[int], partitionColIndex]
local_variable[type[int], columnCount]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=columnCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_COLUMNS, postfix_operators=[], prefix_operators=[], qualifier=DDLCompiler, selectors=[]), operator=<=), label=None, value=None)
local_variable[type[boolean], is_null]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=previous, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
if[binary_operation[member[.previous], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Export block with no schema found without prior block with schema.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[long], generation]
local_variable[type[String], tableName]
local_variable[type[List], colNames]
local_variable[type[List], colTypes]
local_variable[type[List], colLengths]
local_variable[type[Object], retval]
local_variable[type[Object], pval]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=is_null, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=bb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None)], member=decodeNextColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=partitionColIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=retval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=colNames, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=colNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=colTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=colLengths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=retval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=pval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=pval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=partitionColIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=generation, 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=ExportRow, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ExportRow] identifier[decodeRow] operator[SEP] identifier[ExportRow] identifier[previous] , Keyword[int] identifier[partition] , Keyword[long] identifier[startTS] , identifier[ByteBuffer] identifier[bb] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] Keyword[int] identifier[partitionColIndex] operator[=] identifier[bb] operator[SEP] identifier[getInt] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[columnCount] operator[=] identifier[bb] operator[SEP] identifier[getInt] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[columnCount] operator[<=] identifier[DDLCompiler] operator[SEP] identifier[MAX_COLUMNS] operator[SEP] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[is_null] operator[=] identifier[extractNullFlags] operator[SEP] identifier[bb] , identifier[columnCount] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[previous] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[previous] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[long] identifier[generation] operator[=] identifier[previous] operator[SEP] identifier[generation] operator[SEP] Keyword[final] identifier[String] identifier[tableName] operator[=] identifier[previous] operator[SEP] identifier[tableName] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[colNames] operator[=] identifier[previous] operator[SEP] identifier[names] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[VoltType] operator[>] identifier[colTypes] operator[=] identifier[previous] operator[SEP] identifier[types] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Integer] operator[>] identifier[colLengths] operator[=] identifier[previous] operator[SEP] identifier[lengths] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[retval] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[colNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[pval] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[colNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[is_null] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[retval] operator[SEP] identifier[i] operator[SEP] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[retval] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[decodeNextColumn] operator[SEP] identifier[bb] , identifier[colTypes] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[==] identifier[partitionColIndex] operator[SEP] {
identifier[pval] operator[=] identifier[retval] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[ExportRow] operator[SEP] identifier[tableName] , identifier[colNames] , identifier[colTypes] , identifier[colLengths] , identifier[retval] , operator[SEP] identifier[pval] operator[==] Other[null] operator[?] identifier[partition] operator[:] identifier[pval] operator[SEP] , identifier[partitionColIndex] , identifier[partition] , identifier[generation] operator[SEP] operator[SEP]
}
|
public static byte[] generateStubBytes(Class<?> remoteInterface,
int rmicCompatible) throws EJBConfigurationException {
String stubClassName = getStubClassName(remoteInterface.getName());
Method[] remoteMethods = remoteInterface.getMethods();
String[] idlNames = getIdlMethodNames(remoteMethods);
byte[] classBytes = generateClassBytes(stubClassName,
remoteInterface,
remoteMethods,
idlNames,
rmicCompatible); // PM46698
return classBytes;
}
|
class class_name[name] begin[{]
method[generateStubBytes, return_type[type[byte]], modifier[public static], parameter[remoteInterface, rmicCompatible]] begin[{]
local_variable[type[String], stubClassName]
local_variable[type[Method], remoteMethods]
local_variable[type[String], idlNames]
local_variable[type[byte], classBytes]
return[member[.classBytes]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[generateStubBytes] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[remoteInterface] , Keyword[int] identifier[rmicCompatible] operator[SEP] Keyword[throws] identifier[EJBConfigurationException] {
identifier[String] identifier[stubClassName] operator[=] identifier[getStubClassName] operator[SEP] identifier[remoteInterface] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Method] operator[SEP] operator[SEP] identifier[remoteMethods] operator[=] identifier[remoteInterface] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[idlNames] operator[=] identifier[getIdlMethodNames] operator[SEP] identifier[remoteMethods] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[classBytes] operator[=] identifier[generateClassBytes] operator[SEP] identifier[stubClassName] , identifier[remoteInterface] , identifier[remoteMethods] , identifier[idlNames] , identifier[rmicCompatible] operator[SEP] operator[SEP] Keyword[return] identifier[classBytes] operator[SEP]
}
|
public static boolean isTrivialTable(SymbolTable table)
{
if (table == null) return true;
if (table.isSystemTable()) return true;
if (table.isLocalTable()) {
// this is only true when there are no local
// symbols defined
// and there are no imports with any symbols
if (table.getMaxId() == table.getSystemSymbolTable().getMaxId()) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[isTrivialTable, return_type[type[boolean]], modifier[public static], parameter[table]] begin[{]
if[binary_operation[member[.table], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[table.isSystemTable, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[table.isLocalTable, parameter[]]] begin[{]
if[binary_operation[call[table.getMaxId, parameter[]], ==, call[table.getSystemSymbolTable, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isTrivialTable] operator[SEP] identifier[SymbolTable] identifier[table] operator[SEP] {
Keyword[if] operator[SEP] identifier[table] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[table] operator[SEP] identifier[isSystemTable] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[table] operator[SEP] identifier[isLocalTable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[table] operator[SEP] identifier[getMaxId] operator[SEP] operator[SEP] operator[==] identifier[table] operator[SEP] identifier[getSystemSymbolTable] operator[SEP] operator[SEP] operator[SEP] identifier[getMaxId] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET);
}
|
class class_name[name] begin[{]
method[getPortComponentByServletLink, return_type[type[PortComponent]], modifier[static], parameter[servletLink, containerToAdapt]] begin[{]
return[call[.getHighLevelElementByServiceImplBean, parameter[member[.servletLink], member[.containerToAdapt], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PortComponent, sub_type=None)), member[LinkType.SERVLET]]]]
end[}]
END[}]
|
Keyword[static] identifier[PortComponent] identifier[getPortComponentByServletLink] operator[SEP] identifier[String] identifier[servletLink] , identifier[Adaptable] identifier[containerToAdapt] operator[SEP] Keyword[throws] identifier[UnableToAdaptException] {
Keyword[return] identifier[getHighLevelElementByServiceImplBean] operator[SEP] identifier[servletLink] , identifier[containerToAdapt] , identifier[PortComponent] operator[SEP] Keyword[class] , identifier[LinkType] operator[SEP] identifier[SERVLET] operator[SEP] operator[SEP]
}
|
public Object[] getChildren(Object element)
{
if (element instanceof IResource || element instanceof INode)
{
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter != null)
{
return adapter.getChildren(element);
}
return NO_CHILDREN;
}
return NO_CHILDREN;
}
|
class class_name[name] begin[{]
method[getChildren, return_type[type[Object]], modifier[public], parameter[element]] begin[{]
if[binary_operation[binary_operation[member[.element], instanceof, type[IResource]], ||, binary_operation[member[.element], instanceof, type[INode]]]] begin[{]
local_variable[type[IWorkbenchAdapter], adapter]
if[binary_operation[member[.adapter], !=, literal[null]]] begin[{]
return[call[adapter.getChildren, parameter[member[.element]]]]
else begin[{]
None
end[}]
return[member[.NO_CHILDREN]]
else begin[{]
None
end[}]
return[member[.NO_CHILDREN]]
end[}]
END[}]
|
Keyword[public] identifier[Object] operator[SEP] operator[SEP] identifier[getChildren] operator[SEP] identifier[Object] identifier[element] operator[SEP] {
Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[IResource] operator[||] identifier[element] Keyword[instanceof] identifier[INode] operator[SEP] {
identifier[IWorkbenchAdapter] identifier[adapter] operator[=] identifier[getAdapter] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[adapter] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[adapter] operator[SEP] identifier[getChildren] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
Keyword[return] identifier[NO_CHILDREN] operator[SEP]
}
Keyword[return] identifier[NO_CHILDREN] operator[SEP]
}
|
private static boolean isValidEscaping(char c) {
return ((c == 'n') || (c == 'r') || (c == 't') || (c == 'f') || (c == 'b') || (c == '\\') || (c == '/')
|| (c == '"') || (c == 'u'));
}
|
class class_name[name] begin[{]
method[isValidEscaping, return_type[type[boolean]], modifier[private static], parameter[c]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.c], ==, literal['n']], ||, binary_operation[member[.c], ==, literal['r']]], ||, binary_operation[member[.c], ==, literal['t']]], ||, binary_operation[member[.c], ==, literal['f']]], ||, binary_operation[member[.c], ==, literal['b']]], ||, binary_operation[member[.c], ==, literal['\\']]], ||, binary_operation[member[.c], ==, literal['/']]], ||, binary_operation[member[.c], ==, literal['"']]], ||, binary_operation[member[.c], ==, literal['u']]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[isValidEscaping] operator[SEP] Keyword[char] identifier[c] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[||] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Date addMinutes(Date date, int iMinutes ) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.MINUTE, iMinutes);
return dateTime.getTime();
}
|
class class_name[name] begin[{]
method[addMinutes, return_type[type[Date]], modifier[public static], parameter[date, iMinutes]] begin[{]
local_variable[type[Calendar], dateTime]
call[dateTime.add, parameter[member[Calendar.MINUTE], member[.iMinutes]]]
return[call[dateTime.getTime, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Date] identifier[addMinutes] operator[SEP] identifier[Date] identifier[date] , Keyword[int] identifier[iMinutes] operator[SEP] {
identifier[Calendar] identifier[dateTime] operator[=] identifier[dateToCalendar] operator[SEP] identifier[date] operator[SEP] operator[SEP] identifier[dateTime] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , identifier[iMinutes] operator[SEP] operator[SEP] Keyword[return] identifier[dateTime] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
|
private static synchronized Object getFromCache(Cache cache,
byte[] encoding) {
Object key = new Cache.EqualByteArray(encoding);
Object value = cache.get(key);
return value;
}
|
class class_name[name] begin[{]
method[getFromCache, return_type[type[Object]], modifier[synchronized private static], parameter[cache, encoding]] begin[{]
local_variable[type[Object], key]
local_variable[type[Object], value]
return[member[.value]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[synchronized] identifier[Object] identifier[getFromCache] operator[SEP] identifier[Cache] identifier[cache] , Keyword[byte] operator[SEP] operator[SEP] identifier[encoding] operator[SEP] {
identifier[Object] identifier[key] operator[=] Keyword[new] identifier[Cache] operator[SEP] identifier[EqualByteArray] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] identifier[Object] identifier[value] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public static int crc32AsInt(@NotNull byte[] input) {
CRC32 crc32 = new CRC32();
crc32.update(input);
// CRC32 只是 32bit int,为了CheckSum接口强转成long,此处再次转回来
return (int) crc32.getValue();
}
|
class class_name[name] begin[{]
method[crc32AsInt, return_type[type[int]], modifier[public static], parameter[input]] begin[{]
local_variable[type[CRC32], crc32]
call[crc32.update, parameter[member[.input]]]
return[Cast(expression=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=crc32, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[crc32AsInt] operator[SEP] annotation[@] identifier[NotNull] Keyword[byte] operator[SEP] operator[SEP] identifier[input] operator[SEP] {
identifier[CRC32] identifier[crc32] operator[=] Keyword[new] identifier[CRC32] operator[SEP] operator[SEP] operator[SEP] identifier[crc32] operator[SEP] identifier[update] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[crc32] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
|
public M readNext() throws IOException {
byte[] blob = readNextProtoBytes();
return blob == null ?
null : protoConverter_.fromBytes(blob);
}
|
class class_name[name] begin[{]
method[readNext, return_type[type[M]], modifier[public], parameter[]] begin[{]
local_variable[type[byte], blob]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=blob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=blob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromBytes, postfix_operators=[], prefix_operators=[], qualifier=protoConverter_, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[M] identifier[readNext] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[blob] operator[=] identifier[readNextProtoBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[blob] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[protoConverter_] operator[SEP] identifier[fromBytes] operator[SEP] identifier[blob] operator[SEP] operator[SEP]
}
|
public BigDecimal add(BigDecimal augend) {
if (this.intCompact != INFLATED) {
if ((augend.intCompact != INFLATED)) {
return add(this.intCompact, this.scale, augend.intCompact, augend.scale);
} else {
return add(this.intCompact, this.scale, augend.intVal, augend.scale);
}
} else {
if ((augend.intCompact != INFLATED)) {
return add(augend.intCompact, augend.scale, this.intVal, this.scale);
} else {
return add(this.intVal, this.scale, augend.intVal, augend.scale);
}
}
}
|
class class_name[name] begin[{]
method[add, return_type[type[BigDecimal]], modifier[public], parameter[augend]] begin[{]
if[binary_operation[THIS[member[None.intCompact]], !=, member[.INFLATED]]] begin[{]
if[binary_operation[member[augend.intCompact], !=, member[.INFLATED]]] begin[{]
return[call[.add, parameter[THIS[member[None.intCompact]], THIS[member[None.scale]], member[augend.intCompact], member[augend.scale]]]]
else begin[{]
return[call[.add, parameter[THIS[member[None.intCompact]], THIS[member[None.scale]], member[augend.intVal], member[augend.scale]]]]
end[}]
else begin[{]
if[binary_operation[member[augend.intCompact], !=, member[.INFLATED]]] begin[{]
return[call[.add, parameter[member[augend.intCompact], member[augend.scale], THIS[member[None.intVal]], THIS[member[None.scale]]]]]
else begin[{]
return[call[.add, parameter[THIS[member[None.intVal]], THIS[member[None.scale]], member[augend.intVal], member[augend.scale]]]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[BigDecimal] identifier[add] operator[SEP] identifier[BigDecimal] identifier[augend] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[intCompact] operator[!=] identifier[INFLATED] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[augend] operator[SEP] identifier[intCompact] operator[!=] identifier[INFLATED] operator[SEP] operator[SEP] {
Keyword[return] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[intCompact] , Keyword[this] operator[SEP] identifier[scale] , identifier[augend] operator[SEP] identifier[intCompact] , identifier[augend] operator[SEP] identifier[scale] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[intCompact] , Keyword[this] operator[SEP] identifier[scale] , identifier[augend] operator[SEP] identifier[intVal] , identifier[augend] operator[SEP] identifier[scale] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] operator[SEP] identifier[augend] operator[SEP] identifier[intCompact] operator[!=] identifier[INFLATED] operator[SEP] operator[SEP] {
Keyword[return] identifier[add] operator[SEP] identifier[augend] operator[SEP] identifier[intCompact] , identifier[augend] operator[SEP] identifier[scale] , Keyword[this] operator[SEP] identifier[intVal] , Keyword[this] operator[SEP] identifier[scale] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[intVal] , Keyword[this] operator[SEP] identifier[scale] , identifier[augend] operator[SEP] identifier[intVal] , identifier[augend] operator[SEP] identifier[scale] operator[SEP] operator[SEP]
}
}
}
|
@Override
public boolean next() {
if (prodScan == null)
return false;
while (!prodScan.next())
if (!useNextChunk())
return false;
return true;
}
|
class class_name[name] begin[{]
method[next, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.prodScan], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
while[call[prodScan.next, parameter[]]] begin[{]
if[call[.useNextChunk, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
return[literal[true]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[next] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[prodScan] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[prodScan] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[useNextChunk] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public void close() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "close");
}
// Doing a channel.close() will actually put the keys associated with this
// channel
// into the associated selectors cancelledKey list, but they don't get
// removed until the
// next time the selector runs. In some cases, we need to make sure they are
// really gone before we
// we close the channel, because another thread may have requested another
// operation
// on the channel at the same time, which causes problems on some OS'es.
// So, cancel them manually and wait for the selector to run once before
// continuing
// call super.close() to see if we are using Regular Sockets, and if so, let
// the parent class handle closing the socket
super.close();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "SocketChannel closing, local: " + socket.getLocalSocketAddress() + " remote: " + socket.getRemoteSocketAddress());
}
// synchronize on this SocketIOChannel to prevent duplicate closes from
// being processed
synchronized (this) {
if (closed) {
processClose = false;
}
closed = true;
}
if (processClose) {
// checkCancel is only on if we need to manually cancel keys as
// the socket close() is supposed to do that for us
if (checkCancel) {
// Remove socket from current selectors.
if (channelSelectorRead != null) {
SelectionKey k = channelSelectorRead.getKey(channel);
if (k != null) {
CancelRequest cr = new CancelRequest(k);
synchronized (cr) {
channelSelectorRead.addCancelRequest(cr);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "waiting for read key to be canceled, key is " + k);
}
try {
cr.wait();
} catch (InterruptedException e) {
// No FFDC code needed
}
} // end-sync
}
}
if (channelSelectorWrite != null) {
SelectionKey k = channelSelectorWrite.getKey(channel);
if (k != null) {
CancelRequest cr = new CancelRequest(k);
synchronized (cr) {
channelSelectorWrite.addCancelRequest(cr);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "waiting for write key to be canceled, key is " + k);
}
try {
cr.wait();
} catch (InterruptedException e) {
// No FFDC code needed
}
} // end-sync
}
}
}
try {
if (channel != null) {
channel.close();
}
// need to make sure the keys get cancelled after the close call
if (channelSelectorRead != null) {
channelSelectorRead.wakeup();
channelSelectorRead = null;
}
if (channelSelectorWrite != null) {
channelSelectorWrite.wakeup();
channelSelectorWrite = null;
}
} catch (Throwable t) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Error closing channel: " + t);
}
// ignore all shutdown/close errors
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "close");
}
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["close"]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[THIS[], member[.tc], binary_operation[binary_operation[binary_operation[literal["SocketChannel closing, local: "], +, call[socket.getLocalSocketAddress, parameter[]]], +, literal[" remote: "]], +, call[socket.getRemoteSocketAddress, parameter[]]]]]
else begin[{]
None
end[}]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[member[.closed]] begin[{]
assign[member[.processClose], literal[false]]
else begin[{]
None
end[}]
assign[member[.closed], literal[true]]
END[}]
if[member[.processClose]] begin[{]
if[member[.checkCancel]] begin[{]
if[binary_operation[member[.channelSelectorRead], !=, literal[null]]] begin[{]
local_variable[type[SelectionKey], k]
if[binary_operation[member[.k], !=, literal[null]]] begin[{]
local_variable[type[CancelRequest], cr]
SYNCHRONIZED[member[.cr]] BEGIN[{]
call[channelSelectorRead.addCancelRequest, parameter[member[.cr]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[THIS[], member[.tc], binary_operation[literal["waiting for read key to be canceled, key is "], +, member[.k]]]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, postfix_operators=[], prefix_operators=[], qualifier=cr, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
END[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.channelSelectorWrite], !=, literal[null]]] begin[{]
local_variable[type[SelectionKey], k]
if[binary_operation[member[.k], !=, literal[null]]] begin[{]
local_variable[type[CancelRequest], cr]
SYNCHRONIZED[member[.cr]] BEGIN[{]
call[channelSelectorWrite.addCancelRequest, parameter[member[.cr]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[THIS[], member[.tc], binary_operation[literal["waiting for write key to be canceled, key is "], +, member[.k]]]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, postfix_operators=[], prefix_operators=[], qualifier=cr, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
END[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channelSelectorRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=wakeup, postfix_operators=[], prefix_operators=[], qualifier=channelSelectorRead, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channelSelectorRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channelSelectorWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=wakeup, postfix_operators=[], prefix_operators=[], qualifier=channelSelectorWrite, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channelSelectorWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error closing channel: "), operandr=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["close"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[event] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[socket] operator[SEP] identifier[getLocalSocketAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[socket] operator[SEP] identifier[getRemoteSocketAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[closed] operator[SEP] {
identifier[processClose] operator[=] literal[boolean] operator[SEP]
}
identifier[closed] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[processClose] operator[SEP] {
Keyword[if] operator[SEP] identifier[checkCancel] operator[SEP] {
Keyword[if] operator[SEP] identifier[channelSelectorRead] operator[!=] Other[null] operator[SEP] {
identifier[SelectionKey] identifier[k] operator[=] identifier[channelSelectorRead] operator[SEP] identifier[getKey] operator[SEP] identifier[channel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[k] operator[!=] Other[null] operator[SEP] {
identifier[CancelRequest] identifier[cr] operator[=] Keyword[new] identifier[CancelRequest] operator[SEP] identifier[k] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[cr] operator[SEP] {
identifier[channelSelectorRead] operator[SEP] identifier[addCancelRequest] operator[SEP] identifier[cr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[k] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[cr] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
}
}
}
Keyword[if] operator[SEP] identifier[channelSelectorWrite] operator[!=] Other[null] operator[SEP] {
identifier[SelectionKey] identifier[k] operator[=] identifier[channelSelectorWrite] operator[SEP] identifier[getKey] operator[SEP] identifier[channel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[k] operator[!=] Other[null] operator[SEP] {
identifier[CancelRequest] identifier[cr] operator[=] Keyword[new] identifier[CancelRequest] operator[SEP] identifier[k] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[cr] operator[SEP] {
identifier[channelSelectorWrite] operator[SEP] identifier[addCancelRequest] operator[SEP] identifier[cr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[k] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[cr] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
}
}
}
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[channel] operator[!=] Other[null] operator[SEP] {
identifier[channel] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[channelSelectorRead] operator[!=] Other[null] operator[SEP] {
identifier[channelSelectorRead] operator[SEP] identifier[wakeup] operator[SEP] operator[SEP] operator[SEP] identifier[channelSelectorRead] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[channelSelectorWrite] operator[!=] Other[null] operator[SEP] {
identifier[channelSelectorWrite] operator[SEP] identifier[wakeup] operator[SEP] operator[SEP] operator[SEP] identifier[channelSelectorWrite] operator[=] Other[null] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[t] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
}
|
public void marshall(NodeDetails nodeDetails, ProtocolMarshaller protocolMarshaller) {
if (nodeDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(nodeDetails.getNodeIndex(), NODEINDEX_BINDING);
protocolMarshaller.marshall(nodeDetails.getIsMainNode(), ISMAINNODE_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[nodeDetails, protocolMarshaller]] begin[{]
if[binary_operation[member[.nodeDetails], ==, 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=getNodeIndex, postfix_operators=[], prefix_operators=[], qualifier=nodeDetails, selectors=[], type_arguments=None), MemberReference(member=NODEINDEX_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=getIsMainNode, postfix_operators=[], prefix_operators=[], qualifier=nodeDetails, selectors=[], type_arguments=None), MemberReference(member=ISMAINNODE_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[NodeDetails] identifier[nodeDetails] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[nodeDetails] 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[nodeDetails] operator[SEP] identifier[getNodeIndex] operator[SEP] operator[SEP] , identifier[NODEINDEX_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[nodeDetails] operator[SEP] identifier[getIsMainNode] operator[SEP] operator[SEP] , identifier[ISMAINNODE_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 void marshall(StopContactRequest stopContactRequest, ProtocolMarshaller protocolMarshaller) {
if (stopContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopContactRequest.getContactId(), CONTACTID_BINDING);
protocolMarshaller.marshall(stopContactRequest.getInstanceId(), INSTANCEID_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[stopContactRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.stopContactRequest], ==, 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=getContactId, postfix_operators=[], prefix_operators=[], qualifier=stopContactRequest, selectors=[], type_arguments=None), MemberReference(member=CONTACTID_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=getInstanceId, postfix_operators=[], prefix_operators=[], qualifier=stopContactRequest, selectors=[], type_arguments=None), MemberReference(member=INSTANCEID_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[StopContactRequest] identifier[stopContactRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[stopContactRequest] 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[stopContactRequest] operator[SEP] identifier[getContactId] operator[SEP] operator[SEP] , identifier[CONTACTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[stopContactRequest] operator[SEP] identifier[getInstanceId] operator[SEP] operator[SEP] , identifier[INSTANCEID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public ContinueUpdateRollbackResult continueUpdateRollback(ContinueUpdateRollbackRequest request) {
request = beforeClientExecution(request);
return executeContinueUpdateRollback(request);
}
|
class class_name[name] begin[{]
method[continueUpdateRollback, return_type[type[ContinueUpdateRollbackResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeContinueUpdateRollback, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ContinueUpdateRollbackResult] identifier[continueUpdateRollback] operator[SEP] identifier[ContinueUpdateRollbackRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeContinueUpdateRollback] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static List<Tuple<String, List<Object>>> displayableConstraint(
Set<ConstraintDescriptor<?>> constraints, Annotation[] orderedAnnotations) {
final List<Annotation> constraintAnnot =
constraints.stream().map(c -> c.getAnnotation()).collect(Collectors.<Annotation>toList());
return Stream.of(orderedAnnotations)
.filter(
constraintAnnot
::contains) // only use annotations for which we actually have a constraint
.filter(a -> a.annotationType().isAnnotationPresent(Display.class))
.map(
a ->
displayableConstraint(
constraints
.parallelStream()
.filter(c -> c.getAnnotation().equals(a))
.findFirst()
.get()))
.collect(Collectors.toList());
}
|
class class_name[name] begin[{]
method[displayableConstraint, return_type[type[List]], modifier[public static], parameter[constraints, orderedAnnotations]] begin[{]
local_variable[type[List], constraintAnnot]
return[call[Stream.of, parameter[member[.orderedAnnotations]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Tuple] operator[<] identifier[String] , identifier[List] operator[<] identifier[Object] operator[>] operator[>] operator[>] identifier[displayableConstraint] operator[SEP] identifier[Set] operator[<] identifier[ConstraintDescriptor] operator[<] operator[?] operator[>] operator[>] identifier[constraints] , identifier[Annotation] operator[SEP] operator[SEP] identifier[orderedAnnotations] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[Annotation] operator[>] identifier[constraintAnnot] operator[=] identifier[constraints] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[c] operator[->] identifier[c] operator[SEP] identifier[getAnnotation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] operator[<] identifier[Annotation] operator[>] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Stream] operator[SEP] identifier[of] operator[SEP] identifier[orderedAnnotations] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[constraintAnnot] operator[::] identifier[contains] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[a] operator[->] identifier[a] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[isAnnotationPresent] operator[SEP] identifier[Display] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[a] operator[->] identifier[displayableConstraint] operator[SEP] identifier[constraints] operator[SEP] identifier[parallelStream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[c] operator[->] identifier[c] operator[SEP] identifier[getAnnotation] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[a] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void backtrack(final int newLevel) {
assert 0 <= newLevel && newLevel <= this.level;
if (newLevel == this.level) { return; }
CLFrame f = this.control.back();
while (f.level() > newLevel) {
assert f.level() == this.level;
assert f.trail() < this.trail.size();
while (f.trail() < this.trail.size()) {
final int lit = this.trail.back();
assert var(lit).level() == f.level();
this.trail.pop();
unassign(lit);
}
assert this.level > 0;
this.level--;
this.trail.shrinkTo(f.trail());
this.next = f.trail();
this.control.pop();
f = this.control.back();
}
assert newLevel == this.level;
}
|
class class_name[name] begin[{]
method[backtrack, return_type[void], modifier[protected], parameter[newLevel]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operandr=MemberReference(member=newLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=MemberReference(member=newLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=level, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<=), operator=&&), label=None, value=None)
if[binary_operation[member[.newLevel], ==, THIS[member[None.level]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[CLFrame], f]
while[binary_operation[call[f.level, parameter[]], >, member[.newLevel]]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=level, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=level, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator===), label=None, value=None)
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=trail, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=trail, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=<), label=None, value=None)
while[binary_operation[call[f.trail, parameter[]], <, THIS[member[None.trail]call[None.size, parameter[]]]]] begin[{]
local_variable[type[int], lit]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=lit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=level, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=level, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operator===), label=None, value=None)
THIS[member[None.trail]call[None.pop, parameter[]]]
call[.unassign, parameter[member[.lit]]]
end[}]
AssertStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=level, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), label=None, value=None)
THIS[member[None.level]]
THIS[member[None.trail]call[None.shrinkTo, parameter[call[f.trail, parameter[]]]]]
assign[THIS[member[None.next]], call[f.trail, parameter[]]]
THIS[member[None.control]call[None.pop, parameter[]]]
assign[member[.f], THIS[member[None.control]call[None.back, parameter[]]]]
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=newLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=level, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator===), label=None, value=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[backtrack] operator[SEP] Keyword[final] Keyword[int] identifier[newLevel] operator[SEP] {
Keyword[assert] Other[0] operator[<=] identifier[newLevel] operator[&&] identifier[newLevel] operator[<=] Keyword[this] operator[SEP] identifier[level] operator[SEP] Keyword[if] operator[SEP] identifier[newLevel] operator[==] Keyword[this] operator[SEP] identifier[level] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[CLFrame] identifier[f] operator[=] Keyword[this] operator[SEP] identifier[control] operator[SEP] identifier[back] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[f] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[>] identifier[newLevel] operator[SEP] {
Keyword[assert] identifier[f] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[==] Keyword[this] operator[SEP] identifier[level] operator[SEP] Keyword[assert] identifier[f] operator[SEP] identifier[trail] operator[SEP] operator[SEP] operator[<] Keyword[this] operator[SEP] identifier[trail] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[f] operator[SEP] identifier[trail] operator[SEP] operator[SEP] operator[<] Keyword[this] operator[SEP] identifier[trail] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[lit] operator[=] Keyword[this] operator[SEP] identifier[trail] operator[SEP] identifier[back] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[var] operator[SEP] identifier[lit] operator[SEP] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[==] identifier[f] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[trail] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] identifier[unassign] operator[SEP] identifier[lit] operator[SEP] operator[SEP]
}
Keyword[assert] Keyword[this] operator[SEP] identifier[level] operator[>] Other[0] operator[SEP] Keyword[this] operator[SEP] identifier[level] operator[--] operator[SEP] Keyword[this] operator[SEP] identifier[trail] operator[SEP] identifier[shrinkTo] operator[SEP] identifier[f] operator[SEP] identifier[trail] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[next] operator[=] identifier[f] operator[SEP] identifier[trail] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[control] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] identifier[f] operator[=] Keyword[this] operator[SEP] identifier[control] operator[SEP] identifier[back] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[assert] identifier[newLevel] operator[==] Keyword[this] operator[SEP] identifier[level] operator[SEP]
}
|
@CheckForNull
public static Executor of(Executable executable) {
Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance()
if (jenkins == null) {
return null;
}
for (Computer computer : jenkins.getComputers()) {
for (Executor executor : computer.getAllExecutors()) {
if (executor.getCurrentExecutable() == executable) {
return executor;
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[of, return_type[type[Executor]], modifier[public static], parameter[executable]] begin[{]
local_variable[type[Jenkins], jenkins]
if[binary_operation[member[.jenkins], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCurrentExecutable, postfix_operators=[], prefix_operators=[], qualifier=executor, selectors=[], type_arguments=None), operandr=MemberReference(member=executable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=executor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllExecutors, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=executor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Executor, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getComputers, postfix_operators=[], prefix_operators=[], qualifier=jenkins, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=computer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Computer, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[CheckForNull] Keyword[public] Keyword[static] identifier[Executor] identifier[of] operator[SEP] identifier[Executable] identifier[executable] operator[SEP] {
identifier[Jenkins] identifier[jenkins] operator[=] identifier[Jenkins] operator[SEP] identifier[getInstanceOrNull] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jenkins] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Computer] identifier[computer] operator[:] identifier[jenkins] operator[SEP] identifier[getComputers] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Executor] identifier[executor] operator[:] identifier[computer] operator[SEP] identifier[getAllExecutors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[executor] operator[SEP] identifier[getCurrentExecutable] operator[SEP] operator[SEP] operator[==] identifier[executable] operator[SEP] {
Keyword[return] identifier[executor] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static Timer timer(MetricLevel level, String name) {
return getMetricRegistry(level).timer(METRIC_PREFIX + name);
}
|
class class_name[name] begin[{]
method[timer, return_type[type[Timer]], modifier[public static], parameter[level, name]] begin[{]
return[call[.getMetricRegistry, parameter[member[.level]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Timer] identifier[timer] operator[SEP] identifier[MetricLevel] identifier[level] , identifier[String] identifier[name] operator[SEP] {
Keyword[return] identifier[getMetricRegistry] operator[SEP] identifier[level] operator[SEP] operator[SEP] identifier[timer] operator[SEP] identifier[METRIC_PREFIX] operator[+] identifier[name] operator[SEP] operator[SEP]
}
|
public static boolean isOurFormatId(int formatIdentifier) {
if (tc.isEntryEnabled())
Tr.entry(tc, "isOurFormatId", formatIdentifier);
final boolean result;
switch (formatIdentifier) { // Current format IDs
case ZOS_FID_CB390:
case ZOS_FID_CBLT:
case WAS_FID_WASD:
result = true;
break;
// Possible format IDs in the future
case WAS_FID_WASC:
case WAS_FID_WASZ:
case ZOS_FID_WASZ:
default:
result = false;
break;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "isOurFormatId", Boolean.valueOf(result));
return result;
}
|
class class_name[name] begin[{]
method[isOurFormatId, return_type[type[boolean]], modifier[public static], parameter[formatIdentifier]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.entry, parameter[member[.tc], literal["isOurFormatId"], member[.formatIdentifier]]]
else begin[{]
None
end[}]
local_variable[type[boolean], result]
SwitchStatement(cases=[SwitchStatementCase(case=['ZOS_FID_CB390', 'ZOS_FID_CBLT', 'WAS_FID_WASD'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, 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)]), SwitchStatementCase(case=['WAS_FID_WASC', 'WAS_FID_WASZ', 'ZOS_FID_WASZ'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=formatIdentifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["isOurFormatId"], call[Boolean.valueOf, parameter[member[.result]]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isOurFormatId] operator[SEP] Keyword[int] identifier[formatIdentifier] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[formatIdentifier] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[result] operator[SEP] Keyword[switch] operator[SEP] identifier[formatIdentifier] operator[SEP] {
Keyword[case] identifier[ZOS_FID_CB390] operator[:] Keyword[case] identifier[ZOS_FID_CBLT] operator[:] Keyword[case] identifier[WAS_FID_WASD] operator[:] identifier[result] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[WAS_FID_WASC] operator[:] Keyword[case] identifier[WAS_FID_WASZ] operator[:] Keyword[case] identifier[ZOS_FID_WASZ] operator[:] Keyword[default] operator[:] identifier[result] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public GroovyExpression optimize(GroovyExpression source) {
LOGGER.debug("Optimizing gremlin query: " + source);
OptimizationContext context = new OptimizationContext();
GroovyExpression updatedExpression = source;
for (GremlinOptimization opt : optimizations) {
updatedExpression = optimize(updatedExpression, opt, context);
LOGGER.debug("After "+ opt.getClass().getSimpleName() + ", query = " + updatedExpression);
}
StatementListExpression result = new StatementListExpression();
result.addStatements(context.getInitialStatements());
result.addStatement(updatedExpression);
LOGGER.debug("Final optimized query: " + result.toString());
return result;
}
|
class class_name[name] begin[{]
method[optimize, return_type[type[GroovyExpression]], modifier[public], parameter[source]] begin[{]
call[LOGGER.debug, parameter[binary_operation[literal["Optimizing gremlin query: "], +, member[.source]]]]
local_variable[type[OptimizationContext], context]
local_variable[type[GroovyExpression], updatedExpression]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=updatedExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=updatedExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=opt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=optimize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="After "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=opt, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", query = "), operator=+), operandr=MemberReference(member=updatedExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=optimizations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=opt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GremlinOptimization, sub_type=None))), label=None)
local_variable[type[StatementListExpression], result]
call[result.addStatements, parameter[call[context.getInitialStatements, parameter[]]]]
call[result.addStatement, parameter[member[.updatedExpression]]]
call[LOGGER.debug, parameter[binary_operation[literal["Final optimized query: "], +, call[result.toString, parameter[]]]]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[GroovyExpression] identifier[optimize] operator[SEP] identifier[GroovyExpression] identifier[source] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[source] operator[SEP] operator[SEP] identifier[OptimizationContext] identifier[context] operator[=] Keyword[new] identifier[OptimizationContext] operator[SEP] operator[SEP] operator[SEP] identifier[GroovyExpression] identifier[updatedExpression] operator[=] identifier[source] operator[SEP] Keyword[for] operator[SEP] identifier[GremlinOptimization] identifier[opt] operator[:] identifier[optimizations] operator[SEP] {
identifier[updatedExpression] operator[=] identifier[optimize] operator[SEP] identifier[updatedExpression] , identifier[opt] , identifier[context] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[opt] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[updatedExpression] operator[SEP] operator[SEP]
}
identifier[StatementListExpression] identifier[result] operator[=] Keyword[new] identifier[StatementListExpression] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addStatements] operator[SEP] identifier[context] operator[SEP] identifier[getInitialStatements] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addStatement] operator[SEP] identifier[updatedExpression] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void stopPondLife(int id)
{
PondLife pl = null;
synchronized(this)
{
pl=_pondLife[id];
if (pl!=null)
{
_pondLife[id]=null;
_index[--_size]=id;
if (_available>_size)
_available=_size;
}
}
if (pl!=null)
pl.leavePool();
}
|
class class_name[name] begin[{]
method[stopPondLife, return_type[void], modifier[private], parameter[id]] begin[{]
local_variable[type[PondLife], pl]
SYNCHRONIZED[THIS[]] BEGIN[{]
assign[member[.pl], member[._pondLife]]
if[binary_operation[member[.pl], !=, literal[null]]] begin[{]
assign[member[._pondLife], literal[null]]
assign[member[._index], member[.id]]
if[binary_operation[member[._available], >, member[._size]]] begin[{]
assign[member[._available], member[._size]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
END[}]
if[binary_operation[member[.pl], !=, literal[null]]] begin[{]
call[pl.leavePool, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[stopPondLife] operator[SEP] Keyword[int] identifier[id] operator[SEP] {
identifier[PondLife] identifier[pl] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[pl] operator[=] identifier[_pondLife] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pl] operator[!=] Other[null] operator[SEP] {
identifier[_pondLife] operator[SEP] identifier[id] operator[SEP] operator[=] Other[null] operator[SEP] identifier[_index] operator[SEP] operator[--] identifier[_size] operator[SEP] operator[=] identifier[id] operator[SEP] Keyword[if] operator[SEP] identifier[_available] operator[>] identifier[_size] operator[SEP] identifier[_available] operator[=] identifier[_size] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[pl] operator[!=] Other[null] operator[SEP] identifier[pl] operator[SEP] identifier[leavePool] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setDeviceEvents(java.util.Collection<DeviceEvent> deviceEvents) {
if (deviceEvents == null) {
this.deviceEvents = null;
return;
}
this.deviceEvents = new java.util.ArrayList<DeviceEvent>(deviceEvents);
}
|
class class_name[name] begin[{]
method[setDeviceEvents, return_type[void], modifier[public], parameter[deviceEvents]] begin[{]
if[binary_operation[member[.deviceEvents], ==, literal[null]]] begin[{]
assign[THIS[member[None.deviceEvents]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.deviceEvents]], ClassCreator(arguments=[MemberReference(member=deviceEvents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DeviceEvent, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setDeviceEvents] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[DeviceEvent] operator[>] identifier[deviceEvents] operator[SEP] {
Keyword[if] operator[SEP] identifier[deviceEvents] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[deviceEvents] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[deviceEvents] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[DeviceEvent] operator[>] operator[SEP] identifier[deviceEvents] operator[SEP] operator[SEP]
}
|
protected ParameterOccurs parseParameterOccurs(Tag[] tags) {
for (int i = 0; i < tags.length; i++) {
if (("@" + WROccursTaglet.NAME).equalsIgnoreCase(tags[i].name())) {
if (WROccursTaglet.REQUIRED.equalsIgnoreCase(tags[i].text())) {
return ParameterOccurs.REQUIRED;
} else if (WROccursTaglet.OPTIONAL.equalsIgnoreCase(tags[i].text())) {
return ParameterOccurs.OPTIONAL;
} else if (WROccursTaglet.DEPENDS.equalsIgnoreCase(tags[i].text())) {
return ParameterOccurs.DEPENDS;
} else {
this.logger.warn("Unexpected WROccursTaglet: " + tags[i].text());
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[parseParameterOccurs, return_type[type[ParameterOccurs]], modifier[protected], parameter[tags]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="@"), operandr=MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=WROccursTaglet, selectors=[]), operator=+), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=text, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=WROccursTaglet.REQUIRED, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=text, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=WROccursTaglet.OPTIONAL, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=text, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=WROccursTaglet.DEPENDS, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected WROccursTaglet: "), operandr=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=text, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+)], member=warn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=DEPENDS, postfix_operators=[], prefix_operators=[], qualifier=ParameterOccurs, selectors=[]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=OPTIONAL, postfix_operators=[], prefix_operators=[], qualifier=ParameterOccurs, selectors=[]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=REQUIRED, postfix_operators=[], prefix_operators=[], qualifier=ParameterOccurs, selectors=[]), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[protected] identifier[ParameterOccurs] identifier[parseParameterOccurs] operator[SEP] identifier[Tag] operator[SEP] operator[SEP] identifier[tags] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[tags] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] literal[String] operator[+] identifier[WROccursTaglet] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[tags] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[WROccursTaglet] operator[SEP] identifier[REQUIRED] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[tags] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParameterOccurs] operator[SEP] identifier[REQUIRED] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[WROccursTaglet] operator[SEP] identifier[OPTIONAL] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[tags] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParameterOccurs] operator[SEP] identifier[OPTIONAL] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[WROccursTaglet] operator[SEP] identifier[DEPENDS] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[tags] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParameterOccurs] operator[SEP] identifier[DEPENDS] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[tags] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public EClass getFND() {
if (fndEClass == null) {
fndEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(263);
}
return fndEClass;
}
|
class class_name[name] begin[{]
method[getFND, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.fndEClass], ==, literal[null]]] begin[{]
assign[member[.fndEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=263)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.fndEClass]]
end[}]
END[}]
|
Keyword[public] identifier[EClass] identifier[getFND] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fndEClass] operator[==] Other[null] operator[SEP] {
identifier[fndEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[263] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fndEClass] operator[SEP]
}
|
public static String convertTabsToSpaces(final String line, final int tabWidth) {
int tab_index, tab_size;
int last_tab_index = 0;
int added_chars = 0;
if (tabWidth == 0) {
return StringUtil.remove(line, '\t');
}
StringBuilder result = new StringBuilder();
while ((tab_index = line.indexOf('\t', last_tab_index)) != -1) {
tab_size = tabWidth - ((tab_index + added_chars) % tabWidth);
if (tab_size == 0) {
tab_size = tabWidth;
}
added_chars += tab_size - 1;
result.append(line, last_tab_index, tab_index);
result.append(StringUtil.repeat(' ', tab_size));
last_tab_index = tab_index+1;
}
if (last_tab_index == 0) {
return line;
}
result.append(line.substring(last_tab_index));
return result.toString();
}
|
class class_name[name] begin[{]
method[convertTabsToSpaces, return_type[type[String]], modifier[public static], parameter[line, tabWidth]] begin[{]
local_variable[type[int], tab_index]
local_variable[type[int], last_tab_index]
local_variable[type[int], added_chars]
if[binary_operation[member[.tabWidth], ==, literal[0]]] begin[{]
return[call[StringUtil.remove, parameter[member[.line], literal['\t']]]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], result]
while[binary_operation[assign[member[.tab_index], call[line.indexOf, parameter[literal['\t'], member[.last_tab_index]]]], !=, literal[1]]] begin[{]
assign[member[.tab_size], binary_operation[member[.tabWidth], -, binary_operation[binary_operation[member[.tab_index], +, member[.added_chars]], %, member[.tabWidth]]]]
if[binary_operation[member[.tab_size], ==, literal[0]]] begin[{]
assign[member[.tab_size], member[.tabWidth]]
else begin[{]
None
end[}]
assign[member[.added_chars], binary_operation[member[.tab_size], -, literal[1]]]
call[result.append, parameter[member[.line], member[.last_tab_index], member[.tab_index]]]
call[result.append, parameter[call[StringUtil.repeat, parameter[literal[' '], member[.tab_size]]]]]
assign[member[.last_tab_index], binary_operation[member[.tab_index], +, literal[1]]]
end[}]
if[binary_operation[member[.last_tab_index], ==, literal[0]]] begin[{]
return[member[.line]]
else begin[{]
None
end[}]
call[result.append, parameter[call[line.substring, parameter[member[.last_tab_index]]]]]
return[call[result.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[convertTabsToSpaces] operator[SEP] Keyword[final] identifier[String] identifier[line] , Keyword[final] Keyword[int] identifier[tabWidth] operator[SEP] {
Keyword[int] identifier[tab_index] , identifier[tab_size] operator[SEP] Keyword[int] identifier[last_tab_index] operator[=] Other[0] operator[SEP] Keyword[int] identifier[added_chars] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[tabWidth] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[StringUtil] operator[SEP] identifier[remove] operator[SEP] identifier[line] , literal[String] operator[SEP] operator[SEP]
}
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[tab_index] operator[=] identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[last_tab_index] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[tab_size] operator[=] identifier[tabWidth] operator[-] operator[SEP] operator[SEP] identifier[tab_index] operator[+] identifier[added_chars] operator[SEP] operator[%] identifier[tabWidth] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tab_size] operator[==] Other[0] operator[SEP] {
identifier[tab_size] operator[=] identifier[tabWidth] operator[SEP]
}
identifier[added_chars] operator[+=] identifier[tab_size] operator[-] Other[1] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[line] , identifier[last_tab_index] , identifier[tab_index] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[StringUtil] operator[SEP] identifier[repeat] operator[SEP] literal[String] , identifier[tab_size] operator[SEP] operator[SEP] operator[SEP] identifier[last_tab_index] operator[=] identifier[tab_index] operator[+] Other[1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[last_tab_index] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[line] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[last_tab_index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<IntegrationAccountCertificateInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String certificateName, IntegrationAccountCertificateInner certificate) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName, certificate).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() {
@Override
public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, integrationAccountName, certificateName, certificate]] begin[{]
return[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.integrationAccountName], member[.certificateName], member[.certificate]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[IntegrationAccountCertificateInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[integrationAccountName] , identifier[String] identifier[certificateName] , identifier[IntegrationAccountCertificateInner] identifier[certificate] operator[SEP] {
Keyword[return] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[integrationAccountName] , identifier[certificateName] , identifier[certificate] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[IntegrationAccountCertificateInner] operator[>] , identifier[IntegrationAccountCertificateInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[IntegrationAccountCertificateInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[IntegrationAccountCertificateInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
private String getSignature(String str) {
try {
MessageDigest md = MessageDigest.getInstance(SHA_STRING);
md.update(str.getBytes());
md.update(secretBytes);
byte[] digest = md.digest();
return new Base64(0).encodeToString(digest);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException("Invalid SHA digest String: " + SHA_STRING +
" " + ex.getMessage(), ex);
}
}
|
class class_name[name] begin[{]
method[getSignature, return_type[type[String]], modifier[private], parameter[str]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=SHA_STRING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=MessageDigest, selectors=[], type_arguments=None), name=md)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MessageDigest, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], member=update, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=secretBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=digest, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None), name=digest)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeToString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Base64, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid SHA digest String: "), operandr=MemberReference(member=SHA_STRING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NoSuchAlgorithmException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[getSignature] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[try] {
identifier[MessageDigest] identifier[md] operator[=] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] identifier[SHA_STRING] operator[SEP] operator[SEP] identifier[md] operator[SEP] identifier[update] operator[SEP] identifier[str] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[md] operator[SEP] identifier[update] operator[SEP] identifier[secretBytes] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[digest] operator[=] identifier[md] operator[SEP] identifier[digest] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Base64] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[encodeToString] operator[SEP] identifier[digest] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[SHA_STRING] operator[+] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
public InputStream getAttachment(String docId, String attachmentName, String revId) {
return db.getAttachment(docId, attachmentName, revId);
}
|
class class_name[name] begin[{]
method[getAttachment, return_type[type[InputStream]], modifier[public], parameter[docId, attachmentName, revId]] begin[{]
return[call[db.getAttachment, parameter[member[.docId], member[.attachmentName], member[.revId]]]]
end[}]
END[}]
|
Keyword[public] identifier[InputStream] identifier[getAttachment] operator[SEP] identifier[String] identifier[docId] , identifier[String] identifier[attachmentName] , identifier[String] identifier[revId] operator[SEP] {
Keyword[return] identifier[db] operator[SEP] identifier[getAttachment] operator[SEP] identifier[docId] , identifier[attachmentName] , identifier[revId] operator[SEP] operator[SEP]
}
|
@RequestMapping(method = RequestMethod.DELETE, value = "/clearUser")
public ResponseEntity<Void> deleteUser() {
ConfigurationHandler response = configurationHandlerService.getConfigForDeleteUser();
return new ResponseEntity<>(HttpStatus.valueOf(response.getResult()));
}
|
class class_name[name] begin[{]
method[deleteUser, return_type[type[ResponseEntity]], modifier[public], parameter[]] begin[{]
local_variable[type[ConfigurationHandler], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ResponseEntity, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[RequestMapping] operator[SEP] identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[DELETE] , identifier[value] operator[=] literal[String] operator[SEP] Keyword[public] identifier[ResponseEntity] operator[<] identifier[Void] operator[>] identifier[deleteUser] operator[SEP] operator[SEP] {
identifier[ConfigurationHandler] identifier[response] operator[=] identifier[configurationHandlerService] operator[SEP] identifier[getConfigForDeleteUser] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ResponseEntity] operator[<] operator[>] operator[SEP] identifier[HttpStatus] operator[SEP] identifier[valueOf] operator[SEP] identifier[response] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CounterType decodeType(byte flags) {
switch (flags & 0x03) {
case WEAK_COUNTER:
return CounterType.WEAK;
case BOUNDED_COUNTER:
return CounterType.BOUNDED_STRONG;
case UNBOUNDED_COUNTER:
return CounterType.UNBOUNDED_STRONG;
default:
throw log.invalidCounterTypeEncoded();
}
}
|
class class_name[name] begin[{]
method[decodeType, return_type[type[CounterType]], modifier[public static], parameter[flags]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['WEAK_COUNTER'], statements=[ReturnStatement(expression=MemberReference(member=WEAK, postfix_operators=[], prefix_operators=[], qualifier=CounterType, selectors=[]), label=None)]), SwitchStatementCase(case=['BOUNDED_COUNTER'], statements=[ReturnStatement(expression=MemberReference(member=BOUNDED_STRONG, postfix_operators=[], prefix_operators=[], qualifier=CounterType, selectors=[]), label=None)]), SwitchStatementCase(case=['UNBOUNDED_COUNTER'], statements=[ReturnStatement(expression=MemberReference(member=UNBOUNDED_STRONG, postfix_operators=[], prefix_operators=[], qualifier=CounterType, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=MethodInvocation(arguments=[], member=invalidCounterTypeEncoded, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])], expression=BinaryOperation(operandl=MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x03), operator=&), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CounterType] identifier[decodeType] operator[SEP] Keyword[byte] identifier[flags] operator[SEP] {
Keyword[switch] operator[SEP] identifier[flags] operator[&] literal[Integer] operator[SEP] {
Keyword[case] identifier[WEAK_COUNTER] operator[:] Keyword[return] identifier[CounterType] operator[SEP] identifier[WEAK] operator[SEP] Keyword[case] identifier[BOUNDED_COUNTER] operator[:] Keyword[return] identifier[CounterType] operator[SEP] identifier[BOUNDED_STRONG] operator[SEP] Keyword[case] identifier[UNBOUNDED_COUNTER] operator[:] Keyword[return] identifier[CounterType] operator[SEP] identifier[UNBOUNDED_STRONG] operator[SEP] Keyword[default] operator[:] Keyword[throw] identifier[log] operator[SEP] identifier[invalidCounterTypeEncoded] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void _advance(int count) {
if (buf != null) {
bufPos += count;
if (bufPos == buf.length) {
buf = null;
}
} else {
pos.setIndex(pos.getIndex() + count);
if (pos.getIndex() > text.length()) {
pos.setIndex(text.length());
}
}
}
|
class class_name[name] begin[{]
method[_advance, return_type[void], modifier[private], parameter[count]] begin[{]
if[binary_operation[member[.buf], !=, literal[null]]] begin[{]
assign[member[.bufPos], member[.count]]
if[binary_operation[member[.bufPos], ==, member[buf.length]]] begin[{]
assign[member[.buf], literal[null]]
else begin[{]
None
end[}]
else begin[{]
call[pos.setIndex, parameter[binary_operation[call[pos.getIndex, parameter[]], +, member[.count]]]]
if[binary_operation[call[pos.getIndex, parameter[]], >, call[text.length, parameter[]]]] begin[{]
call[pos.setIndex, parameter[call[text.length, parameter[]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[_advance] operator[SEP] Keyword[int] identifier[count] operator[SEP] {
Keyword[if] operator[SEP] identifier[buf] operator[!=] Other[null] operator[SEP] {
identifier[bufPos] operator[+=] identifier[count] operator[SEP] Keyword[if] operator[SEP] identifier[bufPos] operator[==] identifier[buf] operator[SEP] identifier[length] operator[SEP] {
identifier[buf] operator[=] Other[null] operator[SEP]
}
}
Keyword[else] {
identifier[pos] operator[SEP] identifier[setIndex] operator[SEP] identifier[pos] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[+] identifier[count] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[>] identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[pos] operator[SEP] identifier[setIndex] operator[SEP] identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static ContentData create(@NonNull File data, @NonNull String type, @Nullable String name) {
return new ContentData(RequestBody.create(MediaType.parse(type), data), TextUtils.isEmpty(name) ? data.getName() : name);
}
|
class class_name[name] begin[{]
method[create, return_type[type[ContentData]], modifier[public static], parameter[data, type, name]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[], type_arguments=None), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=RequestBody, selectors=[], type_arguments=None), TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=TextUtils, selectors=[], type_arguments=None), if_false=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ContentData, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ContentData] identifier[create] operator[SEP] annotation[@] identifier[NonNull] identifier[File] identifier[data] , annotation[@] identifier[NonNull] identifier[String] identifier[type] , annotation[@] identifier[Nullable] identifier[String] identifier[name] operator[SEP] {
Keyword[return] Keyword[new] identifier[ContentData] operator[SEP] identifier[RequestBody] operator[SEP] identifier[create] operator[SEP] identifier[MediaType] operator[SEP] identifier[parse] operator[SEP] identifier[type] operator[SEP] , identifier[data] operator[SEP] , identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[name] operator[SEP] operator[?] identifier[data] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[:] identifier[name] operator[SEP] operator[SEP]
}
|
private Word<I> prepareSplit(AbstractBaseDTNode<I, D> node, Splitter<I, D> splitter) {
int symbolIdx = splitter.symbolIdx;
I symbol = alphabet.getSymbol(symbolIdx);
Word<I> discriminator = splitter.getDiscriminator().prepend(symbol);
Deque<AbstractBaseDTNode<I, D>> dfsStack = new ArrayDeque<>();
AbstractBaseDTNode<I, D> succSeparator = splitter.succSeparator;
dfsStack.push(node);
assert node.getSplitData() == null;
while (!dfsStack.isEmpty()) {
AbstractBaseDTNode<I, D> curr = dfsStack.pop();
assert curr.getSplitData() == null;
curr.setSplitData(new SplitData<>(IncomingList::new));
for (TTTTransition<I, D> trans : curr.getIncoming()) {
D outcome = query(trans, discriminator);
curr.getSplitData().getIncoming(outcome).insertIncoming(trans);
markAndPropagate(curr, outcome);
}
if (curr.isInner()) {
for (AbstractBaseDTNode<I, D> child : curr.getChildren()) {
dfsStack.push(child);
}
} else {
TTTState<I, D> state = curr.getData();
assert state != null;
TTTTransition<I, D> trans = state.getTransition(symbolIdx);
D outcome = predictSuccOutcome(trans, succSeparator);
assert outcome != null;
curr.getSplitData().setStateLabel(outcome);
markAndPropagate(curr, outcome);
}
}
return discriminator;
}
|
class class_name[name] begin[{]
method[prepareSplit, return_type[type[Word]], modifier[private], parameter[node, splitter]] begin[{]
local_variable[type[int], symbolIdx]
local_variable[type[I], symbol]
local_variable[type[Word], discriminator]
local_variable[type[Deque], dfsStack]
local_variable[type[AbstractBaseDTNode], succSeparator]
call[dfsStack.push, parameter[member[.node]]]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSplitData, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), label=None, value=None)
while[call[dfsStack.isEmpty, parameter[]]] begin[{]
local_variable[type[AbstractBaseDTNode], curr]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSplitData, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), label=None, value=None)
call[curr.setSplitData, parameter[ClassCreator(arguments=[MethodReference(expression=MemberReference(member=IncomingList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=new, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), type_arguments=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=SplitData, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=trans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=discriminator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=outcome)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=D, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getSplitData, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[MethodInvocation(arguments=[MemberReference(member=outcome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIncoming, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=trans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insertIncoming, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=curr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outcome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=markAndPropagate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getIncoming, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=trans)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=I, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=D, sub_type=None))], dimensions=[], name=TTTTransition, sub_type=None))), label=None)
if[call[curr.isInner, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=push, postfix_operators=[], prefix_operators=[], qualifier=dfsStack, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=I, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=D, sub_type=None))], dimensions=[], name=AbstractBaseDTNode, sub_type=None))), label=None)
else begin[{]
local_variable[type[TTTState], state]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
local_variable[type[TTTTransition], trans]
local_variable[type[D], outcome]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=outcome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
call[curr.getSplitData, parameter[]]
call[.markAndPropagate, parameter[member[.curr], member[.outcome]]]
end[}]
end[}]
return[member[.discriminator]]
end[}]
END[}]
|
Keyword[private] identifier[Word] operator[<] identifier[I] operator[>] identifier[prepareSplit] operator[SEP] identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] identifier[node] , identifier[Splitter] operator[<] identifier[I] , identifier[D] operator[>] identifier[splitter] operator[SEP] {
Keyword[int] identifier[symbolIdx] operator[=] identifier[splitter] operator[SEP] identifier[symbolIdx] operator[SEP] identifier[I] identifier[symbol] operator[=] identifier[alphabet] operator[SEP] identifier[getSymbol] operator[SEP] identifier[symbolIdx] operator[SEP] operator[SEP] identifier[Word] operator[<] identifier[I] operator[>] identifier[discriminator] operator[=] identifier[splitter] operator[SEP] identifier[getDiscriminator] operator[SEP] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[symbol] operator[SEP] operator[SEP] identifier[Deque] operator[<] identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] operator[>] identifier[dfsStack] operator[=] Keyword[new] identifier[ArrayDeque] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] identifier[succSeparator] operator[=] identifier[splitter] operator[SEP] identifier[succSeparator] operator[SEP] identifier[dfsStack] operator[SEP] identifier[push] operator[SEP] identifier[node] operator[SEP] operator[SEP] Keyword[assert] identifier[node] operator[SEP] identifier[getSplitData] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[dfsStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] identifier[curr] operator[=] identifier[dfsStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[curr] operator[SEP] identifier[getSplitData] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] identifier[curr] operator[SEP] identifier[setSplitData] operator[SEP] Keyword[new] identifier[SplitData] operator[<] operator[>] operator[SEP] identifier[IncomingList] operator[::] Keyword[new] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TTTTransition] operator[<] identifier[I] , identifier[D] operator[>] identifier[trans] operator[:] identifier[curr] operator[SEP] identifier[getIncoming] operator[SEP] operator[SEP] operator[SEP] {
identifier[D] identifier[outcome] operator[=] identifier[query] operator[SEP] identifier[trans] , identifier[discriminator] operator[SEP] operator[SEP] identifier[curr] operator[SEP] identifier[getSplitData] operator[SEP] operator[SEP] operator[SEP] identifier[getIncoming] operator[SEP] identifier[outcome] operator[SEP] operator[SEP] identifier[insertIncoming] operator[SEP] identifier[trans] operator[SEP] operator[SEP] identifier[markAndPropagate] operator[SEP] identifier[curr] , identifier[outcome] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[curr] operator[SEP] identifier[isInner] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] identifier[child] operator[:] identifier[curr] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
identifier[dfsStack] operator[SEP] identifier[push] operator[SEP] identifier[child] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[TTTState] operator[<] identifier[I] , identifier[D] operator[>] identifier[state] operator[=] identifier[curr] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[state] operator[!=] Other[null] operator[SEP] identifier[TTTTransition] operator[<] identifier[I] , identifier[D] operator[>] identifier[trans] operator[=] identifier[state] operator[SEP] identifier[getTransition] operator[SEP] identifier[symbolIdx] operator[SEP] operator[SEP] identifier[D] identifier[outcome] operator[=] identifier[predictSuccOutcome] operator[SEP] identifier[trans] , identifier[succSeparator] operator[SEP] operator[SEP] Keyword[assert] identifier[outcome] operator[!=] Other[null] operator[SEP] identifier[curr] operator[SEP] identifier[getSplitData] operator[SEP] operator[SEP] operator[SEP] identifier[setStateLabel] operator[SEP] identifier[outcome] operator[SEP] operator[SEP] identifier[markAndPropagate] operator[SEP] identifier[curr] , identifier[outcome] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[discriminator] operator[SEP]
}
|
public OvhTask serviceName_partition_partitionName_quota_uid_DELETE(String serviceName, String partitionName, Long uid) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota/{uid}";
StringBuilder sb = path(qPath, serviceName, partitionName, uid);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTask.class);
}
|
class class_name[name] begin[{]
method[serviceName_partition_partitionName_quota_uid_DELETE, return_type[type[OvhTask]], modifier[public], parameter[serviceName, partitionName, uid]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhTask, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[OvhTask] identifier[serviceName_partition_partitionName_quota_uid_DELETE] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[partitionName] , identifier[Long] identifier[uid] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[partitionName] , identifier[uid] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhTask] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public JSONObject addApiKey(List<String> acls) throws AlgoliaException {
return addApiKey(acls, 0, 0, 0, null, RequestOptions.empty);
}
|
class class_name[name] begin[{]
method[addApiKey, return_type[type[JSONObject]], modifier[public], parameter[acls]] begin[{]
return[call[.addApiKey, parameter[member[.acls], literal[0], literal[0], literal[0], literal[null], member[RequestOptions.empty]]]]
end[}]
END[}]
|
Keyword[public] identifier[JSONObject] identifier[addApiKey] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[acls] operator[SEP] Keyword[throws] identifier[AlgoliaException] {
Keyword[return] identifier[addApiKey] operator[SEP] identifier[acls] , Other[0] , Other[0] , Other[0] , Other[null] , identifier[RequestOptions] operator[SEP] identifier[empty] operator[SEP] operator[SEP]
}
|
public JcString trimLeft() {
JcString ret = new JcString(null, this,
new FunctionInstance(FUNCTION.String.LTRIM, 1));
QueryRecorder.recordInvocationConditional(this, "trimLeft", ret);
return ret;
}
|
class class_name[name] begin[{]
method[trimLeft, return_type[type[JcString]], modifier[public], parameter[]] begin[{]
local_variable[type[JcString], ret]
call[QueryRecorder.recordInvocationConditional, parameter[THIS[], literal["trimLeft"], member[.ret]]]
return[member[.ret]]
end[}]
END[}]
|
Keyword[public] identifier[JcString] identifier[trimLeft] operator[SEP] operator[SEP] {
identifier[JcString] identifier[ret] operator[=] Keyword[new] identifier[JcString] operator[SEP] Other[null] , Keyword[this] , Keyword[new] identifier[FunctionInstance] operator[SEP] identifier[FUNCTION] operator[SEP] identifier[String] operator[SEP] identifier[LTRIM] , Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[QueryRecorder] operator[SEP] identifier[recordInvocationConditional] operator[SEP] Keyword[this] , literal[String] , identifier[ret] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public Vector2f sub(float x, float y, Vector2f dest) {
dest.x = this.x - x;
dest.y = this.y - y;
return dest;
}
|
class class_name[name] begin[{]
method[sub, return_type[type[Vector2f]], modifier[public], parameter[x, y, dest]] begin[{]
assign[member[dest.x], binary_operation[THIS[member[None.x]], -, member[.x]]]
assign[member[dest.y], binary_operation[THIS[member[None.y]], -, member[.y]]]
return[member[.dest]]
end[}]
END[}]
|
Keyword[public] identifier[Vector2f] identifier[sub] operator[SEP] Keyword[float] identifier[x] , Keyword[float] identifier[y] , identifier[Vector2f] identifier[dest] operator[SEP] {
identifier[dest] operator[SEP] identifier[x] operator[=] Keyword[this] operator[SEP] identifier[x] operator[-] identifier[x] operator[SEP] identifier[dest] operator[SEP] identifier[y] operator[=] Keyword[this] operator[SEP] identifier[y] operator[-] identifier[y] operator[SEP] Keyword[return] identifier[dest] operator[SEP]
}
|
public void insert(Statement stmt, KeyQualifier keyQualifier, List<Bin> bins, int ttl) {
Key key = keyQualifier.makeKey(stmt.getNamespace(), stmt.getSetName());
// Key key = new Key(stmt.getNamespace(), stmt.getSetName(), keyQualifier.getValue1());
this.client.put(this.insertPolicy, key, bins.toArray(new Bin[0]));
}
|
class class_name[name] begin[{]
method[insert, return_type[void], modifier[public], parameter[stmt, keyQualifier, bins, ttl]] begin[{]
local_variable[type[Key], key]
THIS[member[None.client]call[None.put, parameter[THIS[member[None.insertPolicy]], member[.key], call[bins.toArray, parameter[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Bin, sub_type=None))]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[insert] operator[SEP] identifier[Statement] identifier[stmt] , identifier[KeyQualifier] identifier[keyQualifier] , identifier[List] operator[<] identifier[Bin] operator[>] identifier[bins] , Keyword[int] identifier[ttl] operator[SEP] {
identifier[Key] identifier[key] operator[=] identifier[keyQualifier] operator[SEP] identifier[makeKey] operator[SEP] identifier[stmt] operator[SEP] identifier[getNamespace] operator[SEP] operator[SEP] , identifier[stmt] operator[SEP] identifier[getSetName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[put] operator[SEP] Keyword[this] operator[SEP] identifier[insertPolicy] , identifier[key] , identifier[bins] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Bin] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public FieldDefinition getShardingField() {
if (!isSharded()) {
return null;
}
String shardingFieldNme = getOption(CommonDefs.OPT_SHARDING_FIELD);
if (shardingFieldNme == null) {
return null;
}
return getFieldDef(shardingFieldNme); // may return null
}
|
class class_name[name] begin[{]
method[getShardingField, return_type[type[FieldDefinition]], modifier[public], parameter[]] begin[{]
if[call[.isSharded, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], shardingFieldNme]
if[binary_operation[member[.shardingFieldNme], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.getFieldDef, parameter[member[.shardingFieldNme]]]]
end[}]
END[}]
|
Keyword[public] identifier[FieldDefinition] identifier[getShardingField] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isSharded] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[shardingFieldNme] operator[=] identifier[getOption] operator[SEP] identifier[CommonDefs] operator[SEP] identifier[OPT_SHARDING_FIELD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shardingFieldNme] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[getFieldDef] operator[SEP] identifier[shardingFieldNme] operator[SEP] operator[SEP]
}
|
public String convertIfcReinforcingMeshTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
|
class class_name[name] begin[{]
method[convertIfcReinforcingMeshTypeEnumToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[convertIfcReinforcingMeshTypeEnumToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) {
filename = getEncodingFileName(filename);
if (contentType != null) {
res.setContentType(contentType);
} else {
res.setContentType("applicaiton/download;charset=utf-8");
}
res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";");
res.setHeader("Content-Transfer-Encoding", "binary");
res.setHeader("file-name", filename);
}
|
class class_name[name] begin[{]
method[initFileSendHeader, return_type[void], modifier[public static], parameter[res, filename, contentType]] begin[{]
assign[member[.filename], call[.getEncodingFileName, parameter[member[.filename]]]]
if[binary_operation[member[.contentType], !=, literal[null]]] begin[{]
call[res.setContentType, parameter[member[.contentType]]]
else begin[{]
call[res.setContentType, parameter[literal["applicaiton/download;charset=utf-8"]]]
end[}]
call[res.setHeader, parameter[literal["Content-Disposition"], binary_operation[binary_operation[literal["attachment; filename=\""], +, member[.filename]], +, literal["\";"]]]]
call[res.setHeader, parameter[literal["Content-Transfer-Encoding"], literal["binary"]]]
call[res.setHeader, parameter[literal["file-name"], member[.filename]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[initFileSendHeader] operator[SEP] identifier[HttpServletResponse] identifier[res] , identifier[String] identifier[filename] , identifier[String] identifier[contentType] operator[SEP] {
identifier[filename] operator[=] identifier[getEncodingFileName] operator[SEP] identifier[filename] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[contentType] operator[!=] Other[null] operator[SEP] {
identifier[res] operator[SEP] identifier[setContentType] operator[SEP] identifier[contentType] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[res] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[res] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , literal[String] operator[+] identifier[filename] operator[+] literal[String] operator[SEP] operator[SEP] identifier[res] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[res] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , identifier[filename] operator[SEP] operator[SEP]
}
|
@Override
public MtasSpanQuery rewrite(IndexReader reader) throws IOException {
MtasSpanQuery newQ1 = (MtasSpanQuery) q1.rewrite(reader);
MtasSpanQuery newQ2 = (MtasSpanQuery) q2.rewrite(reader);
if (!newQ1.equals(q1) || !newQ2.equals(q2)) {
return new MtasSpanIntersectingQuery(newQ1, newQ2).rewrite(reader);
} else if (newQ1.equals(newQ2)) {
return newQ1;
} else {
boolean returnNone;
returnNone = newQ1.getMaximumWidth() != null
&& newQ1.getMaximumWidth() == 0;
returnNone |= newQ2.getMaximumWidth() != null
&& newQ2.getMaximumWidth() == 0;
if (returnNone) {
return new MtasSpanMatchNoneQuery(this.getField());
} else {
return super.rewrite(reader);
}
}
}
|
class class_name[name] begin[{]
method[rewrite, return_type[type[MtasSpanQuery]], modifier[public], parameter[reader]] begin[{]
local_variable[type[MtasSpanQuery], newQ1]
local_variable[type[MtasSpanQuery], newQ2]
if[binary_operation[call[newQ1.equals, parameter[member[.q1]]], ||, call[newQ2.equals, parameter[member[.q2]]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=newQ1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newQ2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rewrite, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=MtasSpanIntersectingQuery, sub_type=None))]
else begin[{]
if[call[newQ1.equals, parameter[member[.newQ2]]]] begin[{]
return[member[.newQ1]]
else begin[{]
local_variable[type[boolean], returnNone]
assign[member[.returnNone], binary_operation[binary_operation[call[newQ1.getMaximumWidth, parameter[]], !=, literal[null]], &&, binary_operation[call[newQ1.getMaximumWidth, parameter[]], ==, literal[0]]]]
assign[member[.returnNone], binary_operation[binary_operation[call[newQ2.getMaximumWidth, parameter[]], !=, literal[null]], &&, binary_operation[call[newQ2.getMaximumWidth, parameter[]], ==, literal[0]]]]
if[member[.returnNone]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MtasSpanMatchNoneQuery, sub_type=None))]
else begin[{]
return[SuperMethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rewrite, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[MtasSpanQuery] identifier[rewrite] operator[SEP] identifier[IndexReader] identifier[reader] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[MtasSpanQuery] identifier[newQ1] operator[=] operator[SEP] identifier[MtasSpanQuery] operator[SEP] identifier[q1] operator[SEP] identifier[rewrite] operator[SEP] identifier[reader] operator[SEP] operator[SEP] identifier[MtasSpanQuery] identifier[newQ2] operator[=] operator[SEP] identifier[MtasSpanQuery] operator[SEP] identifier[q2] operator[SEP] identifier[rewrite] operator[SEP] identifier[reader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[newQ1] operator[SEP] identifier[equals] operator[SEP] identifier[q1] operator[SEP] operator[||] operator[!] identifier[newQ2] operator[SEP] identifier[equals] operator[SEP] identifier[q2] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[MtasSpanIntersectingQuery] operator[SEP] identifier[newQ1] , identifier[newQ2] operator[SEP] operator[SEP] identifier[rewrite] operator[SEP] identifier[reader] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[newQ1] operator[SEP] identifier[equals] operator[SEP] identifier[newQ2] operator[SEP] operator[SEP] {
Keyword[return] identifier[newQ1] operator[SEP]
}
Keyword[else] {
Keyword[boolean] identifier[returnNone] operator[SEP] identifier[returnNone] operator[=] identifier[newQ1] operator[SEP] identifier[getMaximumWidth] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[newQ1] operator[SEP] identifier[getMaximumWidth] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[returnNone] operator[|=] identifier[newQ2] operator[SEP] identifier[getMaximumWidth] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[newQ2] operator[SEP] identifier[getMaximumWidth] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[returnNone] operator[SEP] {
Keyword[return] Keyword[new] identifier[MtasSpanMatchNoneQuery] operator[SEP] Keyword[this] operator[SEP] identifier[getField] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[super] operator[SEP] identifier[rewrite] operator[SEP] identifier[reader] operator[SEP] operator[SEP]
}
}
}
|
public static String deepFieldName(Field field) {
DeepField annotation = field.getAnnotation(DeepField.class);
if (StringUtils.isNotEmpty(annotation.fieldName())) {
return annotation.fieldName();
} else {
return field.getName();
}
}
|
class class_name[name] begin[{]
method[deepFieldName, return_type[type[String]], modifier[public static], parameter[field]] begin[{]
local_variable[type[DeepField], annotation]
if[call[StringUtils.isNotEmpty, parameter[call[annotation.fieldName, parameter[]]]]] begin[{]
return[call[annotation.fieldName, parameter[]]]
else begin[{]
return[call[field.getName, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[deepFieldName] operator[SEP] identifier[Field] identifier[field] operator[SEP] {
identifier[DeepField] identifier[annotation] operator[=] identifier[field] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[DeepField] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[annotation] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[annotation] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public HiveMetastoreClient createMetastoreClient()
throws TException
{
List<HostAndPort> metastores = new ArrayList<>(addresses);
Collections.shuffle(metastores.subList(1, metastores.size()));
TException lastException = null;
for (HostAndPort metastore : metastores) {
try {
HiveMetastoreClient client = clientFactory.create(metastore);
if (!isNullOrEmpty(metastoreUsername)) {
client.setUGI(metastoreUsername);
}
return client;
}
catch (TException e) {
lastException = e;
}
}
throw new TException("Failed connecting to Hive metastore: " + addresses, lastException);
}
|
class class_name[name] begin[{]
method[createMetastoreClient, return_type[type[HiveMetastoreClient]], modifier[public], parameter[]] begin[{]
local_variable[type[List], metastores]
call[Collections.shuffle, parameter[call[metastores.subList, parameter[literal[1], call[metastores.size, parameter[]]]]]]
local_variable[type[TException], lastException]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=metastore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=clientFactory, selectors=[], type_arguments=None), name=client)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HiveMetastoreClient, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=metastoreUsername, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNullOrEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=metastoreUsername, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUGI, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=metastores, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=metastore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HostAndPort, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed connecting to Hive metastore: "), operandr=MemberReference(member=addresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=lastException, 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=TException, sub_type=None)), label=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[HiveMetastoreClient] identifier[createMetastoreClient] operator[SEP] operator[SEP] Keyword[throws] identifier[TException] {
identifier[List] operator[<] identifier[HostAndPort] operator[>] identifier[metastores] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[addresses] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[shuffle] operator[SEP] identifier[metastores] operator[SEP] identifier[subList] operator[SEP] Other[1] , identifier[metastores] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TException] identifier[lastException] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[HostAndPort] identifier[metastore] operator[:] identifier[metastores] operator[SEP] {
Keyword[try] {
identifier[HiveMetastoreClient] identifier[client] operator[=] identifier[clientFactory] operator[SEP] identifier[create] operator[SEP] identifier[metastore] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isNullOrEmpty] operator[SEP] identifier[metastoreUsername] operator[SEP] operator[SEP] {
identifier[client] operator[SEP] identifier[setUGI] operator[SEP] identifier[metastoreUsername] operator[SEP] operator[SEP]
}
Keyword[return] identifier[client] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TException] identifier[e] operator[SEP] {
identifier[lastException] operator[=] identifier[e] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[TException] operator[SEP] literal[String] operator[+] identifier[addresses] , identifier[lastException] operator[SEP] operator[SEP]
}
|
private Map<String, String[]> getParameterMap(HttpServletRequest pReq){
try {
// Servlet 2.4 API
return pReq.getParameterMap();
} catch (UnsupportedOperationException exp) {
// Thrown by 'pseudo' 2.4 Servlet API implementations which fake a 2.4 API
// As a service for the parameter map is build up explicitely
Map<String, String[]> ret = new HashMap<String, String[]>();
Enumeration params = pReq.getParameterNames();
while (params.hasMoreElements()) {
String param = (String) params.nextElement();
ret.put(param, pReq.getParameterValues(param));
}
return ret;
}
}
|
class class_name[name] begin[{]
method[getParameterMap, return_type[type[Map]], modifier[private], parameter[pReq]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getParameterMap, postfix_operators=[], prefix_operators=[], qualifier=pReq, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=ret)], 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=[None], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParameterNames, postfix_operators=[], prefix_operators=[], qualifier=pReq, selectors=[], type_arguments=None), name=params)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParameterValues, postfix_operators=[], prefix_operators=[], qualifier=pReq, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exp, types=['UnsupportedOperationException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[getParameterMap] operator[SEP] identifier[HttpServletRequest] identifier[pReq] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[pReq] operator[SEP] identifier[getParameterMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedOperationException] identifier[exp] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[ret] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Enumeration] identifier[params] operator[=] identifier[pReq] operator[SEP] identifier[getParameterNames] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[params] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[param] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[params] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[param] , identifier[pReq] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[param] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
}
|
public static dos_stats get(nitro_service service, options option) throws Exception{
dos_stats obj = new dos_stats();
dos_stats[] response = (dos_stats[])obj.stat_resources(service,option);
return response[0];
}
|
class class_name[name] begin[{]
method[get, return_type[type[dos_stats]], modifier[public static], parameter[service, option]] begin[{]
local_variable[type[dos_stats], obj]
local_variable[type[dos_stats], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[dos_stats] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[options] identifier[option] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[dos_stats] identifier[obj] operator[=] Keyword[new] identifier[dos_stats] operator[SEP] operator[SEP] operator[SEP] identifier[dos_stats] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[dos_stats] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[stat_resources] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public <T> TableFormatter header(Collection<? extends T> collection) {
header.addAll(collection);
longestCell = (int) Math.max(longestCell, collection.stream()
.mapToDouble(o -> o.toString().length() + 2)
.max()
.orElse(0));
return this;
}
|
class class_name[name] begin[{]
method[header, return_type[type[TableFormatter]], modifier[public], parameter[collection]] begin[{]
call[header.addAll, parameter[member[.collection]]]
assign[member[.longestCell], Cast(expression=MethodInvocation(arguments=[MemberReference(member=longestCell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=collection, selectors=[MethodInvocation(arguments=[LambdaExpression(body=BinaryOperation(operandl=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+), parameters=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=mapToDouble, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=max, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=orElse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[TableFormatter] identifier[header] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[collection] operator[SEP] {
identifier[header] operator[SEP] identifier[addAll] operator[SEP] identifier[collection] operator[SEP] operator[SEP] identifier[longestCell] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[longestCell] , identifier[collection] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[o] operator[->] identifier[o] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[2] operator[SEP] operator[SEP] identifier[max] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public Request<DisassociateRouteTableRequest> getDryRunRequest() {
Request<DisassociateRouteTableRequest> request = new DisassociateRouteTableRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
|
class class_name[name] begin[{]
method[getDryRunRequest, return_type[type[Request]], modifier[public], parameter[]] begin[{]
local_variable[type[Request], request]
call[request.addParameter, parameter[literal["DryRun"], call[Boolean.toString, parameter[literal[true]]]]]
return[member[.request]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Request] operator[<] identifier[DisassociateRouteTableRequest] operator[>] identifier[getDryRunRequest] operator[SEP] operator[SEP] {
identifier[Request] operator[<] identifier[DisassociateRouteTableRequest] operator[>] identifier[request] operator[=] Keyword[new] identifier[DisassociateRouteTableRequestMarshaller] operator[SEP] operator[SEP] operator[SEP] identifier[marshall] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[Boolean] operator[SEP] identifier[toString] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
@NotNull
public DoubleStream limit(final long maxSize) {
if (maxSize < 0) throw new IllegalArgumentException("maxSize cannot be negative");
if (maxSize == 0) return DoubleStream.empty();
return new DoubleStream(params, new DoubleLimit(iterator, maxSize));
}
|
class class_name[name] begin[{]
method[limit, return_type[type[DoubleStream]], modifier[public], parameter[maxSize]] begin[{]
if[binary_operation[member[.maxSize], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="maxSize cannot be negative")], 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[binary_operation[member[.maxSize], ==, literal[0]]] begin[{]
return[call[DoubleStream.empty, parameter[]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxSize, 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=DoubleLimit, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleStream, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[NotNull] Keyword[public] identifier[DoubleStream] identifier[limit] operator[SEP] Keyword[final] Keyword[long] identifier[maxSize] operator[SEP] {
Keyword[if] operator[SEP] identifier[maxSize] operator[<] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxSize] operator[==] Other[0] operator[SEP] Keyword[return] identifier[DoubleStream] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DoubleStream] operator[SEP] identifier[params] , Keyword[new] identifier[DoubleLimit] operator[SEP] identifier[iterator] , identifier[maxSize] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String readCharacters(
final File file
)
throws IOException
{
Reader reader = new BufferedReader( new InputStreamReader(
new FileInputStream( file ), Charset.forName( "UTF-8" ) ) );
// Note:
// The character set should be specified to parse XML
// containing Japanese characters.
StringWriter sw = new StringWriter();
Writer writer = new BufferedWriter( sw );
copy( reader, writer );
String characters = sw.toString();
return characters;
}
|
class class_name[name] begin[{]
method[readCharacters, return_type[type[String]], modifier[public static], parameter[file]] begin[{]
local_variable[type[Reader], reader]
local_variable[type[StringWriter], sw]
local_variable[type[Writer], writer]
call[.copy, parameter[member[.reader], member[.writer]]]
local_variable[type[String], characters]
return[member[.characters]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[readCharacters] operator[SEP] Keyword[final] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Reader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] , identifier[Charset] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[StringWriter] identifier[sw] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] identifier[Writer] identifier[writer] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] identifier[sw] operator[SEP] operator[SEP] identifier[copy] operator[SEP] identifier[reader] , identifier[writer] operator[SEP] operator[SEP] identifier[String] identifier[characters] operator[=] identifier[sw] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[characters] operator[SEP]
}
|
public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy2nd(TriPredicate<T1, T2, T3> predicate, Box<T2> param2) {
return spy(predicate, Box.<Boolean>empty(), Box.<T1>empty(), param2, Box.<T3>empty());
}
|
class class_name[name] begin[{]
method[spy2nd, return_type[type[TriPredicate]], modifier[public static], parameter[predicate, param2]] begin[{]
return[call[.spy, parameter[member[.predicate], call[.Box, parameter[]], call[.Box, parameter[]], member[.param2], call[.Box, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[TriPredicate] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[spy2nd] operator[SEP] identifier[TriPredicate] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[predicate] , identifier[Box] operator[<] identifier[T2] operator[>] identifier[param2] operator[SEP] {
Keyword[return] identifier[spy] operator[SEP] identifier[predicate] , identifier[Box] operator[SEP] operator[<] identifier[Boolean] operator[>] identifier[empty] operator[SEP] operator[SEP] , identifier[Box] operator[SEP] operator[<] identifier[T1] operator[>] identifier[empty] operator[SEP] operator[SEP] , identifier[param2] , identifier[Box] operator[SEP] operator[<] identifier[T3] operator[>] identifier[empty] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T, C extends Collection<T>> Reducer<T, C> getAggregatingReducer(
Supplier<C> supplier) {
return new AggregatingReducer<T, C>(supplier);
}
|
class class_name[name] begin[{]
method[getAggregatingReducer, return_type[type[Reducer]], modifier[public static], parameter[supplier]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=supplier, 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=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=C, sub_type=None))], dimensions=None, name=AggregatingReducer, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[C] Keyword[extends] identifier[Collection] operator[<] identifier[T] operator[>] operator[>] identifier[Reducer] operator[<] identifier[T] , identifier[C] operator[>] identifier[getAggregatingReducer] operator[SEP] identifier[Supplier] operator[<] identifier[C] operator[>] identifier[supplier] operator[SEP] {
Keyword[return] Keyword[new] identifier[AggregatingReducer] operator[<] identifier[T] , identifier[C] operator[>] operator[SEP] identifier[supplier] operator[SEP] operator[SEP]
}
|
public ValidationData save(ValidationData data) {
if (data.getParamType() == null || data.getUrl() == null || data.getMethod() == null || data.getType() == null || data.getTypeClass() == null) {
throw new ValidationLibException("mandatory field is null ", HttpStatus.BAD_REQUEST);
}
ValidationData existData = this.findById(data.getId());
if (existData == null) {
return this.addData(data);
} else {
existData.setValidationRules(data.getValidationRules());
return existData;
}
}
|
class class_name[name] begin[{]
method[save, return_type[type[ValidationData]], modifier[public], parameter[data]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[call[data.getParamType, parameter[]], ==, literal[null]], ||, binary_operation[call[data.getUrl, parameter[]], ==, literal[null]]], ||, binary_operation[call[data.getMethod, parameter[]], ==, literal[null]]], ||, binary_operation[call[data.getType, parameter[]], ==, literal[null]]], ||, binary_operation[call[data.getTypeClass, parameter[]], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mandatory field is null "), MemberReference(member=BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidationLibException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ValidationData], existData]
if[binary_operation[member[.existData], ==, literal[null]]] begin[{]
return[THIS[call[None.addData, parameter[member[.data]]]]]
else begin[{]
call[existData.setValidationRules, parameter[call[data.getValidationRules, parameter[]]]]
return[member[.existData]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[ValidationData] identifier[save] operator[SEP] identifier[ValidationData] identifier[data] operator[SEP] {
Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[getParamType] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[data] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[data] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[data] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[data] operator[SEP] identifier[getTypeClass] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValidationLibException] operator[SEP] literal[String] , identifier[HttpStatus] operator[SEP] identifier[BAD_REQUEST] operator[SEP] operator[SEP]
}
identifier[ValidationData] identifier[existData] operator[=] Keyword[this] operator[SEP] identifier[findById] operator[SEP] identifier[data] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existData] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[addData] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[existData] operator[SEP] identifier[setValidationRules] operator[SEP] identifier[data] operator[SEP] identifier[getValidationRules] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[existData] operator[SEP]
}
}
|
@Pure
protected static Plane3D<?> toPlane(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3) {
Vector3f norm = new Vector3f();
FunctionalVector3D.crossProduct(
tx2 - tx1,
ty2 - ty1,
tz2 - tz1,
tx3 - tx1,
ty3 - ty1,
tz3 - tz1,
norm);
assert(norm!=null);
if (norm.getY()==0. && norm.getZ()==0.)
return new PlaneYZ4f(tx1);
if (norm.getX()==0. && norm.getZ()==0.)
return new PlaneXZ4f(ty1);
if (norm.getX()==0. && norm.getY()==0.)
return new PlaneXY4f(tz1);
return new Plane4f(tx1, ty1, tz1, tx2, ty2, tz2, tx3, ty3, tz3);
}
|
class class_name[name] begin[{]
method[toPlane, return_type[type[Plane3D]], modifier[static protected], parameter[tx1, ty1, tz1, tx2, ty2, tz2, tx3, ty3, tz3]] begin[{]
local_variable[type[Vector3f], norm]
call[FunctionalVector3D.crossProduct, parameter[binary_operation[member[.tx2], -, member[.tx1]], binary_operation[member[.ty2], -, member[.ty1]], binary_operation[member[.tz2], -, member[.tz1]], binary_operation[member[.tx3], -, member[.tx1]], binary_operation[member[.ty3], -, member[.ty1]], binary_operation[member[.tz3], -, member[.tz1]], member[.norm]]]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=norm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
if[binary_operation[binary_operation[call[norm.getY, parameter[]], ==, literal[0.]], &&, binary_operation[call[norm.getZ, parameter[]], ==, literal[0.]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=tx1, 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=PlaneYZ4f, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[norm.getX, parameter[]], ==, literal[0.]], &&, binary_operation[call[norm.getZ, parameter[]], ==, literal[0.]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=ty1, 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=PlaneXZ4f, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[norm.getX, parameter[]], ==, literal[0.]], &&, binary_operation[call[norm.getY, parameter[]], ==, literal[0.]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=tz1, 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=PlaneXY4f, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=tx1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ty1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tz1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ty2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tz2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ty3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tz3, 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=Plane4f, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Pure] Keyword[protected] Keyword[static] identifier[Plane3D] operator[<] operator[?] operator[>] identifier[toPlane] operator[SEP] Keyword[double] identifier[tx1] , Keyword[double] identifier[ty1] , Keyword[double] identifier[tz1] , Keyword[double] identifier[tx2] , Keyword[double] identifier[ty2] , Keyword[double] identifier[tz2] , Keyword[double] identifier[tx3] , Keyword[double] identifier[ty3] , Keyword[double] identifier[tz3] operator[SEP] {
identifier[Vector3f] identifier[norm] operator[=] Keyword[new] identifier[Vector3f] operator[SEP] operator[SEP] operator[SEP] identifier[FunctionalVector3D] operator[SEP] identifier[crossProduct] operator[SEP] identifier[tx2] operator[-] identifier[tx1] , identifier[ty2] operator[-] identifier[ty1] , identifier[tz2] operator[-] identifier[tz1] , identifier[tx3] operator[-] identifier[tx1] , identifier[ty3] operator[-] identifier[ty1] , identifier[tz3] operator[-] identifier[tz1] , identifier[norm] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[norm] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[norm] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[==] literal[Float] operator[&&] identifier[norm] operator[SEP] identifier[getZ] operator[SEP] operator[SEP] operator[==] literal[Float] operator[SEP] Keyword[return] Keyword[new] identifier[PlaneYZ4f] operator[SEP] identifier[tx1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[norm] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[==] literal[Float] operator[&&] identifier[norm] operator[SEP] identifier[getZ] operator[SEP] operator[SEP] operator[==] literal[Float] operator[SEP] Keyword[return] Keyword[new] identifier[PlaneXZ4f] operator[SEP] identifier[ty1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[norm] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[==] literal[Float] operator[&&] identifier[norm] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[==] literal[Float] operator[SEP] Keyword[return] Keyword[new] identifier[PlaneXY4f] operator[SEP] identifier[tz1] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Plane4f] operator[SEP] identifier[tx1] , identifier[ty1] , identifier[tz1] , identifier[tx2] , identifier[ty2] , identifier[tz2] , identifier[tx3] , identifier[ty3] , identifier[tz3] operator[SEP] operator[SEP]
}
|
public List<Peer> findPeersOfAtLeastVersion(long protocolVersion) {
lock.lock();
try {
ArrayList<Peer> results = new ArrayList<>(peers.size());
for (Peer peer : peers)
if (peer.getPeerVersionMessage().clientVersion >= protocolVersion)
results.add(peer);
return results;
} finally {
lock.unlock();
}
}
|
class class_name[name] begin[{]
method[findPeersOfAtLeastVersion, return_type[type[List]], modifier[public], parameter[protocolVersion]] begin[{]
call[lock.lock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=peers, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=results)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Peer, sub_type=None))], dimensions=[], name=ArrayList, sub_type=None)), ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPeerVersionMessage, postfix_operators=[], prefix_operators=[], qualifier=peer, selectors=[MemberReference(member=clientVersion, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operandr=MemberReference(member=protocolVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=peer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)), control=EnhancedForControl(iterable=MemberReference(member=peers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=peer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Peer, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Peer] operator[>] identifier[findPeersOfAtLeastVersion] operator[SEP] Keyword[long] identifier[protocolVersion] operator[SEP] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[ArrayList] operator[<] identifier[Peer] operator[>] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[peers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Peer] identifier[peer] operator[:] identifier[peers] operator[SEP] Keyword[if] operator[SEP] identifier[peer] operator[SEP] identifier[getPeerVersionMessage] operator[SEP] operator[SEP] operator[SEP] identifier[clientVersion] operator[>=] identifier[protocolVersion] operator[SEP] identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[peer] operator[SEP] operator[SEP] Keyword[return] identifier[results] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Observable<ServiceResponse<KeyVerifyResult>> verifyWithServiceResponseAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeySignatureAlgorithm algorithm, byte[] digest, byte[] signature) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (keyName == null) {
throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
}
if (keyVersion == null) {
throw new IllegalArgumentException("Parameter keyVersion is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
if (algorithm == null) {
throw new IllegalArgumentException("Parameter algorithm is required and cannot be null.");
}
if (digest == null) {
throw new IllegalArgumentException("Parameter digest is required and cannot be null.");
}
if (signature == null) {
throw new IllegalArgumentException("Parameter signature is required and cannot be null.");
}
KeyVerifyParameters parameters = new KeyVerifyParameters();
parameters.withAlgorithm(algorithm);
parameters.withDigest(digest);
parameters.withSignature(signature);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.verify(keyName, keyVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyVerifyResult>>>() {
@Override
public Observable<ServiceResponse<KeyVerifyResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<KeyVerifyResult> clientResponse = verifyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[verifyWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature]] begin[{]
if[binary_operation[member[.vaultBaseUrl], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter vaultBaseUrl is required and 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[binary_operation[member[.keyName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter keyName is required and 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[binary_operation[member[.keyVersion], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter keyVersion is required and 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[binary_operation[THIS[call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.apiVersion() is required and 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[binary_operation[member[.algorithm], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter algorithm is required and 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[binary_operation[member[.digest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter digest is required and 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[binary_operation[member[.signature], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter signature is required and 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[}]
local_variable[type[KeyVerifyParameters], parameters]
call[parameters.withAlgorithm, parameter[member[.algorithm]]]
call[parameters.withDigest, parameter[member[.digest]]]
call[parameters.withSignature, parameter[member[.signature]]]
local_variable[type[String], parameterizedHost]
return[call[service.verify, parameter[member[.keyName], member[.keyVersion], THIS[call[None.apiVersion, parameter[]]], THIS[call[None.acceptLanguage, parameter[]]], member[.parameters], member[.parameterizedHost], THIS[call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[KeyVerifyResult] operator[>] operator[>] identifier[verifyWithServiceResponseAsync] operator[SEP] identifier[String] identifier[vaultBaseUrl] , identifier[String] identifier[keyName] , identifier[String] identifier[keyVersion] , identifier[JsonWebKeySignatureAlgorithm] identifier[algorithm] , Keyword[byte] operator[SEP] operator[SEP] identifier[digest] , Keyword[byte] operator[SEP] operator[SEP] identifier[signature] operator[SEP] {
Keyword[if] operator[SEP] identifier[vaultBaseUrl] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyVersion] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[algorithm] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[digest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[signature] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[KeyVerifyParameters] identifier[parameters] operator[=] Keyword[new] identifier[KeyVerifyParameters] operator[SEP] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[withAlgorithm] operator[SEP] identifier[algorithm] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[withDigest] operator[SEP] identifier[digest] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[withSignature] operator[SEP] identifier[signature] operator[SEP] operator[SEP] identifier[String] identifier[parameterizedHost] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] literal[String] , identifier[vaultBaseUrl] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[verify] operator[SEP] identifier[keyName] , identifier[keyVersion] , Keyword[this] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , identifier[parameters] , identifier[parameterizedHost] , Keyword[this] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[KeyVerifyResult] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[KeyVerifyResult] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[KeyVerifyResult] operator[>] identifier[clientResponse] operator[=] identifier[verifyDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public DirContext authenticateByDnForContext(String userDN, char[] pwd)
throws NamingException
{
Hashtable<String,Object> env = new Hashtable<String,Object> ();
setupBasicProperties(env, url);
setupSecurityProperties(env, userDN, pwd);
return openContext(env);
}
|
class class_name[name] begin[{]
method[authenticateByDnForContext, return_type[type[DirContext]], modifier[public], parameter[userDN, pwd]] begin[{]
local_variable[type[Hashtable], env]
call[.setupBasicProperties, parameter[member[.env], member[.url]]]
call[.setupSecurityProperties, parameter[member[.env], member[.userDN], member[.pwd]]]
return[call[.openContext, parameter[member[.env]]]]
end[}]
END[}]
|
Keyword[public] identifier[DirContext] identifier[authenticateByDnForContext] operator[SEP] identifier[String] identifier[userDN] , Keyword[char] operator[SEP] operator[SEP] identifier[pwd] operator[SEP] Keyword[throws] identifier[NamingException] {
identifier[Hashtable] operator[<] identifier[String] , identifier[Object] operator[>] identifier[env] operator[=] Keyword[new] identifier[Hashtable] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[setupBasicProperties] operator[SEP] identifier[env] , identifier[url] operator[SEP] operator[SEP] identifier[setupSecurityProperties] operator[SEP] identifier[env] , identifier[userDN] , identifier[pwd] operator[SEP] operator[SEP] Keyword[return] identifier[openContext] operator[SEP] identifier[env] operator[SEP] operator[SEP]
}
|
public Map<Long, BehaviorHistoryInfo> listTimelineBehaviorHistory(TimelineBehaviorHistoryCondition condition) {
Assert.assertNotNull(condition);
Map<Long, BehaviorHistoryInfo> behaviorHistoryInfos = new LinkedHashMap<Long, BehaviorHistoryInfo>();
List<TableHistoryStatDO> tableHistoryStatDOs = tableHistoryStatDao.listTimelineTableStat(condition);
int size = tableHistoryStatDOs.size();
int k = size - 1;
for (Long i = condition.getStart().getTime(); i <= condition.getEnd().getTime(); i += 60 * 1000) {
BehaviorHistoryInfo behaviorHistoryInfo = new BehaviorHistoryInfo();
List<TableStat> tableStat = new ArrayList<TableStat>();
// 取出每个时间点i以内的数据,k是一个游标,每次遍历时前面已经取过了的数据就不用再遍历了
for (int j = k; j >= 0; --j) {
if ((i - tableHistoryStatDOs.get(j).getEndTime().getTime() <= 60 * 1000)
&& (i - tableHistoryStatDOs.get(j).getEndTime().getTime() >= 0)) {
tableStat.add(tableHistoryStatDOToModel(tableHistoryStatDOs.get(j)));
k = j - 1;
}// 如果不满足if条件,则后面的数据也不用再遍历
else {
break;
}
}
if (tableStat.size() > 0) {
behaviorHistoryInfo.setItems(tableStat);
behaviorHistoryInfos.put(i, behaviorHistoryInfo);
}
}
return behaviorHistoryInfos;
}
|
class class_name[name] begin[{]
method[listTimelineBehaviorHistory, return_type[type[Map]], modifier[public], parameter[condition]] begin[{]
call[Assert.assertNotNull, parameter[member[.condition]]]
local_variable[type[Map], behaviorHistoryInfos]
local_variable[type[List], tableHistoryStatDOs]
local_variable[type[int], size]
local_variable[type[int], k]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BehaviorHistoryInfo, sub_type=None)), name=behaviorHistoryInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BehaviorHistoryInfo, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TableStat, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=tableStat)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TableStat, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tableHistoryStatDOs, selectors=[MethodInvocation(arguments=[], member=getEndTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*), operator=<=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tableHistoryStatDOs, selectors=[MethodInvocation(arguments=[], member=getEndTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operator=&&), else_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tableHistoryStatDOs, selectors=[], type_arguments=None)], member=tableHistoryStatDOToModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=tableStat, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tableStat, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tableStat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setItems, postfix_operators=[], prefix_operators=[], qualifier=behaviorHistoryInfo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=behaviorHistoryInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=behaviorHistoryInfos, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getEnd, postfix_operators=[], prefix_operators=[], qualifier=condition, selectors=[MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getStart, postfix_operators=[], prefix_operators=[], qualifier=condition, selectors=[MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*))]), label=None)
return[member[.behaviorHistoryInfos]]
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[Long] , identifier[BehaviorHistoryInfo] operator[>] identifier[listTimelineBehaviorHistory] operator[SEP] identifier[TimelineBehaviorHistoryCondition] identifier[condition] operator[SEP] {
identifier[Assert] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[condition] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Long] , identifier[BehaviorHistoryInfo] operator[>] identifier[behaviorHistoryInfos] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[Long] , identifier[BehaviorHistoryInfo] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[TableHistoryStatDO] operator[>] identifier[tableHistoryStatDOs] operator[=] identifier[tableHistoryStatDao] operator[SEP] identifier[listTimelineTableStat] operator[SEP] identifier[condition] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[tableHistoryStatDOs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[k] operator[=] identifier[size] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[Long] identifier[i] operator[=] identifier[condition] operator[SEP] identifier[getStart] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<=] identifier[condition] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[+=] Other[60] operator[*] Other[1000] operator[SEP] {
identifier[BehaviorHistoryInfo] identifier[behaviorHistoryInfo] operator[=] Keyword[new] identifier[BehaviorHistoryInfo] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[TableStat] operator[>] identifier[tableStat] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TableStat] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[k] operator[SEP] identifier[j] operator[>=] Other[0] operator[SEP] operator[--] identifier[j] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[i] operator[-] identifier[tableHistoryStatDOs] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[getEndTime] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[<=] Other[60] operator[*] Other[1000] operator[SEP] operator[&&] operator[SEP] identifier[i] operator[-] identifier[tableHistoryStatDOs] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[getEndTime] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] operator[SEP] {
identifier[tableStat] operator[SEP] identifier[add] operator[SEP] identifier[tableHistoryStatDOToModel] operator[SEP] identifier[tableHistoryStatDOs] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[k] operator[=] identifier[j] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[tableStat] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[behaviorHistoryInfo] operator[SEP] identifier[setItems] operator[SEP] identifier[tableStat] operator[SEP] operator[SEP] identifier[behaviorHistoryInfos] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[behaviorHistoryInfo] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[behaviorHistoryInfos] operator[SEP]
}
|
private float pointToAngle(float x, float y, float centerX, float centerY) {
double diffX = x - centerX;
double diffY = y - centerY;
// Pass -diffX to get clockwise degrees order.
double radian = Math.atan2(-diffX, diffY);
float angle = ((float) Math.toDegrees(radian) + 360) % 360;
// Add 90 because atan2 returns 0 degrees at 6 o'clock.
angle += 90f;
return angle;
}
|
class class_name[name] begin[{]
method[pointToAngle, return_type[type[float]], modifier[private], parameter[x, y, centerX, centerY]] begin[{]
local_variable[type[double], diffX]
local_variable[type[double], diffY]
local_variable[type[double], radian]
local_variable[type[float], angle]
assign[member[.angle], literal[90f]]
return[member[.angle]]
end[}]
END[}]
|
Keyword[private] Keyword[float] identifier[pointToAngle] operator[SEP] Keyword[float] identifier[x] , Keyword[float] identifier[y] , Keyword[float] identifier[centerX] , Keyword[float] identifier[centerY] operator[SEP] {
Keyword[double] identifier[diffX] operator[=] identifier[x] operator[-] identifier[centerX] operator[SEP] Keyword[double] identifier[diffY] operator[=] identifier[y] operator[-] identifier[centerY] operator[SEP] Keyword[double] identifier[radian] operator[=] identifier[Math] operator[SEP] identifier[atan2] operator[SEP] operator[-] identifier[diffX] , identifier[diffY] operator[SEP] operator[SEP] Keyword[float] identifier[angle] operator[=] operator[SEP] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[toDegrees] operator[SEP] identifier[radian] operator[SEP] operator[+] Other[360] operator[SEP] operator[%] Other[360] operator[SEP] identifier[angle] operator[+=] literal[Float] operator[SEP] Keyword[return] identifier[angle] operator[SEP]
}
|
@Override
public void onDialogRelease(MAPDialog mapDialog) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("onDialogResease for DialogId=%d", mapDialog.getLocalDialogId()));
}
this.csvWriter.incrementCounter(SUCCESSFUL_DIALOGS);
this.endCount++;
if (this.endCount < NDIALOGS) {
if ((this.endCount % 2000) == 0) {
long current = System.currentTimeMillis();
float sec = (float) (current - prev) / 1000f;
prev = current;
logger.warn("Completed 2000 Dialogs, dlg per a sec: " + (float) (2000 / sec));
}
} else {
if (this.endCount == NDIALOGS) {
long current = System.currentTimeMillis();
logger.warn("Start Time = " + start);
logger.warn("Current Time = " + current);
float sec = (float) (current - start) / 1000f;
logger.warn("Total time in sec = " + sec);
logger.warn("Throughput = " + (float) (NDIALOGS / sec));
}
}
}
|
class class_name[name] begin[{]
method[onDialogRelease, return_type[void], modifier[public], parameter[mapDialog]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[call[String.format, parameter[literal["onDialogResease for DialogId=%d"], call[mapDialog.getLocalDialogId, parameter[]]]]]]
else begin[{]
None
end[}]
THIS[member[None.csvWriter]call[None.incrementCounter, parameter[member[.SUCCESSFUL_DIALOGS]]]]
THIS[member[None.endCount]]
if[binary_operation[THIS[member[None.endCount]], <, member[.NDIALOGS]]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.endCount]], %, literal[2000]], ==, literal[0]]] begin[{]
local_variable[type[long], current]
local_variable[type[float], sec]
assign[member[.prev], member[.current]]
call[logger.warn, parameter[binary_operation[literal["Completed 2000 Dialogs, dlg per a sec: "], +, Cast(expression=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2000), operandr=MemberReference(member=sec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), type=BasicType(dimensions=[], name=float))]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[THIS[member[None.endCount]], ==, member[.NDIALOGS]]] begin[{]
local_variable[type[long], current]
call[logger.warn, parameter[binary_operation[literal["Start Time = "], +, member[.start]]]]
call[logger.warn, parameter[binary_operation[literal["Current Time = "], +, member[.current]]]]
local_variable[type[float], sec]
call[logger.warn, parameter[binary_operation[literal["Total time in sec = "], +, member[.sec]]]]
call[logger.warn, parameter[binary_operation[literal["Throughput = "], +, Cast(expression=BinaryOperation(operandl=MemberReference(member=NDIALOGS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), type=BasicType(dimensions=[], name=float))]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onDialogRelease] operator[SEP] identifier[MAPDialog] identifier[mapDialog] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[mapDialog] operator[SEP] identifier[getLocalDialogId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[csvWriter] operator[SEP] identifier[incrementCounter] operator[SEP] identifier[SUCCESSFUL_DIALOGS] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[endCount] operator[++] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[endCount] operator[<] identifier[NDIALOGS] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[endCount] operator[%] Other[2000] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[long] identifier[current] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[sec] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[current] operator[-] identifier[prev] operator[SEP] operator[/] literal[Float] operator[SEP] identifier[prev] operator[=] identifier[current] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] operator[SEP] Keyword[float] operator[SEP] operator[SEP] Other[2000] operator[/] identifier[sec] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[endCount] operator[==] identifier[NDIALOGS] operator[SEP] {
Keyword[long] identifier[current] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[start] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[current] operator[SEP] operator[SEP] Keyword[float] identifier[sec] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[current] operator[-] identifier[start] operator[SEP] operator[/] literal[Float] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[sec] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[NDIALOGS] operator[/] identifier[sec] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static Promise ajax(Settings settings) {
resolveSettings(settings);
final Function onSuccess = settings.getSuccess();
if (onSuccess != null) {
onSuccess.setElement(settings.getContext());
}
final Function onError = settings.getError();
if (onError != null) {
onError.setElement(settings.getContext());
}
final String dataType = settings.getDataType();
Promise ret = null;
if ("jsonp".equalsIgnoreCase(dataType)) {
ret = GQ.getAjaxTransport().getJsonP(settings);
} else if ("loadscript".equalsIgnoreCase(dataType)) {
ret = GQ.getAjaxTransport().getLoadScript(settings);
} else {
ret = GQ.getAjaxTransport().getXhr(settings)
.then(new Function() {
public Object f(Object... args) {
Response response = arguments(0);
Request request = arguments(1);
Object retData = response.getText();
if (retData != null && !"".equals(retData)) {
try {
if ("xml".equalsIgnoreCase(dataType)) {
retData = JsUtils.parseXML(response.getText());
} else if ("json".equalsIgnoreCase(dataType)) {
retData = GQ.create(response.getText());
} else {
retData = response.getText();
if ("script".equalsIgnoreCase(dataType)) {
ScriptInjector.fromString((String) retData).setWindow(window).inject();
}
}
} catch (Exception e) {
if (GWT.isClient() && GWT.getUncaughtExceptionHandler() != null) {
GWT.getUncaughtExceptionHandler().onUncaughtException(e);
} else {
e.printStackTrace();
}
}
}
return new Object[] {retData, "success", request, response};
}
}, new Function() {
public Object f(Object... args) {
Throwable exception = arguments(0);
Request request = getArgument(1, Request.class);
String msg = String.valueOf(exception);
return new Object[] {null, msg, request, null, exception};
}
});
}
if (onSuccess != null) {
ret.done(onSuccess);
}
if (onError != null) {
ret.fail(onError);
}
return ret;
}
|
class class_name[name] begin[{]
method[ajax, return_type[type[Promise]], modifier[public static], parameter[settings]] begin[{]
call[.resolveSettings, parameter[member[.settings]]]
local_variable[type[Function], onSuccess]
if[binary_operation[member[.onSuccess], !=, literal[null]]] begin[{]
call[onSuccess.setElement, parameter[call[settings.getContext, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Function], onError]
if[binary_operation[member[.onError], !=, literal[null]]] begin[{]
call[onError.setElement, parameter[call[settings.getContext, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[String], dataType]
local_variable[type[Promise], ret]
if[literal["jsonp"]] begin[{]
assign[member[.ret], call[GQ.getAjaxTransport, parameter[]]]
else begin[{]
if[literal["loadscript"]] begin[{]
assign[member[.ret], call[GQ.getAjaxTransport, parameter[]]]
else begin[{]
assign[member[.ret], call[GQ.getAjaxTransport, parameter[]]]
end[}]
end[}]
if[binary_operation[member[.onSuccess], !=, literal[null]]] begin[{]
call[ret.done, parameter[member[.onSuccess]]]
else begin[{]
None
end[}]
if[binary_operation[member[.onError], !=, literal[null]]] begin[{]
call[ret.fail, parameter[member[.onError]]]
else begin[{]
None
end[}]
return[member[.ret]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Promise] identifier[ajax] operator[SEP] identifier[Settings] identifier[settings] operator[SEP] {
identifier[resolveSettings] operator[SEP] identifier[settings] operator[SEP] operator[SEP] Keyword[final] identifier[Function] identifier[onSuccess] operator[=] identifier[settings] operator[SEP] identifier[getSuccess] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[onSuccess] operator[!=] Other[null] operator[SEP] {
identifier[onSuccess] operator[SEP] identifier[setElement] operator[SEP] identifier[settings] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Function] identifier[onError] operator[=] identifier[settings] operator[SEP] identifier[getError] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[onError] operator[!=] Other[null] operator[SEP] {
identifier[onError] operator[SEP] identifier[setElement] operator[SEP] identifier[settings] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[dataType] operator[=] identifier[settings] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] identifier[Promise] identifier[ret] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] {
identifier[ret] operator[=] identifier[GQ] operator[SEP] identifier[getAjaxTransport] operator[SEP] operator[SEP] operator[SEP] identifier[getJsonP] operator[SEP] identifier[settings] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] {
identifier[ret] operator[=] identifier[GQ] operator[SEP] identifier[getAjaxTransport] operator[SEP] operator[SEP] operator[SEP] identifier[getLoadScript] operator[SEP] identifier[settings] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ret] operator[=] identifier[GQ] operator[SEP] identifier[getAjaxTransport] operator[SEP] operator[SEP] operator[SEP] identifier[getXhr] operator[SEP] identifier[settings] operator[SEP] operator[SEP] identifier[then] operator[SEP] Keyword[new] identifier[Function] operator[SEP] operator[SEP] {
Keyword[public] identifier[Object] identifier[f] operator[SEP] identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[Response] identifier[response] operator[=] identifier[arguments] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Request] identifier[request] operator[=] identifier[arguments] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[Object] identifier[retData] operator[=] identifier[response] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[retData] operator[!=] Other[null] operator[&&] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[retData] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] {
identifier[retData] operator[=] identifier[JsUtils] operator[SEP] identifier[parseXML] operator[SEP] identifier[response] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] {
identifier[retData] operator[=] identifier[GQ] operator[SEP] identifier[create] operator[SEP] identifier[response] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[retData] operator[=] identifier[response] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] {
identifier[ScriptInjector] operator[SEP] identifier[fromString] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[retData] operator[SEP] operator[SEP] identifier[setWindow] operator[SEP] identifier[window] operator[SEP] operator[SEP] identifier[inject] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[GWT] operator[SEP] identifier[isClient] operator[SEP] operator[SEP] operator[&&] identifier[GWT] operator[SEP] identifier[getUncaughtExceptionHandler] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[GWT] operator[SEP] identifier[getUncaughtExceptionHandler] operator[SEP] operator[SEP] operator[SEP] identifier[onUncaughtException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[retData] , literal[String] , identifier[request] , identifier[response]
} operator[SEP]
}
} , Keyword[new] identifier[Function] operator[SEP] operator[SEP] {
Keyword[public] identifier[Object] identifier[f] operator[SEP] identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[Throwable] identifier[exception] operator[=] identifier[arguments] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Request] identifier[request] operator[=] identifier[getArgument] operator[SEP] Other[1] , identifier[Request] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[String] identifier[msg] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[exception] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
Other[null] , identifier[msg] , identifier[request] , Other[null] , identifier[exception]
} operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[onSuccess] operator[!=] Other[null] operator[SEP] {
identifier[ret] operator[SEP] identifier[done] operator[SEP] identifier[onSuccess] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[onError] operator[!=] Other[null] operator[SEP] {
identifier[ret] operator[SEP] identifier[fail] operator[SEP] identifier[onError] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
private void scanForJarClasses(Path path,
String packagePath,
ByteCodeClassScanner classScanner,
JarByteCodeMatcher matcher)
{
/*
if (isNullScanPath(path)) {
return;
}
*/
//ZipFile zipFile = null;
//Jar jar = JarPath.create(path).getJar();
try (InputStream fIs = Files.newInputStream(path)) {
try (ZipInputStream zIs = new ZipInputStream(fIs)) {
ZipEntry entry;
while ((entry = zIs.getNextEntry()) != null) {
String entryName = entry.getName();
if (! entryName.endsWith(".class")) {
continue;
}
if (packagePath != null && ! entryName.startsWith(packagePath)) {
continue;
}
String subPath = entryName;
subPath = subPath.substring(0, subPath.length() - ".class".length());
String className = subPath.replace('/', '.');
if (className.startsWith("java.") || className.startsWith("javax.")) {
continue;
}
if (! matcher.isClassNameMatch(className)) {
continue;
}
matcher.init(); // path, path);
try (InputStream isEntry = new InputStreamEntry(zIs)) {
try (ReadStream is = new ReadStream(isEntry)) {
classScanner.init(entryName, is, matcher);
classScanner.scan();
}
}
}
}
} catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
System.out.println("IOE: " + e);
e.printStackTrace();
}
}
|
class class_name[name] begin[{]
method[scanForJarClasses, return_type[void], modifier[private], parameter[path, packagePath, classScanner, matcher]] begin[{]
TryStatement(block=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ZipEntry, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=entryName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".class")], member=endsWith, postfix_operators=[], prefix_operators=['!'], qualifier=entryName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=packagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=packagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=entryName, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=entryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=subPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=subPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=subPath, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=".class"), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=subPath, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=replace, postfix_operators=[], prefix_operators=[], qualifier=subPath, selectors=[], type_arguments=None), name=className)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="javax.")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isClassNameMatch, postfix_operators=[], prefix_operators=['!'], qualifier=matcher, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=init, postfix_operators=[], prefix_operators=[], qualifier=matcher, selectors=[], type_arguments=None), label=None), TryStatement(block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=classScanner, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=scan, postfix_operators=[], prefix_operators=[], qualifier=classScanner, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=is, type=ReferenceType(arguments=None, dimensions=[], name=ReadStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=isEntry, 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=ReadStream, sub_type=None)))])], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=isEntry, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=zIs, 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=InputStreamEntry, sub_type=None)))])]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNextEntry, postfix_operators=[], prefix_operators=[], qualifier=zIs, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=zIs, type=ReferenceType(arguments=None, dimensions=[], name=ZipInputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=fIs, 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=ZipInputStream, sub_type=None)))])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IOE: "), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], 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=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=fIs, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInputStream, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None))])
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[scanForJarClasses] operator[SEP] identifier[Path] identifier[path] , identifier[String] identifier[packagePath] , identifier[ByteCodeClassScanner] identifier[classScanner] , identifier[JarByteCodeMatcher] identifier[matcher] operator[SEP] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[fIs] operator[=] identifier[Files] operator[SEP] identifier[newInputStream] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[try] operator[SEP] identifier[ZipInputStream] identifier[zIs] operator[=] Keyword[new] identifier[ZipInputStream] operator[SEP] identifier[fIs] operator[SEP] operator[SEP] {
identifier[ZipEntry] identifier[entry] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[entry] operator[=] identifier[zIs] operator[SEP] identifier[getNextEntry] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[entryName] operator[=] identifier[entry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[entryName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[packagePath] operator[!=] Other[null] operator[&&] operator[!] identifier[entryName] operator[SEP] identifier[startsWith] operator[SEP] identifier[packagePath] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] identifier[subPath] operator[=] identifier[entryName] operator[SEP] identifier[subPath] operator[=] identifier[subPath] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[subPath] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[className] operator[=] identifier[subPath] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[matcher] operator[SEP] identifier[isClassNameMatch] operator[SEP] identifier[className] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[matcher] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[InputStream] identifier[isEntry] operator[=] Keyword[new] identifier[InputStreamEntry] operator[SEP] identifier[zIs] operator[SEP] operator[SEP] {
Keyword[try] operator[SEP] identifier[ReadStream] identifier[is] operator[=] Keyword[new] identifier[ReadStream] operator[SEP] identifier[isEntry] operator[SEP] operator[SEP] {
identifier[classScanner] operator[SEP] identifier[init] operator[SEP] identifier[entryName] , identifier[is] , identifier[matcher] operator[SEP] operator[SEP] identifier[classScanner] operator[SEP] identifier[scan] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void start(
final BiConsumer<
EvolutionResult<PolygonGene, Double>,
EvolutionResult<PolygonGene, Double>> callback
) {
final Thread thread = new Thread(() -> {
final MinMax<EvolutionResult<PolygonGene, Double>> best = MinMax.of();
_engine.stream()
.limit(result -> !Thread.currentThread().isInterrupted())
.peek(best)
.forEach(r -> {
waiting();
if (callback != null) {
callback.accept(r, best.getMax());
}
});
});
thread.start();
_thread = thread;
}
|
class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[callback]] begin[{]
local_variable[type[Thread], thread]
call[thread.start, parameter[]]
assign[member[._thread], member[.thread]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[start] operator[SEP] Keyword[final] identifier[BiConsumer] operator[<] identifier[EvolutionResult] operator[<] identifier[PolygonGene] , identifier[Double] operator[>] , identifier[EvolutionResult] operator[<] identifier[PolygonGene] , identifier[Double] operator[>] operator[>] identifier[callback] operator[SEP] {
Keyword[final] identifier[Thread] identifier[thread] operator[=] Keyword[new] identifier[Thread] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[final] identifier[MinMax] operator[<] identifier[EvolutionResult] operator[<] identifier[PolygonGene] , identifier[Double] operator[>] operator[>] identifier[best] operator[=] identifier[MinMax] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP] identifier[_engine] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[limit] operator[SEP] identifier[result] operator[->] operator[!] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[isInterrupted] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[peek] operator[SEP] identifier[best] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[r] operator[->] {
identifier[waiting] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[callback] operator[!=] Other[null] operator[SEP] {
identifier[callback] operator[SEP] identifier[accept] operator[SEP] identifier[r] , identifier[best] operator[SEP] identifier[getMax] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[thread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[_thread] operator[=] identifier[thread] operator[SEP]
}
|
public byte[] toBytesFull(boolean withHeader)
{
int size = getFullStorageSize(numBuckets);
if (withHeader) {
size += SERDE_HEADER_SIZE;
}
ByteBuffer buf = ByteBuffer.allocate(size);
writeByteBufferFull(buf, withHeader);
return buf.array();
}
|
class class_name[name] begin[{]
method[toBytesFull, return_type[type[byte]], modifier[public], parameter[withHeader]] begin[{]
local_variable[type[int], size]
if[member[.withHeader]] begin[{]
assign[member[.size], member[.SERDE_HEADER_SIZE]]
else begin[{]
None
end[}]
local_variable[type[ByteBuffer], buf]
call[.writeByteBufferFull, parameter[member[.buf], member[.withHeader]]]
return[call[buf.array, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[toBytesFull] operator[SEP] Keyword[boolean] identifier[withHeader] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[getFullStorageSize] operator[SEP] identifier[numBuckets] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[withHeader] operator[SEP] {
identifier[size] operator[+=] identifier[SERDE_HEADER_SIZE] operator[SEP]
}
identifier[ByteBuffer] identifier[buf] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[writeByteBufferFull] operator[SEP] identifier[buf] , identifier[withHeader] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
final void accept(final MethodWriter methodWriter) {
// Compute the number of locals, ignoring TOP types that are just after a LONG or a DOUBLE, and
// all trailing TOP types.
int[] localTypes = inputLocals;
int numLocal = 0;
int numTrailingTop = 0;
int i = 0;
while (i < localTypes.length) {
int localType = localTypes[i];
i += (localType == LONG || localType == DOUBLE) ? 2 : 1;
if (localType == TOP) {
numTrailingTop++;
} else {
numLocal += numTrailingTop + 1;
numTrailingTop = 0;
}
}
// Compute the stack size, ignoring TOP types that are just after a LONG or a DOUBLE.
int[] stackTypes = inputStack;
int numStack = 0;
i = 0;
while (i < stackTypes.length) {
int stackType = stackTypes[i];
i += (stackType == LONG || stackType == DOUBLE) ? 2 : 1;
numStack++;
}
// Visit the frame and its content.
int frameIndex = methodWriter.visitFrameStart(owner.bytecodeOffset, numLocal, numStack);
i = 0;
while (numLocal-- > 0) {
int localType = localTypes[i];
i += (localType == LONG || localType == DOUBLE) ? 2 : 1;
methodWriter.visitAbstractType(frameIndex++, localType);
}
i = 0;
while (numStack-- > 0) {
int stackType = stackTypes[i];
i += (stackType == LONG || stackType == DOUBLE) ? 2 : 1;
methodWriter.visitAbstractType(frameIndex++, stackType);
}
methodWriter.visitFrameEnd();
}
|
class class_name[name] begin[{]
method[accept, return_type[void], modifier[final], parameter[methodWriter]] begin[{]
local_variable[type[int], localTypes]
local_variable[type[int], numLocal]
local_variable[type[int], numTrailingTop]
local_variable[type[int], i]
while[binary_operation[member[.i], <, member[localTypes.length]]] begin[{]
local_variable[type[int], localType]
assign[member[.i], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=localType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=localType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]
if[binary_operation[member[.localType], ==, member[.TOP]]] begin[{]
member[.numTrailingTop]
else begin[{]
assign[member[.numLocal], binary_operation[member[.numTrailingTop], +, literal[1]]]
assign[member[.numTrailingTop], literal[0]]
end[}]
end[}]
local_variable[type[int], stackTypes]
local_variable[type[int], numStack]
assign[member[.i], literal[0]]
while[binary_operation[member[.i], <, member[stackTypes.length]]] begin[{]
local_variable[type[int], stackType]
assign[member[.i], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=stackType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=stackType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]
member[.numStack]
end[}]
local_variable[type[int], frameIndex]
assign[member[.i], literal[0]]
while[binary_operation[member[.numLocal], >, literal[0]]] begin[{]
local_variable[type[int], localType]
assign[member[.i], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=localType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=localType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]
call[methodWriter.visitAbstractType, parameter[member[.frameIndex], member[.localType]]]
end[}]
assign[member[.i], literal[0]]
while[binary_operation[member[.numStack], >, literal[0]]] begin[{]
local_variable[type[int], stackType]
assign[member[.i], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=stackType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=stackType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]
call[methodWriter.visitAbstractType, parameter[member[.frameIndex], member[.stackType]]]
end[}]
call[methodWriter.visitFrameEnd, parameter[]]
end[}]
END[}]
|
Keyword[final] Keyword[void] identifier[accept] operator[SEP] Keyword[final] identifier[MethodWriter] identifier[methodWriter] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[localTypes] operator[=] identifier[inputLocals] operator[SEP] Keyword[int] identifier[numLocal] operator[=] Other[0] operator[SEP] Keyword[int] identifier[numTrailingTop] operator[=] Other[0] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[<] identifier[localTypes] operator[SEP] identifier[length] operator[SEP] {
Keyword[int] identifier[localType] operator[=] identifier[localTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[+=] operator[SEP] identifier[localType] operator[==] identifier[LONG] operator[||] identifier[localType] operator[==] identifier[DOUBLE] operator[SEP] operator[?] Other[2] operator[:] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[localType] operator[==] identifier[TOP] operator[SEP] {
identifier[numTrailingTop] operator[++] operator[SEP]
}
Keyword[else] {
identifier[numLocal] operator[+=] identifier[numTrailingTop] operator[+] Other[1] operator[SEP] identifier[numTrailingTop] operator[=] Other[0] operator[SEP]
}
}
Keyword[int] operator[SEP] operator[SEP] identifier[stackTypes] operator[=] identifier[inputStack] operator[SEP] Keyword[int] identifier[numStack] operator[=] Other[0] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[<] identifier[stackTypes] operator[SEP] identifier[length] operator[SEP] {
Keyword[int] identifier[stackType] operator[=] identifier[stackTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[+=] operator[SEP] identifier[stackType] operator[==] identifier[LONG] operator[||] identifier[stackType] operator[==] identifier[DOUBLE] operator[SEP] operator[?] Other[2] operator[:] Other[1] operator[SEP] identifier[numStack] operator[++] operator[SEP]
}
Keyword[int] identifier[frameIndex] operator[=] identifier[methodWriter] operator[SEP] identifier[visitFrameStart] operator[SEP] identifier[owner] operator[SEP] identifier[bytecodeOffset] , identifier[numLocal] , identifier[numStack] operator[SEP] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[numLocal] operator[--] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[localType] operator[=] identifier[localTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[+=] operator[SEP] identifier[localType] operator[==] identifier[LONG] operator[||] identifier[localType] operator[==] identifier[DOUBLE] operator[SEP] operator[?] Other[2] operator[:] Other[1] operator[SEP] identifier[methodWriter] operator[SEP] identifier[visitAbstractType] operator[SEP] identifier[frameIndex] operator[++] , identifier[localType] operator[SEP] operator[SEP]
}
identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[numStack] operator[--] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[stackType] operator[=] identifier[stackTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[+=] operator[SEP] identifier[stackType] operator[==] identifier[LONG] operator[||] identifier[stackType] operator[==] identifier[DOUBLE] operator[SEP] operator[?] Other[2] operator[:] Other[1] operator[SEP] identifier[methodWriter] operator[SEP] identifier[visitAbstractType] operator[SEP] identifier[frameIndex] operator[++] , identifier[stackType] operator[SEP] operator[SEP]
}
identifier[methodWriter] operator[SEP] identifier[visitFrameEnd] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean accessDenied(InetAddress remoteAddr) {
String hostname = null; //F184719
// check the inclusion lists first to see if the client matches
if (includeAccess.getActive() || includeAccessNames.getActive()) {
boolean closeSocket = true;
if (includeAccess.getActive()) {
if (remoteAddr instanceof Inet6Address) {
if (includeAccess.findInList6(remoteAddr.getAddress())) {
closeSocket = false;
}
} else {
if (includeAccess.findInList(remoteAddr.getAddress())) {
closeSocket = false;
}
}
}
if (closeSocket && includeAccessNames.getActive()) {
// look at hostnames to check inclusion
hostname = remoteAddr.getHostName();
if (caseInsensitiveHostnames && (hostname != null)) {
hostname = hostname.toLowerCase();
}
if (includeAccessNames.findInList(hostname)) {
closeSocket = false;
}
}
if (closeSocket) {
// close the excluded socket connection
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Address and host name not in include list, address: " + remoteAddr.getHostAddress() + " host name: " + remoteAddr.getHostName());
return true;
}
}
if (excludeAccess.getActive() || excludeAccessNames.getActive()) {
boolean closeSocket = false;
if (excludeAccess.getActive()) {
if (remoteAddr instanceof Inet6Address) {
if (excludeAccess.findInList6(remoteAddr.getAddress())) {
// close the excluded socket connection
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Address (IPv6) in exclude list, address: " + remoteAddr.getHostAddress());
return true;
}
} else {
if (excludeAccess.findInList(remoteAddr.getAddress())) {
// close the excluded socket connection
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Address in exclude list, address: " + remoteAddr.getHostAddress());
return true;
}
}
}
if (closeSocket == false && excludeAccessNames.getActive()) {
// look at hostnames to check exclusion
hostname = remoteAddr.getHostName();
if (caseInsensitiveHostnames && (hostname != null)) {
hostname = hostname.toLowerCase();
}
if (excludeAccessNames.findInList(hostname)) {
// close the excluded socket connection
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Host name in exclude list, host name: " + remoteAddr.getHostName());
return true;
}
}
} // end if(there are excludes to check)
return false;
}
|
class class_name[name] begin[{]
method[accessDenied, return_type[type[boolean]], modifier[public], parameter[remoteAddr]] begin[{]
local_variable[type[String], hostname]
if[binary_operation[call[includeAccess.getActive, parameter[]], ||, call[includeAccessNames.getActive, parameter[]]]] begin[{]
local_variable[type[boolean], closeSocket]
if[call[includeAccess.getActive, parameter[]]] begin[{]
if[binary_operation[member[.remoteAddr], instanceof, type[Inet6Address]]] begin[{]
if[call[includeAccess.findInList6, parameter[call[remoteAddr.getAddress, parameter[]]]]] begin[{]
assign[member[.closeSocket], literal[false]]
else begin[{]
None
end[}]
else begin[{]
if[call[includeAccess.findInList, parameter[call[remoteAddr.getAddress, parameter[]]]]] begin[{]
assign[member[.closeSocket], literal[false]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.closeSocket], &&, call[includeAccessNames.getActive, parameter[]]]] begin[{]
assign[member[.hostname], call[remoteAddr.getHostName, parameter[]]]
if[binary_operation[member[.caseInsensitiveHostnames], &&, binary_operation[member[.hostname], !=, literal[null]]]] begin[{]
assign[member[.hostname], call[hostname.toLowerCase, parameter[]]]
else begin[{]
None
end[}]
if[call[includeAccessNames.findInList, parameter[member[.hostname]]]] begin[{]
assign[member[.closeSocket], literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.closeSocket]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[binary_operation[binary_operation[literal["Address and host name not in include list, address: "], +, call[remoteAddr.getHostAddress, parameter[]]], +, literal[" host name: "]], +, call[remoteAddr.getHostName, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[excludeAccess.getActive, parameter[]], ||, call[excludeAccessNames.getActive, parameter[]]]] begin[{]
local_variable[type[boolean], closeSocket]
if[call[excludeAccess.getActive, parameter[]]] begin[{]
if[binary_operation[member[.remoteAddr], instanceof, type[Inet6Address]]] begin[{]
if[call[excludeAccess.findInList6, parameter[call[remoteAddr.getAddress, parameter[]]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[literal["Address (IPv6) in exclude list, address: "], +, call[remoteAddr.getHostAddress, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
if[call[excludeAccess.findInList, parameter[call[remoteAddr.getAddress, parameter[]]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[literal["Address in exclude list, address: "], +, call[remoteAddr.getHostAddress, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.closeSocket], ==, literal[false]], &&, call[excludeAccessNames.getActive, parameter[]]]] begin[{]
assign[member[.hostname], call[remoteAddr.getHostName, parameter[]]]
if[binary_operation[member[.caseInsensitiveHostnames], &&, binary_operation[member[.hostname], !=, literal[null]]]] begin[{]
assign[member[.hostname], call[hostname.toLowerCase, parameter[]]]
else begin[{]
None
end[}]
if[call[excludeAccessNames.findInList, parameter[member[.hostname]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[literal["Host name in exclude list, host name: "], +, call[remoteAddr.getHostName, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[accessDenied] operator[SEP] identifier[InetAddress] identifier[remoteAddr] operator[SEP] {
identifier[String] identifier[hostname] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[includeAccess] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[||] identifier[includeAccessNames] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[closeSocket] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[includeAccess] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[remoteAddr] Keyword[instanceof] identifier[Inet6Address] operator[SEP] {
Keyword[if] operator[SEP] identifier[includeAccess] operator[SEP] identifier[findInList6] operator[SEP] identifier[remoteAddr] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[closeSocket] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[includeAccess] operator[SEP] identifier[findInList] operator[SEP] identifier[remoteAddr] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[closeSocket] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[closeSocket] operator[&&] identifier[includeAccessNames] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[hostname] operator[=] identifier[remoteAddr] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[caseInsensitiveHostnames] operator[&&] operator[SEP] identifier[hostname] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[hostname] operator[=] identifier[hostname] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[includeAccessNames] operator[SEP] identifier[findInList] operator[SEP] identifier[hostname] operator[SEP] operator[SEP] {
identifier[closeSocket] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[closeSocket] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[remoteAddr] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[remoteAddr] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[excludeAccess] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[||] identifier[excludeAccessNames] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[closeSocket] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[excludeAccess] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[remoteAddr] Keyword[instanceof] identifier[Inet6Address] operator[SEP] {
Keyword[if] operator[SEP] identifier[excludeAccess] operator[SEP] identifier[findInList6] operator[SEP] identifier[remoteAddr] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[remoteAddr] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[excludeAccess] operator[SEP] identifier[findInList] operator[SEP] identifier[remoteAddr] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[remoteAddr] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[closeSocket] operator[==] literal[boolean] operator[&&] identifier[excludeAccessNames] operator[SEP] identifier[getActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[hostname] operator[=] identifier[remoteAddr] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[caseInsensitiveHostnames] operator[&&] operator[SEP] identifier[hostname] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[hostname] operator[=] identifier[hostname] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[excludeAccessNames] operator[SEP] identifier[findInList] operator[SEP] identifier[hostname] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[remoteAddr] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public ElemTemplateElement appendChild(ElemTemplateElement newChild)
{
int type = ((ElemTemplateElement) newChild).getXSLToken();
if (Constants.ELEMNAME_WITHPARAM == type)
{
setParamElem((ElemWithParam) newChild);
}
// You still have to append, because this element can
// contain a for-each, and other elements.
return super.appendChild(newChild);
}
|
class class_name[name] begin[{]
method[appendChild, return_type[type[ElemTemplateElement]], modifier[public], parameter[newChild]] begin[{]
local_variable[type[int], type]
if[binary_operation[member[Constants.ELEMNAME_WITHPARAM], ==, member[.type]]] begin[{]
call[.setParamElem, parameter[Cast(expression=MemberReference(member=newChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ElemWithParam, sub_type=None))]]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[MemberReference(member=newChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendChild, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
Keyword[public] identifier[ElemTemplateElement] identifier[appendChild] operator[SEP] identifier[ElemTemplateElement] identifier[newChild] operator[SEP] {
Keyword[int] identifier[type] operator[=] operator[SEP] operator[SEP] identifier[ElemTemplateElement] operator[SEP] identifier[newChild] operator[SEP] operator[SEP] identifier[getXSLToken] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Constants] operator[SEP] identifier[ELEMNAME_WITHPARAM] operator[==] identifier[type] operator[SEP] {
identifier[setParamElem] operator[SEP] operator[SEP] identifier[ElemWithParam] operator[SEP] identifier[newChild] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[appendChild] operator[SEP] identifier[newChild] operator[SEP] operator[SEP]
}
|
public void processRequest(RequestEvent request) {
Request req_msg = request.getRequest();
ToHeader to = (ToHeader) req_msg.getHeader(ToHeader.NAME);
SipContact my_contact_info = new SipContact();
synchronized (contactLock) {
my_contact_info.setContactHeader((ContactHeader) (contactInfo.getContactHeader().clone()));
}
// Is it for me? Check: Request-URI = my contact address (I may not be
// the original 'To' party, also there may be multiple devices for one
// "me" address of record)
// If no match, check 'To' = me
// (so that local messaging without proxy still works) - but ONLY IF
// setLoopback() has been called
LOG.trace("request received !");
LOG.trace(" me ('To' check) = {}", me);
LOG.trace(" my local contact info ('Request URI' check) = {}", my_contact_info.getURI());
LOG.trace(" {}" , req_msg.toString());
if (req_msg.getMethod().equalsIgnoreCase(SipRequest.REGISTER)) {
if (!isPassThroughRegisterRequests()) {
if (!isSupportRegisterRequests()) {
return;
} else {
ExpiresHeader expires = req_msg.getExpires();
if (expires.getExpires() == 0) {
try {
Response response = getParent().getMessageFactory().createResponse(Response.OK, request.getRequest());
sendReply(request, response);
return;
} catch (Exception e) {
LOG.error("Exception while trying to respond to REGISTER with Expires header 0 request");
}
}
}
}
} else if (!acceptTrafficOnEphemeralPorts) {
//Check if destination match
if (destMatch((SipURI) my_contact_info.getContactHeader().getAddress().getURI(),
(SipURI) req_msg.getRequestURI()) == false) {
if (!loopback) {
LOG.trace(" skipping 'To' check, we're not loopback (see setLoopback())");
return;
}
// check 'To' for a match
if (to.getAddress().getURI().toString().equals(me) == false) {
return;
}
}
}
if (req_msg.getMethod().equalsIgnoreCase(Request.OPTIONS)) {
int responseCode = Response.OK;
if (!isAutoResponseOptionsRequests()) {
if (errorRespondToOptions != -1 ) {
responseCode = errorRespondToOptions;
} else {
return;
}
}
try {
Response response = getParent().getMessageFactory().createResponse(responseCode, request.getRequest());
sendReply(request, response);
lastReceivedOptionsRequest = req_msg;
} catch (Exception e) {
LOG.error("Exception while trying to respond to OPTIONS request");
}
}
// check for listener handling
synchronized (requestListeners) {
List<RequestListener> listeners = requestListeners.get(req_msg.getMethod());
if (listeners != null) {
Iterator<RequestListener> i = listeners.iterator();
while (i.hasNext()) {
RequestListener listener = (RequestListener) i.next();
listener.processEvent(request);
}
}
}
synchronized (reqBlock) {
if (rcvRequests == false) {
LOG.trace("not interested in blocking requests");
return;
}
reqEvents.addLast(request);
LOG.trace("notifying block object");
reqBlock.notifyEvent();
}
}
|
class class_name[name] begin[{]
method[processRequest, return_type[void], modifier[public], parameter[request]] begin[{]
local_variable[type[Request], req_msg]
local_variable[type[ToHeader], to]
local_variable[type[SipContact], my_contact_info]
SYNCHRONIZED[member[.contactLock]] BEGIN[{]
call[my_contact_info.setContactHeader, parameter[Cast(expression=MethodInvocation(arguments=[], member=getContactHeader, postfix_operators=[], prefix_operators=[], qualifier=contactInfo, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ContactHeader, sub_type=None))]]
END[}]
call[LOG.trace, parameter[literal["request received !"]]]
call[LOG.trace, parameter[literal[" me ('To' check) = {}"], member[.me]]]
call[LOG.trace, parameter[literal[" my local contact info ('Request URI' check) = {}"], call[my_contact_info.getURI, parameter[]]]]
call[LOG.trace, parameter[literal[" {}"], call[req_msg.toString, parameter[]]]]
if[call[req_msg.getMethod, parameter[]]] begin[{]
if[call[.isPassThroughRegisterRequests, parameter[]]] begin[{]
if[call[.isSupportRegisterRequests, parameter[]]] begin[{]
return[None]
else begin[{]
local_variable[type[ExpiresHeader], expires]
if[binary_operation[call[expires.getExpires, parameter[]], ==, literal[0]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getMessageFactory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=OK, postfix_operators=[], prefix_operators=[], qualifier=Response, selectors=[]), MethodInvocation(arguments=[], member=getRequest, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=createResponse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendReply, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception while trying to respond to REGISTER with Expires header 0 request")], 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[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
else begin[{]
if[member[.acceptTrafficOnEphemeralPorts]] begin[{]
if[binary_operation[call[.destMatch, parameter[Cast(expression=MethodInvocation(arguments=[], member=getContactHeader, postfix_operators=[], prefix_operators=[], qualifier=my_contact_info, selectors=[MethodInvocation(arguments=[], member=getAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SipURI, sub_type=None)), Cast(expression=MethodInvocation(arguments=[], member=getRequestURI, postfix_operators=[], prefix_operators=[], qualifier=req_msg, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SipURI, sub_type=None))]], ==, literal[false]]] begin[{]
if[member[.loopback]] begin[{]
call[LOG.trace, parameter[literal[" skipping 'To' check, we're not loopback (see setLoopback())"]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[to.getAddress, parameter[]], ==, literal[false]]] begin[{]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
if[call[req_msg.getMethod, parameter[]]] begin[{]
local_variable[type[int], responseCode]
if[call[.isAutoResponseOptionsRequests, parameter[]]] begin[{]
if[binary_operation[member[.errorRespondToOptions], !=, literal[1]]] begin[{]
assign[member[.responseCode], member[.errorRespondToOptions]]
else begin[{]
return[None]
end[}]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getMessageFactory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRequest, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=createResponse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendReply, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastReceivedOptionsRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=req_msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception while trying to respond to OPTIONS request")], 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[{]
None
end[}]
SYNCHRONIZED[member[.requestListeners]] BEGIN[{]
local_variable[type[List], listeners]
if[binary_operation[member[.listeners], !=, literal[null]]] begin[{]
local_variable[type[Iterator], i]
while[call[i.hasNext, parameter[]]] begin[{]
local_variable[type[RequestListener], listener]
call[listener.processEvent, parameter[member[.request]]]
end[}]
else begin[{]
None
end[}]
END[}]
SYNCHRONIZED[member[.reqBlock]] BEGIN[{]
if[binary_operation[member[.rcvRequests], ==, literal[false]]] begin[{]
call[LOG.trace, parameter[literal["not interested in blocking requests"]]]
return[None]
else begin[{]
None
end[}]
call[reqEvents.addLast, parameter[member[.request]]]
call[LOG.trace, parameter[literal["notifying block object"]]]
call[reqBlock.notifyEvent, parameter[]]
END[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[processRequest] operator[SEP] identifier[RequestEvent] identifier[request] operator[SEP] {
identifier[Request] identifier[req_msg] operator[=] identifier[request] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[ToHeader] identifier[to] operator[=] operator[SEP] identifier[ToHeader] operator[SEP] identifier[req_msg] operator[SEP] identifier[getHeader] operator[SEP] identifier[ToHeader] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] identifier[SipContact] identifier[my_contact_info] operator[=] Keyword[new] identifier[SipContact] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[contactLock] operator[SEP] {
identifier[my_contact_info] operator[SEP] identifier[setContactHeader] operator[SEP] operator[SEP] identifier[ContactHeader] operator[SEP] operator[SEP] identifier[contactInfo] operator[SEP] identifier[getContactHeader] operator[SEP] operator[SEP] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[me] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[my_contact_info] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[req_msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[req_msg] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[SipRequest] operator[SEP] identifier[REGISTER] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isPassThroughRegisterRequests] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isSupportRegisterRequests] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[else] {
identifier[ExpiresHeader] identifier[expires] operator[=] identifier[req_msg] operator[SEP] identifier[getExpires] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expires] operator[SEP] identifier[getExpires] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[try] {
identifier[Response] identifier[response] operator[=] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getMessageFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createResponse] operator[SEP] identifier[Response] operator[SEP] identifier[OK] , identifier[request] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sendReply] operator[SEP] identifier[request] , identifier[response] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
}
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[acceptTrafficOnEphemeralPorts] operator[SEP] {
Keyword[if] operator[SEP] identifier[destMatch] operator[SEP] operator[SEP] identifier[SipURI] operator[SEP] identifier[my_contact_info] operator[SEP] identifier[getContactHeader] operator[SEP] operator[SEP] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] , operator[SEP] identifier[SipURI] operator[SEP] identifier[req_msg] operator[SEP] identifier[getRequestURI] operator[SEP] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[loopback] operator[SEP] {
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[to] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[me] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[return] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[req_msg] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[Request] operator[SEP] identifier[OPTIONS] operator[SEP] operator[SEP] {
Keyword[int] identifier[responseCode] operator[=] identifier[Response] operator[SEP] identifier[OK] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isAutoResponseOptionsRequests] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[errorRespondToOptions] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[responseCode] operator[=] identifier[errorRespondToOptions] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP]
}
}
Keyword[try] {
identifier[Response] identifier[response] operator[=] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getMessageFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createResponse] operator[SEP] identifier[responseCode] , identifier[request] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sendReply] operator[SEP] identifier[request] , identifier[response] operator[SEP] operator[SEP] identifier[lastReceivedOptionsRequest] operator[=] identifier[req_msg] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[synchronized] operator[SEP] identifier[requestListeners] operator[SEP] {
identifier[List] operator[<] identifier[RequestListener] operator[>] identifier[listeners] operator[=] identifier[requestListeners] operator[SEP] identifier[get] operator[SEP] identifier[req_msg] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listeners] operator[!=] Other[null] operator[SEP] {
identifier[Iterator] operator[<] identifier[RequestListener] operator[>] identifier[i] operator[=] identifier[listeners] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[RequestListener] identifier[listener] operator[=] operator[SEP] identifier[RequestListener] operator[SEP] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[listener] operator[SEP] identifier[processEvent] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
}
}
Keyword[synchronized] operator[SEP] identifier[reqBlock] operator[SEP] {
Keyword[if] operator[SEP] identifier[rcvRequests] operator[==] literal[boolean] operator[SEP] {
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[reqEvents] operator[SEP] identifier[addLast] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[reqBlock] operator[SEP] identifier[notifyEvent] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Observable<VirtualNetworkInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() {
@Override
public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, virtualNetworkName, parameters]] begin[{]
return[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.virtualNetworkName], member[.parameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[VirtualNetworkInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[virtualNetworkName] , identifier[VirtualNetworkInner] identifier[parameters] operator[SEP] {
Keyword[return] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[virtualNetworkName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[VirtualNetworkInner] operator[>] , identifier[VirtualNetworkInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[VirtualNetworkInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[VirtualNetworkInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public void setCertificateStatuses(java.util.Collection<String> certificateStatuses) {
if (certificateStatuses == null) {
this.certificateStatuses = null;
return;
}
this.certificateStatuses = new java.util.ArrayList<String>(certificateStatuses);
}
|
class class_name[name] begin[{]
method[setCertificateStatuses, return_type[void], modifier[public], parameter[certificateStatuses]] begin[{]
if[binary_operation[member[.certificateStatuses], ==, literal[null]]] begin[{]
assign[THIS[member[None.certificateStatuses]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.certificateStatuses]], ClassCreator(arguments=[MemberReference(member=certificateStatuses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setCertificateStatuses] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[certificateStatuses] operator[SEP] {
Keyword[if] operator[SEP] identifier[certificateStatuses] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[certificateStatuses] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[certificateStatuses] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[certificateStatuses] operator[SEP] operator[SEP]
}
|
public com.google.api.ads.admanager.axis.v201808.ForecastBreakdownEntry[] getBreakdownEntries() {
return breakdownEntries;
}
|
class class_name[name] begin[{]
method[getBreakdownEntries, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.breakdownEntries]]
end[}]
END[}]
|
Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[ForecastBreakdownEntry] operator[SEP] operator[SEP] identifier[getBreakdownEntries] operator[SEP] operator[SEP] {
Keyword[return] identifier[breakdownEntries] operator[SEP]
}
|
public Pager<SystemHook> getSystemHooks(int itemsPerPage) throws GitLabApiException {
return (new Pager<SystemHook>(this, SystemHook.class, itemsPerPage, null, "hooks"));
}
|
class class_name[name] begin[{]
method[getSystemHooks, return_type[type[Pager]], modifier[public], parameter[itemsPerPage]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SystemHook, sub_type=None)), MemberReference(member=itemsPerPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hooks")], 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=SystemHook, sub_type=None))], dimensions=None, name=Pager, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Pager] operator[<] identifier[SystemHook] operator[>] identifier[getSystemHooks] operator[SEP] Keyword[int] identifier[itemsPerPage] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] Keyword[new] identifier[Pager] operator[<] identifier[SystemHook] operator[>] operator[SEP] Keyword[this] , identifier[SystemHook] operator[SEP] Keyword[class] , identifier[itemsPerPage] , Other[null] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public byte[] toByteArray() {
final int preLongs, outBytes;
final boolean empty = itemsSeen_ == 0;
final int numItems = (int) Math.min(reservoirSize_, itemsSeen_);
if (empty) {
preLongs = 1;
outBytes = 8;
} else {
preLongs = Family.RESERVOIR.getMaxPreLongs();
outBytes = (preLongs + numItems) << 3; // for longs, we know the size
}
final byte[] outArr = new byte[outBytes];
final WritableMemory mem = WritableMemory.wrap(outArr);
// build first preLong
PreambleUtil.insertPreLongs(mem, preLongs); // Byte 0
PreambleUtil.insertLgResizeFactor(mem, rf_.lg());
PreambleUtil.insertSerVer(mem, SER_VER); // Byte 1
PreambleUtil.insertFamilyID(mem, Family.RESERVOIR.getID()); // Byte 2
if (empty) {
PreambleUtil.insertFlags(mem, EMPTY_FLAG_MASK); // Byte 3
} else {
PreambleUtil.insertFlags(mem, 0);
}
PreambleUtil.insertK(mem, reservoirSize_); // Bytes 4-7
if (!empty) {
// second preLong, only if non-empty
PreambleUtil.insertN(mem, itemsSeen_);
// insert the serialized samples, offset by the preamble size
final int preBytes = preLongs << 3;
mem.putLongArray(preBytes, data_, 0, numItems);
}
return outArr;
}
|
class class_name[name] begin[{]
method[toByteArray, return_type[type[byte]], modifier[public], parameter[]] begin[{]
local_variable[type[int], preLongs]
local_variable[type[boolean], empty]
local_variable[type[int], numItems]
if[member[.empty]] begin[{]
assign[member[.preLongs], literal[1]]
assign[member[.outBytes], literal[8]]
else begin[{]
assign[member[.preLongs], call[Family.RESERVOIR.getMaxPreLongs, parameter[]]]
assign[member[.outBytes], binary_operation[binary_operation[member[.preLongs], +, member[.numItems]], <<, literal[3]]]
end[}]
local_variable[type[byte], outArr]
local_variable[type[WritableMemory], mem]
call[PreambleUtil.insertPreLongs, parameter[member[.mem], member[.preLongs]]]
call[PreambleUtil.insertLgResizeFactor, parameter[member[.mem], call[rf_.lg, parameter[]]]]
call[PreambleUtil.insertSerVer, parameter[member[.mem], member[.SER_VER]]]
call[PreambleUtil.insertFamilyID, parameter[member[.mem], call[Family.RESERVOIR.getID, parameter[]]]]
if[member[.empty]] begin[{]
call[PreambleUtil.insertFlags, parameter[member[.mem], member[.EMPTY_FLAG_MASK]]]
else begin[{]
call[PreambleUtil.insertFlags, parameter[member[.mem], literal[0]]]
end[}]
call[PreambleUtil.insertK, parameter[member[.mem], member[.reservoirSize_]]]
if[member[.empty]] begin[{]
call[PreambleUtil.insertN, parameter[member[.mem], member[.itemsSeen_]]]
local_variable[type[int], preBytes]
call[mem.putLongArray, parameter[member[.preBytes], member[.data_], literal[0], member[.numItems]]]
else begin[{]
None
end[}]
return[member[.outArr]]
end[}]
END[}]
|
Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[preLongs] , identifier[outBytes] operator[SEP] Keyword[final] Keyword[boolean] identifier[empty] operator[=] identifier[itemsSeen_] operator[==] Other[0] operator[SEP] Keyword[final] Keyword[int] identifier[numItems] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[reservoirSize_] , identifier[itemsSeen_] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[empty] operator[SEP] {
identifier[preLongs] operator[=] Other[1] operator[SEP] identifier[outBytes] operator[=] Other[8] operator[SEP]
}
Keyword[else] {
identifier[preLongs] operator[=] identifier[Family] operator[SEP] identifier[RESERVOIR] operator[SEP] identifier[getMaxPreLongs] operator[SEP] operator[SEP] operator[SEP] identifier[outBytes] operator[=] operator[SEP] identifier[preLongs] operator[+] identifier[numItems] operator[SEP] operator[<<] Other[3] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[outArr] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[outBytes] operator[SEP] operator[SEP] Keyword[final] identifier[WritableMemory] identifier[mem] operator[=] identifier[WritableMemory] operator[SEP] identifier[wrap] operator[SEP] identifier[outArr] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertPreLongs] operator[SEP] identifier[mem] , identifier[preLongs] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertLgResizeFactor] operator[SEP] identifier[mem] , identifier[rf_] operator[SEP] identifier[lg] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertSerVer] operator[SEP] identifier[mem] , identifier[SER_VER] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertFamilyID] operator[SEP] identifier[mem] , identifier[Family] operator[SEP] identifier[RESERVOIR] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[empty] operator[SEP] {
identifier[PreambleUtil] operator[SEP] identifier[insertFlags] operator[SEP] identifier[mem] , identifier[EMPTY_FLAG_MASK] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[PreambleUtil] operator[SEP] identifier[insertFlags] operator[SEP] identifier[mem] , Other[0] operator[SEP] operator[SEP]
}
identifier[PreambleUtil] operator[SEP] identifier[insertK] operator[SEP] identifier[mem] , identifier[reservoirSize_] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[empty] operator[SEP] {
identifier[PreambleUtil] operator[SEP] identifier[insertN] operator[SEP] identifier[mem] , identifier[itemsSeen_] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[preBytes] operator[=] identifier[preLongs] operator[<<] Other[3] operator[SEP] identifier[mem] operator[SEP] identifier[putLongArray] operator[SEP] identifier[preBytes] , identifier[data_] , Other[0] , identifier[numItems] operator[SEP] operator[SEP]
}
Keyword[return] identifier[outArr] operator[SEP]
}
|
static void extractGenericsConnections(Map<String, GenericsType> connections, ClassNode type, ClassNode target) {
if (target==null || type==target || !isUsingGenericsOrIsArrayUsingGenerics(target)) return;
if (type==UNKNOWN_PARAMETER_TYPE) return;
if (type.isArray() && target.isArray()) {
extractGenericsConnections(connections, type.getComponentType(), target.getComponentType());
} else if (target.isGenericsPlaceHolder() || type.equals(target) || !implementsInterfaceOrIsSubclassOf(type, target)) {
// structural match route
if (target.isGenericsPlaceHolder()) {
connections.put(target.getGenericsTypes()[0].getName(),new GenericsType(type));
} else {
extractGenericsConnections(connections, type.getGenericsTypes(), target.getGenericsTypes());
}
} else {
// have first to find matching super class or interface
Map <String,ClassNode> genSpec = GenericsUtils.createGenericsSpec(type);
ClassNode superClass = getNextSuperClass(type,target);
if (superClass!=null){
ClassNode corrected;
if (missesGenericsTypes(type)) {
corrected = superClass.getPlainNodeReference();
} else {
corrected = GenericsUtils.correctToGenericsSpecRecurse(genSpec, superClass);
}
extractGenericsConnections(connections, corrected, target);
} else {
// if we reach here, we have an unhandled case
throw new GroovyBugError("The type "+type+" seems not to normally extend "+target+". Sorry, I cannot handle this.");
}
}
}
|
class class_name[name] begin[{]
method[extractGenericsConnections, return_type[void], modifier[static], parameter[connections, type, target]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.target], ==, literal[null]], ||, binary_operation[member[.type], ==, member[.target]]], ||, call[.isUsingGenericsOrIsArrayUsingGenerics, parameter[member[.target]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[.UNKNOWN_PARAMETER_TYPE]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[type.isArray, parameter[]], &&, call[target.isArray, parameter[]]]] begin[{]
call[.extractGenericsConnections, parameter[member[.connections], call[type.getComponentType, parameter[]], call[target.getComponentType, parameter[]]]]
else begin[{]
if[binary_operation[binary_operation[call[target.isGenericsPlaceHolder, parameter[]], ||, call[type.equals, parameter[member[.target]]]], ||, call[.implementsInterfaceOrIsSubclassOf, parameter[member[.type], member[.target]]]]] begin[{]
if[call[target.isGenericsPlaceHolder, parameter[]]] begin[{]
call[connections.put, parameter[call[target.getGenericsTypes, parameter[]], ClassCreator(arguments=[MemberReference(member=type, 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=GenericsType, sub_type=None))]]
else begin[{]
call[.extractGenericsConnections, parameter[member[.connections], call[type.getGenericsTypes, parameter[]], call[target.getGenericsTypes, parameter[]]]]
end[}]
else begin[{]
local_variable[type[Map], genSpec]
local_variable[type[ClassNode], superClass]
if[binary_operation[member[.superClass], !=, literal[null]]] begin[{]
local_variable[type[ClassNode], corrected]
if[call[.missesGenericsTypes, parameter[member[.type]]]] begin[{]
assign[member[.corrected], call[superClass.getPlainNodeReference, parameter[]]]
else begin[{]
assign[member[.corrected], call[GenericsUtils.correctToGenericsSpecRecurse, parameter[member[.genSpec], member[.superClass]]]]
end[}]
call[.extractGenericsConnections, parameter[member[.connections], member[.corrected], member[.target]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The type "), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" seems not to normally extend "), operator=+), operandr=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". Sorry, I cannot handle this."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GroovyBugError, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[static] Keyword[void] identifier[extractGenericsConnections] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[GenericsType] operator[>] identifier[connections] , identifier[ClassNode] identifier[type] , identifier[ClassNode] identifier[target] operator[SEP] {
Keyword[if] operator[SEP] identifier[target] operator[==] Other[null] operator[||] identifier[type] operator[==] identifier[target] operator[||] operator[!] identifier[isUsingGenericsOrIsArrayUsingGenerics] operator[SEP] identifier[target] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[UNKNOWN_PARAMETER_TYPE] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[&&] identifier[target] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
identifier[extractGenericsConnections] operator[SEP] identifier[connections] , identifier[type] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] , identifier[target] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[target] operator[SEP] identifier[isGenericsPlaceHolder] operator[SEP] operator[SEP] operator[||] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[target] operator[SEP] operator[||] operator[!] identifier[implementsInterfaceOrIsSubclassOf] operator[SEP] identifier[type] , identifier[target] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[target] operator[SEP] identifier[isGenericsPlaceHolder] operator[SEP] operator[SEP] operator[SEP] {
identifier[connections] operator[SEP] identifier[put] operator[SEP] identifier[target] operator[SEP] identifier[getGenericsTypes] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Keyword[new] identifier[GenericsType] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[extractGenericsConnections] operator[SEP] identifier[connections] , identifier[type] operator[SEP] identifier[getGenericsTypes] operator[SEP] operator[SEP] , identifier[target] operator[SEP] identifier[getGenericsTypes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Map] operator[<] identifier[String] , identifier[ClassNode] operator[>] identifier[genSpec] operator[=] identifier[GenericsUtils] operator[SEP] identifier[createGenericsSpec] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[ClassNode] identifier[superClass] operator[=] identifier[getNextSuperClass] operator[SEP] identifier[type] , identifier[target] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superClass] operator[!=] Other[null] operator[SEP] {
identifier[ClassNode] identifier[corrected] operator[SEP] Keyword[if] operator[SEP] identifier[missesGenericsTypes] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[corrected] operator[=] identifier[superClass] operator[SEP] identifier[getPlainNodeReference] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[corrected] operator[=] identifier[GenericsUtils] operator[SEP] identifier[correctToGenericsSpecRecurse] operator[SEP] identifier[genSpec] , identifier[superClass] operator[SEP] operator[SEP]
}
identifier[extractGenericsConnections] operator[SEP] identifier[connections] , identifier[corrected] , identifier[target] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[GroovyBugError] operator[SEP] literal[String] operator[+] identifier[type] operator[+] literal[String] operator[+] identifier[target] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
private void initContextMenu() {
m_contextMenu.removeItems();
MenuItem main = m_contextMenu.addItem("", null);
main.setIcon(FontOpenCms.CONTEXT_MENU);
main.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_MENU_TITLE_0));
CmsContextMenuTreeBuilder treeBuilder = new CmsContextMenuTreeBuilder(getDialogContext());
CmsTreeNode<I_CmsContextMenuItem> tree = treeBuilder.buildAll(
OpenCms.getWorkplaceAppManager().getMenuItemProvider().getMenuItems());
for (CmsTreeNode<I_CmsContextMenuItem> node : tree.getChildren()) {
createMenuEntry(main, node, treeBuilder);
}
}
|
class class_name[name] begin[{]
method[initContextMenu, return_type[void], modifier[private], parameter[]] begin[{]
call[m_contextMenu.removeItems, parameter[]]
local_variable[type[MenuItem], main]
call[main.setIcon, parameter[member[FontOpenCms.CONTEXT_MENU]]]
call[main.setDescription, parameter[call[CmsVaadinUtils.getMessageText, parameter[member[Messages.GUI_MENU_TITLE_0]]]]]
local_variable[type[CmsContextMenuTreeBuilder], treeBuilder]
local_variable[type[CmsTreeNode], tree]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=main, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=treeBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createMenuEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=tree, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=I_CmsContextMenuItem, sub_type=None))], dimensions=[], name=CmsTreeNode, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[initContextMenu] operator[SEP] operator[SEP] {
identifier[m_contextMenu] operator[SEP] identifier[removeItems] operator[SEP] operator[SEP] operator[SEP] identifier[MenuItem] identifier[main] operator[=] identifier[m_contextMenu] operator[SEP] identifier[addItem] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] identifier[main] operator[SEP] identifier[setIcon] operator[SEP] identifier[FontOpenCms] operator[SEP] identifier[CONTEXT_MENU] operator[SEP] operator[SEP] identifier[main] operator[SEP] identifier[setDescription] operator[SEP] identifier[CmsVaadinUtils] operator[SEP] identifier[getMessageText] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_MENU_TITLE_0] operator[SEP] operator[SEP] operator[SEP] identifier[CmsContextMenuTreeBuilder] identifier[treeBuilder] operator[=] Keyword[new] identifier[CmsContextMenuTreeBuilder] operator[SEP] identifier[getDialogContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CmsTreeNode] operator[<] identifier[I_CmsContextMenuItem] operator[>] identifier[tree] operator[=] identifier[treeBuilder] operator[SEP] identifier[buildAll] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getWorkplaceAppManager] operator[SEP] operator[SEP] operator[SEP] identifier[getMenuItemProvider] operator[SEP] operator[SEP] operator[SEP] identifier[getMenuItems] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CmsTreeNode] operator[<] identifier[I_CmsContextMenuItem] operator[>] identifier[node] operator[:] identifier[tree] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
identifier[createMenuEntry] operator[SEP] identifier[main] , identifier[node] , identifier[treeBuilder] operator[SEP] operator[SEP]
}
}
|
@Override
public T remove(T entity) {
EntityManager entityManager = getEntityManager();
if (entityManager.contains(entity)) {
entityManager.remove(entity);
} else {
entityManager.remove(entityManager.merge(entity));
}
return entity;
}
|
class class_name[name] begin[{]
method[remove, return_type[type[T]], modifier[public], parameter[entity]] begin[{]
local_variable[type[EntityManager], entityManager]
if[call[entityManager.contains, parameter[member[.entity]]]] begin[{]
call[entityManager.remove, parameter[member[.entity]]]
else begin[{]
call[entityManager.remove, parameter[call[entityManager.merge, parameter[member[.entity]]]]]
end[}]
return[member[.entity]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[remove] operator[SEP] identifier[T] identifier[entity] operator[SEP] {
identifier[EntityManager] identifier[entityManager] operator[=] identifier[getEntityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entityManager] operator[SEP] identifier[contains] operator[SEP] identifier[entity] operator[SEP] operator[SEP] {
identifier[entityManager] operator[SEP] identifier[remove] operator[SEP] identifier[entity] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[entityManager] operator[SEP] identifier[remove] operator[SEP] identifier[entityManager] operator[SEP] identifier[merge] operator[SEP] identifier[entity] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[entity] operator[SEP]
}
|
public Paint getTextBorderPaint(CommonControlState type, boolean inToolbar) {
if (type == CommonControlState.DISABLED) {
return textBorderDisabled;
} else if (inToolbar) {
return textBorderEnabledToolbar;
} else {
return textBorderEnabled;
}
}
|
class class_name[name] begin[{]
method[getTextBorderPaint, return_type[type[Paint]], modifier[public], parameter[type, inToolbar]] begin[{]
if[binary_operation[member[.type], ==, member[CommonControlState.DISABLED]]] begin[{]
return[member[.textBorderDisabled]]
else begin[{]
if[member[.inToolbar]] begin[{]
return[member[.textBorderEnabledToolbar]]
else begin[{]
return[member[.textBorderEnabled]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[Paint] identifier[getTextBorderPaint] operator[SEP] identifier[CommonControlState] identifier[type] , Keyword[boolean] identifier[inToolbar] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] identifier[CommonControlState] operator[SEP] identifier[DISABLED] operator[SEP] {
Keyword[return] identifier[textBorderDisabled] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[inToolbar] operator[SEP] {
Keyword[return] identifier[textBorderEnabledToolbar] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[textBorderEnabled] operator[SEP]
}
}
|
@Override
public Object initializeTransaction(long txid, Object prevMetadata, Object currMetadata)
{
if (logger.isDebugEnabled() == true)
{
String logFormat = "initializeTransaction : txid={0}, prevMetadata={1}, currMetadata={2}";
logger.debug(MessageFormat.format(logFormat, txid, prevMetadata, currMetadata));
}
return null;
}
|
class class_name[name] begin[{]
method[initializeTransaction, return_type[type[Object]], modifier[public], parameter[txid, prevMetadata, currMetadata]] begin[{]
if[binary_operation[call[logger.isDebugEnabled, parameter[]], ==, literal[true]]] begin[{]
local_variable[type[String], logFormat]
call[logger.debug, parameter[call[MessageFormat.format, parameter[member[.logFormat], member[.txid], member[.prevMetadata], member[.currMetadata]]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[initializeTransaction] operator[SEP] Keyword[long] identifier[txid] , identifier[Object] identifier[prevMetadata] , identifier[Object] identifier[currMetadata] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] {
identifier[String] identifier[logFormat] operator[=] literal[String] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[logFormat] , identifier[txid] , identifier[prevMetadata] , identifier[currMetadata] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static long xorCount(OpenBitSet a, OpenBitSet b) {
long tot = BitUtil.pop_xor( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
if (a.wlen < b.wlen) {
tot += BitUtil.pop_array( b.bits, a.wlen, b.wlen - a.wlen );
} else if (a.wlen > b.wlen) {
tot += BitUtil.pop_array( a.bits, b.wlen, a.wlen - b.wlen );
}
return tot;
}
|
class class_name[name] begin[{]
method[xorCount, return_type[type[long]], modifier[public static], parameter[a, b]] begin[{]
local_variable[type[long], tot]
if[binary_operation[member[a.wlen], <, member[b.wlen]]] begin[{]
assign[member[.tot], call[BitUtil.pop_array, parameter[member[b.bits], member[a.wlen], binary_operation[member[b.wlen], -, member[a.wlen]]]]]
else begin[{]
if[binary_operation[member[a.wlen], >, member[b.wlen]]] begin[{]
assign[member[.tot], call[BitUtil.pop_array, parameter[member[a.bits], member[b.wlen], binary_operation[member[a.wlen], -, member[b.wlen]]]]]
else begin[{]
None
end[}]
end[}]
return[member[.tot]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[long] identifier[xorCount] operator[SEP] identifier[OpenBitSet] identifier[a] , identifier[OpenBitSet] identifier[b] operator[SEP] {
Keyword[long] identifier[tot] operator[=] identifier[BitUtil] operator[SEP] identifier[pop_xor] operator[SEP] identifier[a] operator[SEP] identifier[bits] , identifier[b] operator[SEP] identifier[bits] , Other[0] , identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[a] operator[SEP] identifier[wlen] , identifier[b] operator[SEP] identifier[wlen] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[wlen] operator[<] identifier[b] operator[SEP] identifier[wlen] operator[SEP] {
identifier[tot] operator[+=] identifier[BitUtil] operator[SEP] identifier[pop_array] operator[SEP] identifier[b] operator[SEP] identifier[bits] , identifier[a] operator[SEP] identifier[wlen] , identifier[b] operator[SEP] identifier[wlen] operator[-] identifier[a] operator[SEP] identifier[wlen] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[wlen] operator[>] identifier[b] operator[SEP] identifier[wlen] operator[SEP] {
identifier[tot] operator[+=] identifier[BitUtil] operator[SEP] identifier[pop_array] operator[SEP] identifier[a] operator[SEP] identifier[bits] , identifier[b] operator[SEP] identifier[wlen] , identifier[a] operator[SEP] identifier[wlen] operator[-] identifier[b] operator[SEP] identifier[wlen] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tot] operator[SEP]
}
|
private Block convertToDeepTree(Block sourceTree, String iconName)
{
XDOM targetTree = new XDOM(Collections.<Block>emptyList());
Block pointer = targetTree;
for (Block block : sourceTree.getChildren()) {
pointer.addChild(block);
pointer = block;
}
// Add an image block as the last block
pointer.addChild(new ImageBlock(new ResourceReference(iconName, ResourceType.ICON), true));
return targetTree;
}
|
class class_name[name] begin[{]
method[convertToDeepTree, return_type[type[Block]], modifier[private], parameter[sourceTree, iconName]] begin[{]
local_variable[type[XDOM], targetTree]
local_variable[type[Block], pointer]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChild, postfix_operators=[], prefix_operators=[], qualifier=pointer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pointer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=sourceTree, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=block)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Block, sub_type=None))), label=None)
call[pointer.addChild, parameter[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=iconName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ICON, postfix_operators=[], prefix_operators=[], qualifier=ResourceType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceReference, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ImageBlock, sub_type=None))]]
return[member[.targetTree]]
end[}]
END[}]
|
Keyword[private] identifier[Block] identifier[convertToDeepTree] operator[SEP] identifier[Block] identifier[sourceTree] , identifier[String] identifier[iconName] operator[SEP] {
identifier[XDOM] identifier[targetTree] operator[=] Keyword[new] identifier[XDOM] operator[SEP] identifier[Collections] operator[SEP] operator[<] identifier[Block] operator[>] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Block] identifier[pointer] operator[=] identifier[targetTree] operator[SEP] Keyword[for] operator[SEP] identifier[Block] identifier[block] operator[:] identifier[sourceTree] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
identifier[pointer] operator[SEP] identifier[addChild] operator[SEP] identifier[block] operator[SEP] operator[SEP] identifier[pointer] operator[=] identifier[block] operator[SEP]
}
identifier[pointer] operator[SEP] identifier[addChild] operator[SEP] Keyword[new] identifier[ImageBlock] operator[SEP] Keyword[new] identifier[ResourceReference] operator[SEP] identifier[iconName] , identifier[ResourceType] operator[SEP] identifier[ICON] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[targetTree] operator[SEP]
}
|
public T withCroppedThumbnail(String path, String name, double scale, double cropWidth, double cropHeight) {
File thumbnailFile = new File(path.toString(), name);
if(!Files.exists(Paths.get(path))) {
thumbnailFile.mkdirs();
}
thumbnailImage=ImageProcessor.cropAndScale(image,scale, cropWidth, cropHeight);
FileUtil.writeImage(thumbnailImage, EXTENSION, thumbnailFile);
return self();
}
|
class class_name[name] begin[{]
method[withCroppedThumbnail, return_type[type[T]], modifier[public], parameter[path, name, scale, cropWidth, cropHeight]] begin[{]
local_variable[type[File], thumbnailFile]
if[call[Files.exists, parameter[call[Paths.get, parameter[member[.path]]]]]] begin[{]
call[thumbnailFile.mkdirs, parameter[]]
else begin[{]
None
end[}]
assign[member[.thumbnailImage], call[ImageProcessor.cropAndScale, parameter[member[.image], member[.scale], member[.cropWidth], member[.cropHeight]]]]
call[FileUtil.writeImage, parameter[member[.thumbnailImage], member[.EXTENSION], member[.thumbnailFile]]]
return[call[.self, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[T] identifier[withCroppedThumbnail] operator[SEP] identifier[String] identifier[path] , identifier[String] identifier[name] , Keyword[double] identifier[scale] , Keyword[double] identifier[cropWidth] , Keyword[double] identifier[cropHeight] operator[SEP] {
identifier[File] identifier[thumbnailFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[path] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Files] operator[SEP] identifier[exists] operator[SEP] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] {
identifier[thumbnailFile] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP]
}
identifier[thumbnailImage] operator[=] identifier[ImageProcessor] operator[SEP] identifier[cropAndScale] operator[SEP] identifier[image] , identifier[scale] , identifier[cropWidth] , identifier[cropHeight] operator[SEP] operator[SEP] identifier[FileUtil] operator[SEP] identifier[writeImage] operator[SEP] identifier[thumbnailImage] , identifier[EXTENSION] , identifier[thumbnailFile] operator[SEP] operator[SEP] Keyword[return] identifier[self] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CaptureSearchResult parseCDXLineFlexFast(String line) {
CaptureSearchResult result = new FastCaptureSearchResult();
return parseCDXLineFlex(line, result);
}
|
class class_name[name] begin[{]
method[parseCDXLineFlexFast, return_type[type[CaptureSearchResult]], modifier[public static], parameter[line]] begin[{]
local_variable[type[CaptureSearchResult], result]
return[call[.parseCDXLineFlex, parameter[member[.line], member[.result]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CaptureSearchResult] identifier[parseCDXLineFlexFast] operator[SEP] identifier[String] identifier[line] operator[SEP] {
identifier[CaptureSearchResult] identifier[result] operator[=] Keyword[new] identifier[FastCaptureSearchResult] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[parseCDXLineFlex] operator[SEP] identifier[line] , identifier[result] operator[SEP] operator[SEP]
}
|
private void standardMove(KernelPoint destination, KernelPoint source)
{
destination.InvK = source.InvK;
destination.InvKExpanded = source.InvKExpanded;
destination.K = source.K;
destination.KExpanded = source.KExpanded;
}
|
class class_name[name] begin[{]
method[standardMove, return_type[void], modifier[private], parameter[destination, source]] begin[{]
assign[member[destination.InvK], member[source.InvK]]
assign[member[destination.InvKExpanded], member[source.InvKExpanded]]
assign[member[destination.K], member[source.K]]
assign[member[destination.KExpanded], member[source.KExpanded]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[standardMove] operator[SEP] identifier[KernelPoint] identifier[destination] , identifier[KernelPoint] identifier[source] operator[SEP] {
identifier[destination] operator[SEP] identifier[InvK] operator[=] identifier[source] operator[SEP] identifier[InvK] operator[SEP] identifier[destination] operator[SEP] identifier[InvKExpanded] operator[=] identifier[source] operator[SEP] identifier[InvKExpanded] operator[SEP] identifier[destination] operator[SEP] identifier[K] operator[=] identifier[source] operator[SEP] identifier[K] operator[SEP] identifier[destination] operator[SEP] identifier[KExpanded] operator[=] identifier[source] operator[SEP] identifier[KExpanded] operator[SEP]
}
|
@Override
<T> T parseRemaining(Class<T> declaredType) throws Exception {
// the array and version has already been read
overrideBasePackage = declaredType.getPackage().getName() + ".";
// ref count + class map
parseClassDescriptions();
// parse
Object parsed = parseObject(declaredType, null, null, null, true);
return declaredType.cast(parsed);
}
|
class class_name[name] begin[{]
method[parseRemaining, return_type[type[T]], modifier[default], parameter[declaredType]] begin[{]
assign[member[.overrideBasePackage], binary_operation[call[declaredType.getPackage, parameter[]], +, literal["."]]]
call[.parseClassDescriptions, parameter[]]
local_variable[type[Object], parsed]
return[call[declaredType.cast, parameter[member[.parsed]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] operator[<] identifier[T] operator[>] identifier[T] identifier[parseRemaining] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[declaredType] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[overrideBasePackage] operator[=] identifier[declaredType] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[parseClassDescriptions] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[parsed] operator[=] identifier[parseObject] operator[SEP] identifier[declaredType] , Other[null] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[declaredType] operator[SEP] identifier[cast] operator[SEP] identifier[parsed] operator[SEP] operator[SEP]
}
|
public static int calculateInSampleSize(int originWidth, int originHeight, int reqWidth, int reqHeight) {
int inSampleSize = 1;
if (reqHeight <= 0 || reqHeight <= 0 || reqHeight == Integer.MAX_VALUE || reqWidth == Integer.MAX_VALUE) {
return inSampleSize;
}
if (originWidth > reqHeight || originHeight > reqWidth) {
final int halfHeight = originWidth / 2;
final int halfWidth = originHeight / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
while ((halfHeight / inSampleSize) > reqHeight && (halfWidth / inSampleSize) > reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
|
class class_name[name] begin[{]
method[calculateInSampleSize, return_type[type[int]], modifier[public static], parameter[originWidth, originHeight, reqWidth, reqHeight]] begin[{]
local_variable[type[int], inSampleSize]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.reqHeight], <=, literal[0]], ||, binary_operation[member[.reqHeight], <=, literal[0]]], ||, binary_operation[member[.reqHeight], ==, member[Integer.MAX_VALUE]]], ||, binary_operation[member[.reqWidth], ==, member[Integer.MAX_VALUE]]]] begin[{]
return[member[.inSampleSize]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.originWidth], >, member[.reqHeight]], ||, binary_operation[member[.originHeight], >, member[.reqWidth]]]] begin[{]
local_variable[type[int], halfHeight]
local_variable[type[int], halfWidth]
while[binary_operation[binary_operation[binary_operation[member[.halfHeight], /, member[.inSampleSize]], >, member[.reqHeight]], &&, binary_operation[binary_operation[member[.halfWidth], /, member[.inSampleSize]], >, member[.reqWidth]]]] begin[{]
assign[member[.inSampleSize], literal[2]]
end[}]
else begin[{]
None
end[}]
return[member[.inSampleSize]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[calculateInSampleSize] operator[SEP] Keyword[int] identifier[originWidth] , Keyword[int] identifier[originHeight] , Keyword[int] identifier[reqWidth] , Keyword[int] identifier[reqHeight] operator[SEP] {
Keyword[int] identifier[inSampleSize] operator[=] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[reqHeight] operator[<=] Other[0] operator[||] identifier[reqHeight] operator[<=] Other[0] operator[||] identifier[reqHeight] operator[==] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[||] identifier[reqWidth] operator[==] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] {
Keyword[return] identifier[inSampleSize] operator[SEP]
}
Keyword[if] operator[SEP] identifier[originWidth] operator[>] identifier[reqHeight] operator[||] identifier[originHeight] operator[>] identifier[reqWidth] operator[SEP] {
Keyword[final] Keyword[int] identifier[halfHeight] operator[=] identifier[originWidth] operator[/] Other[2] operator[SEP] Keyword[final] Keyword[int] identifier[halfWidth] operator[=] identifier[originHeight] operator[/] Other[2] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[halfHeight] operator[/] identifier[inSampleSize] operator[SEP] operator[>] identifier[reqHeight] operator[&&] operator[SEP] identifier[halfWidth] operator[/] identifier[inSampleSize] operator[SEP] operator[>] identifier[reqWidth] operator[SEP] {
identifier[inSampleSize] operator[*=] Other[2] operator[SEP]
}
}
Keyword[return] identifier[inSampleSize] operator[SEP]
}
|
public boolean matchContentType(String contentTypeRegex) {
if (contentTypeRegex == null) {
return contentType() == null;
}
return Pattern.matches(contentTypeRegex, contentType());
}
|
class class_name[name] begin[{]
method[matchContentType, return_type[type[boolean]], modifier[public], parameter[contentTypeRegex]] begin[{]
if[binary_operation[member[.contentTypeRegex], ==, literal[null]]] begin[{]
return[binary_operation[call[.contentType, parameter[]], ==, literal[null]]]
else begin[{]
None
end[}]
return[call[Pattern.matches, parameter[member[.contentTypeRegex], call[.contentType, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[matchContentType] operator[SEP] identifier[String] identifier[contentTypeRegex] operator[SEP] {
Keyword[if] operator[SEP] identifier[contentTypeRegex] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[contentType] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP]
}
Keyword[return] identifier[Pattern] operator[SEP] identifier[matches] operator[SEP] identifier[contentTypeRegex] , identifier[contentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object removeListener(Object bag, Object listener)
{
if (listener == null) throw new IllegalArgumentException();
if (listener instanceof Object[]) throw new IllegalArgumentException();
if (bag == listener) {
bag = null;
} else if (bag instanceof Object[]) {
Object[] array = (Object[])bag;
int L = array.length;
// bag has at least 2 elements if it is array
if (L < 2) throw new IllegalArgumentException();
if (L == 2) {
if (array[1] == listener) {
bag = array[0];
} else if (array[0] == listener) {
bag = array[1];
}
} else {
int i = L;
do {
--i;
if (array[i] == listener) {
Object[] tmp = new Object[L - 1];
System.arraycopy(array, 0, tmp, 0, i);
System.arraycopy(array, i + 1, tmp, i, L - (i + 1));
bag = tmp;
break;
}
} while (i != 0);
}
}
return bag;
}
|
class class_name[name] begin[{]
method[removeListener, return_type[type[Object]], modifier[public static], parameter[bag, listener]] begin[{]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.listener], instanceof, type[Object]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.bag], ==, member[.listener]]] begin[{]
assign[member[.bag], literal[null]]
else begin[{]
if[binary_operation[member[.bag], instanceof, type[Object]]] begin[{]
local_variable[type[Object], array]
local_variable[type[int], L]
if[binary_operation[member[.L], <, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.L], ==, literal[2]]] begin[{]
if[binary_operation[member[.array], ==, member[.listener]]] begin[{]
assign[member[.bag], member[.array]]
else begin[{]
if[binary_operation[member[.array], ==, member[.listener]]] begin[{]
assign[member[.bag], member[.array]]
else begin[{]
None
end[}]
end[}]
else begin[{]
local_variable[type[int], i]
do[binary_operation[member[.i], !=, literal[0]]] begin[{]
member[.i]
if[binary_operation[member[.array], ==, member[.listener]]] begin[{]
local_variable[type[Object], tmp]
call[System.arraycopy, parameter[member[.array], literal[0], member[.tmp], literal[0], member[.i]]]
call[System.arraycopy, parameter[member[.array], binary_operation[member[.i], +, literal[1]], member[.tmp], member[.i], binary_operation[member[.L], -, binary_operation[member[.i], +, literal[1]]]]]
assign[member[.bag], member[.tmp]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
return[member[.bag]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Object] identifier[removeListener] operator[SEP] identifier[Object] identifier[bag] , identifier[Object] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bag] operator[==] identifier[listener] operator[SEP] {
identifier[bag] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[bag] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[bag] operator[SEP] Keyword[int] identifier[L] operator[=] identifier[array] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[L] operator[<] Other[2] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[L] operator[==] Other[2] operator[SEP] {
Keyword[if] operator[SEP] identifier[array] operator[SEP] Other[1] operator[SEP] operator[==] identifier[listener] operator[SEP] {
identifier[bag] operator[=] identifier[array] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[array] operator[SEP] Other[0] operator[SEP] operator[==] identifier[listener] operator[SEP] {
identifier[bag] operator[=] identifier[array] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[int] identifier[i] operator[=] identifier[L] operator[SEP] Keyword[do] {
operator[--] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[listener] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[tmp] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[L] operator[-] Other[1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[array] , Other[0] , identifier[tmp] , Other[0] , identifier[i] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[array] , identifier[i] operator[+] Other[1] , identifier[tmp] , identifier[i] , identifier[L] operator[-] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[bag] operator[=] identifier[tmp] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[i] operator[!=] Other[0] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[bag] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.