code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static ChannelFuture sendUnsupportedVersionResponse(Channel channel, ChannelPromise promise) {
HttpResponse res = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1,
HttpResponseStatus.UPGRADE_REQUIRED);
res.headers().set(HttpHeaderNames.SEC_WEBSOCKET_VERSION, WebSocketVersion.V13.toHttpHeaderValue());
HttpUtil.setContentLength(res, 0);
return channel.writeAndFlush(res, promise);
}
|
class class_name[name] begin[{]
method[sendUnsupportedVersionResponse, return_type[type[ChannelFuture]], modifier[public static], parameter[channel, promise]] begin[{]
local_variable[type[HttpResponse], res]
call[res.headers, parameter[]]
call[HttpUtil.setContentLength, parameter[member[.res], literal[0]]]
return[call[channel.writeAndFlush, parameter[member[.res], member[.promise]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ChannelFuture] identifier[sendUnsupportedVersionResponse] operator[SEP] identifier[Channel] identifier[channel] , identifier[ChannelPromise] identifier[promise] operator[SEP] {
identifier[HttpResponse] identifier[res] operator[=] Keyword[new] identifier[DefaultFullHttpResponse] operator[SEP] identifier[HttpVersion] operator[SEP] identifier[HTTP_1_1] , identifier[HttpResponseStatus] operator[SEP] identifier[UPGRADE_REQUIRED] operator[SEP] operator[SEP] identifier[res] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[SEC_WEBSOCKET_VERSION] , identifier[WebSocketVersion] operator[SEP] identifier[V13] operator[SEP] identifier[toHttpHeaderValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[HttpUtil] operator[SEP] identifier[setContentLength] operator[SEP] identifier[res] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[channel] operator[SEP] identifier[writeAndFlush] operator[SEP] identifier[res] , identifier[promise] operator[SEP] operator[SEP]
}
|
public static void ensureDeterminantOfOne(List<Homography2D_F64> homography0toI) {
int N = homography0toI.size();
for (int i = 0; i < N; i++) {
Homography2D_F64 H = homography0toI.get(i);
double d = CommonOps_DDF3.det(H);
// System.out.println("Before = "+d);
if( d < 0 )
CommonOps_DDF3.divide(H,-Math.pow(-d,1.0/3));
else
CommonOps_DDF3.divide(H,Math.pow(d,1.0/3));
// System.out.println("determinant = "+ CommonOps_DDF3.det(H));
}
}
|
class class_name[name] begin[{]
method[ensureDeterminantOfOne, return_type[void], modifier[public static], parameter[homography0toI]] begin[{]
local_variable[type[int], N]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=homography0toI, selectors=[], type_arguments=None), name=H)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Homography2D_F64, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=H, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=det, postfix_operators=[], prefix_operators=[], qualifier=CommonOps_DDF3, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=H, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=/)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=divide, postfix_operators=[], prefix_operators=[], qualifier=CommonOps_DDF3, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=H, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=d, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=/)], member=pow, postfix_operators=[], prefix_operators=['-'], qualifier=Math, selectors=[], type_arguments=None)], member=divide, postfix_operators=[], prefix_operators=[], qualifier=CommonOps_DDF3, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=N, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[ensureDeterminantOfOne] operator[SEP] identifier[List] operator[<] identifier[Homography2D_F64] operator[>] identifier[homography0toI] operator[SEP] {
Keyword[int] identifier[N] operator[=] identifier[homography0toI] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[N] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Homography2D_F64] identifier[H] operator[=] identifier[homography0toI] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[double] identifier[d] operator[=] identifier[CommonOps_DDF3] operator[SEP] identifier[det] operator[SEP] identifier[H] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[<] Other[0] operator[SEP] identifier[CommonOps_DDF3] operator[SEP] identifier[divide] operator[SEP] identifier[H] , operator[-] identifier[Math] operator[SEP] identifier[pow] operator[SEP] operator[-] identifier[d] , literal[Float] operator[/] Other[3] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[CommonOps_DDF3] operator[SEP] identifier[divide] operator[SEP] identifier[H] , identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[d] , literal[Float] operator[/] Other[3] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public synchronized void stopCollecting() {
started = false;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
// ignore
}
thread = null;
}
}
|
class class_name[name] begin[{]
method[stopCollecting, return_type[void], modifier[synchronized public], parameter[]] begin[{]
assign[member[.started], literal[false]]
if[binary_operation[member[.thread], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=join, postfix_operators=[], prefix_operators=[], qualifier=thread, 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)
assign[member[.thread], literal[null]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[stopCollecting] operator[SEP] operator[SEP] {
identifier[started] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[thread] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[thread] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
identifier[thread] operator[=] Other[null] operator[SEP]
}
}
|
public static Class<?> rawTypeOf(Type type) {
if (type instanceof Class) {
return (Class) type;
} else if (type instanceof ParameterizedType) {
return (Class) ((ParameterizedType) type).getRawType();
} else {
throw E.unexpected("type not recognized: %s", type);
}
}
|
class class_name[name] begin[{]
method[rawTypeOf, return_type[type[Class]], modifier[public static], parameter[type]] begin[{]
if[binary_operation[member[.type], instanceof, type[Class]]] begin[{]
return[Cast(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))]
else begin[{]
if[binary_operation[member[.type], instanceof, type[ParameterizedType]]] begin[{]
return[Cast(expression=Cast(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ParameterizedType, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))]
else begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type not recognized: %s"), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unexpected, postfix_operators=[], prefix_operators=[], qualifier=E, selectors=[], type_arguments=None), label=None)
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Class] operator[<] operator[?] operator[>] identifier[rawTypeOf] operator[SEP] identifier[Type] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] Keyword[instanceof] identifier[Class] operator[SEP] {
Keyword[return] operator[SEP] identifier[Class] operator[SEP] identifier[type] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] Keyword[instanceof] identifier[ParameterizedType] operator[SEP] {
Keyword[return] operator[SEP] identifier[Class] operator[SEP] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[getRawType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[E] operator[SEP] identifier[unexpected] operator[SEP] literal[String] , identifier[type] operator[SEP] operator[SEP]
}
}
|
private void setTypeRef(Configuration conf) {
String className = conf.get(CLASS_CONF_KEY);
if (className == null) {
throw new RuntimeException(CLASS_CONF_KEY + " is not set");
}
Class<?> clazz = null;
try {
clazz = conf.getClassByName(className);
} catch (ClassNotFoundException e) {
throw new RuntimeException("failed to instantiate class '" + className + "'", e);
}
typeRef = new TypeRef<M>(clazz){};
}
|
class class_name[name] begin[{]
method[setTypeRef, return_type[void], modifier[private], parameter[conf]] begin[{]
local_variable[type[String], className]
if[binary_operation[member[.className], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CLASS_CONF_KEY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is not set"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Class], clazz]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getClassByName, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to instantiate class '"), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
assign[member[.typeRef], ClassCreator(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=M, sub_type=None))], dimensions=None, name=TypeRef, sub_type=None))]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[setTypeRef] operator[SEP] identifier[Configuration] identifier[conf] operator[SEP] {
identifier[String] identifier[className] operator[=] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[CLASS_CONF_KEY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[className] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[CLASS_CONF_KEY] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[clazz] operator[=] identifier[conf] operator[SEP] identifier[getClassByName] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[className] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[typeRef] operator[=] Keyword[new] identifier[TypeRef] operator[<] identifier[M] operator[>] operator[SEP] identifier[clazz] operator[SEP] {
} operator[SEP]
}
|
public UUID addHierarchicalEntity(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) {
return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[addHierarchicalEntity, return_type[type[UUID]], modifier[public], parameter[appId, versionId, hierarchicalModelCreateObject]] begin[{]
return[call[.addHierarchicalEntityWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.hierarchicalModelCreateObject]]]]
end[}]
END[}]
|
Keyword[public] identifier[UUID] identifier[addHierarchicalEntity] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[HierarchicalEntityModel] identifier[hierarchicalModelCreateObject] operator[SEP] {
Keyword[return] identifier[addHierarchicalEntityWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[hierarchicalModelCreateObject] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static LibertyVersionRange valueOf(String versionRangeString) {
if (versionRangeString == null) {
return null;
}
Matcher versionRangeMatcher = VERSION_RANGE_PATTERN.matcher(versionRangeString);
if (versionRangeMatcher.matches()) {
// Have a min and max so parse both
LibertyVersion minVersion = LibertyVersion.valueOf(versionRangeMatcher.group(1));
LibertyVersion maxVersion = LibertyVersion.valueOf(versionRangeMatcher.group(2));
// Make sure both were valid versions
if (minVersion != null && maxVersion != null) {
return new LibertyVersionRange(minVersion, maxVersion);
} else {
return null;
}
} else {
// It's not a range so see if it's a single version
LibertyVersion minVersion = LibertyVersion.valueOf(versionRangeString);
if (minVersion != null) {
return new LibertyVersionRange(minVersion, null);
} else {
return null;
}
}
}
|
class class_name[name] begin[{]
method[valueOf, return_type[type[LibertyVersionRange]], modifier[public static], parameter[versionRangeString]] begin[{]
if[binary_operation[member[.versionRangeString], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Matcher], versionRangeMatcher]
if[call[versionRangeMatcher.matches, parameter[]]] begin[{]
local_variable[type[LibertyVersion], minVersion]
local_variable[type[LibertyVersion], maxVersion]
if[binary_operation[binary_operation[member[.minVersion], !=, literal[null]], &&, binary_operation[member[.maxVersion], !=, literal[null]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=minVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxVersion, 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=LibertyVersionRange, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
else begin[{]
local_variable[type[LibertyVersion], minVersion]
if[binary_operation[member[.minVersion], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=minVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LibertyVersionRange, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LibertyVersionRange] identifier[valueOf] operator[SEP] identifier[String] identifier[versionRangeString] operator[SEP] {
Keyword[if] operator[SEP] identifier[versionRangeString] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Matcher] identifier[versionRangeMatcher] operator[=] identifier[VERSION_RANGE_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[versionRangeString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[versionRangeMatcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[LibertyVersion] identifier[minVersion] operator[=] identifier[LibertyVersion] operator[SEP] identifier[valueOf] operator[SEP] identifier[versionRangeMatcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[LibertyVersion] identifier[maxVersion] operator[=] identifier[LibertyVersion] operator[SEP] identifier[valueOf] operator[SEP] identifier[versionRangeMatcher] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[minVersion] operator[!=] Other[null] operator[&&] identifier[maxVersion] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[LibertyVersionRange] operator[SEP] identifier[minVersion] , identifier[maxVersion] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[else] {
identifier[LibertyVersion] identifier[minVersion] operator[=] identifier[LibertyVersion] operator[SEP] identifier[valueOf] operator[SEP] identifier[versionRangeString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[minVersion] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[LibertyVersionRange] operator[SEP] identifier[minVersion] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
}
|
public static void set(Object target, Field field, byte[] bytes)
{
PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor(field);
Object value = accessor.fromBytes(field.getType(), bytes);
set(target, field, value);
}
|
class class_name[name] begin[{]
method[set, return_type[void], modifier[public static], parameter[target, field, bytes]] begin[{]
local_variable[type[PropertyAccessor], accessor]
local_variable[type[Object], value]
call[.set, parameter[member[.target], member[.field], member[.value]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[set] operator[SEP] identifier[Object] identifier[target] , identifier[Field] identifier[field] , Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[SEP] {
identifier[PropertyAccessor] operator[<] operator[?] operator[>] identifier[accessor] operator[=] identifier[PropertyAccessorFactory] operator[SEP] identifier[getPropertyAccessor] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[Object] identifier[value] operator[=] identifier[accessor] operator[SEP] identifier[fromBytes] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[bytes] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[target] , identifier[field] , identifier[value] operator[SEP] operator[SEP]
}
|
private CmsInternalLinksValidator getValidator() {
if (m_validator == null) {
// get the content check result object
Map objects = (Map)getSettings().getDialogObject();
Object o = objects.get(CmsInternalLinkValidationDialog.class.getName());
List resources = new ArrayList();
if ((o != null) && (o instanceof List)) {
resources = (List)o;
}
m_validator = new CmsInternalLinksValidator(getCms(), resources);
}
return m_validator;
}
|
class class_name[name] begin[{]
method[getValidator, return_type[type[CmsInternalLinksValidator]], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.m_validator], ==, literal[null]]] begin[{]
local_variable[type[Map], objects]
local_variable[type[Object], o]
local_variable[type[List], resources]
if[binary_operation[binary_operation[member[.o], !=, literal[null]], &&, binary_operation[member[.o], instanceof, type[List]]]] begin[{]
assign[member[.resources], Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.m_validator], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=resources, 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=CmsInternalLinksValidator, sub_type=None))]
else begin[{]
None
end[}]
return[member[.m_validator]]
end[}]
END[}]
|
Keyword[private] identifier[CmsInternalLinksValidator] identifier[getValidator] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_validator] operator[==] Other[null] operator[SEP] {
identifier[Map] identifier[objects] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getDialogObject] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[o] operator[=] identifier[objects] operator[SEP] identifier[get] operator[SEP] identifier[CmsInternalLinkValidationDialog] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] identifier[resources] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[o] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[o] Keyword[instanceof] identifier[List] operator[SEP] operator[SEP] {
identifier[resources] operator[=] operator[SEP] identifier[List] operator[SEP] identifier[o] operator[SEP]
}
identifier[m_validator] operator[=] Keyword[new] identifier[CmsInternalLinksValidator] operator[SEP] identifier[getCms] operator[SEP] operator[SEP] , identifier[resources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[m_validator] operator[SEP]
}
|
public void validateWhitelisted(Props props) {
String id = null;
if (props.containsKey(PROXY_USER_KEY)) {
id = props.get(PROXY_USER_KEY);
Preconditions.checkArgument(
!StringUtils.isEmpty(id), PROXY_USER_KEY + " is required.");
} else if (props.containsKey(CommonJobProperties.SUBMIT_USER)) {
id = props.get(CommonJobProperties.SUBMIT_USER);
Preconditions.checkArgument(!StringUtils.isEmpty(id),
CommonJobProperties.SUBMIT_USER + " is required.");
} else {
throw new IllegalArgumentException(
"Property neither has " + PROXY_USER_KEY + " nor " + CommonJobProperties.SUBMIT_USER);
}
validateWhitelisted(id);
}
|
class class_name[name] begin[{]
method[validateWhitelisted, return_type[void], modifier[public], parameter[props]] begin[{]
local_variable[type[String], id]
if[call[props.containsKey, parameter[member[.PROXY_USER_KEY]]]] begin[{]
assign[member[.id], call[props.get, parameter[member[.PROXY_USER_KEY]]]]
call[Preconditions.checkArgument, parameter[call[StringUtils.isEmpty, parameter[member[.id]]], binary_operation[member[.PROXY_USER_KEY], +, literal[" is required."]]]]
else begin[{]
if[call[props.containsKey, parameter[member[CommonJobProperties.SUBMIT_USER]]]] begin[{]
assign[member[.id], call[props.get, parameter[member[CommonJobProperties.SUBMIT_USER]]]]
call[Preconditions.checkArgument, parameter[call[StringUtils.isEmpty, parameter[member[.id]]], binary_operation[member[CommonJobProperties.SUBMIT_USER], +, literal[" is required."]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Property neither has "), operandr=MemberReference(member=PROXY_USER_KEY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" nor "), operator=+), operandr=MemberReference(member=SUBMIT_USER, postfix_operators=[], prefix_operators=[], qualifier=CommonJobProperties, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
call[.validateWhitelisted, parameter[member[.id]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[validateWhitelisted] operator[SEP] identifier[Props] identifier[props] operator[SEP] {
identifier[String] identifier[id] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[props] operator[SEP] identifier[containsKey] operator[SEP] identifier[PROXY_USER_KEY] operator[SEP] operator[SEP] {
identifier[id] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[PROXY_USER_KEY] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[id] operator[SEP] , identifier[PROXY_USER_KEY] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[props] operator[SEP] identifier[containsKey] operator[SEP] identifier[CommonJobProperties] operator[SEP] identifier[SUBMIT_USER] operator[SEP] operator[SEP] {
identifier[id] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[CommonJobProperties] operator[SEP] identifier[SUBMIT_USER] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[id] operator[SEP] , identifier[CommonJobProperties] operator[SEP] identifier[SUBMIT_USER] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[PROXY_USER_KEY] operator[+] literal[String] operator[+] identifier[CommonJobProperties] operator[SEP] identifier[SUBMIT_USER] operator[SEP] operator[SEP]
}
identifier[validateWhitelisted] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
|
@InternalApi
public Row createRowFromProto(com.google.bigtable.v2.Row row) {
RowBuilder<Row> builder = createRowBuilder();
builder.startRow(row.getKey());
for (Family family : row.getFamiliesList()) {
for (Column column : family.getColumnsList()) {
for (Cell cell : column.getCellsList()) {
builder.startCell(
family.getName(),
column.getQualifier(),
cell.getTimestampMicros(),
cell.getLabelsList(),
cell.getValue().size());
builder.cellValue(cell.getValue());
builder.finishCell();
}
}
}
return builder.finishRow();
}
|
class class_name[name] begin[{]
method[createRowFromProto, return_type[type[Row]], modifier[public], parameter[row]] begin[{]
local_variable[type[RowBuilder], builder]
call[builder.startRow, parameter[call[row.getKey, parameter[]]]]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=family, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getQualifier, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTimestampMicros, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getLabelsList, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=startCell, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[], type_arguments=None)], member=cellValue, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=finishCell, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getCellsList, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cell)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Cell, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getColumnsList, postfix_operators=[], prefix_operators=[], qualifier=family, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=column)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Column, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFamiliesList, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=family)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Family, sub_type=None))), label=None)
return[call[builder.finishRow, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[InternalApi] Keyword[public] identifier[Row] identifier[createRowFromProto] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[bigtable] operator[SEP] identifier[v2] operator[SEP] identifier[Row] identifier[row] operator[SEP] {
identifier[RowBuilder] operator[<] identifier[Row] operator[>] identifier[builder] operator[=] identifier[createRowBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[startRow] operator[SEP] identifier[row] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Family] identifier[family] operator[:] identifier[row] operator[SEP] identifier[getFamiliesList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Column] identifier[column] operator[:] identifier[family] operator[SEP] identifier[getColumnsList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Cell] identifier[cell] operator[:] identifier[column] operator[SEP] identifier[getCellsList] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[startCell] operator[SEP] identifier[family] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[column] operator[SEP] identifier[getQualifier] operator[SEP] operator[SEP] , identifier[cell] operator[SEP] identifier[getTimestampMicros] operator[SEP] operator[SEP] , identifier[cell] operator[SEP] identifier[getLabelsList] operator[SEP] operator[SEP] , identifier[cell] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[cellValue] operator[SEP] identifier[cell] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[finishCell] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[builder] operator[SEP] identifier[finishRow] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean checkpw(String plaintext, String hashed) {
return (hashed.compareTo(hashpw(plaintext, hashed)) == 0);
}
|
class class_name[name] begin[{]
method[checkpw, return_type[type[boolean]], modifier[public static], parameter[plaintext, hashed]] begin[{]
return[binary_operation[call[hashed.compareTo, parameter[call[.hashpw, parameter[member[.plaintext], member[.hashed]]]]], ==, literal[0]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[checkpw] operator[SEP] identifier[String] identifier[plaintext] , identifier[String] identifier[hashed] operator[SEP] {
Keyword[return] operator[SEP] identifier[hashed] operator[SEP] identifier[compareTo] operator[SEP] identifier[hashpw] operator[SEP] identifier[plaintext] , identifier[hashed] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP]
}
|
public ConsulResponse<Map<String, List<String>>> getServices(
@SuppressWarnings("SameParameterValue") final String datacenter, @SuppressWarnings("SameParameterValue") final String tag,
final RequestOptions requestOptions) {
final URI uri = createURI("/services");
final HttpRequestBuilder httpRequestBuilder = RequestUtils.getHttpRequestBuilder(datacenter, tag, requestOptions, "/");
HTTP.Response httpResponse = HTTP.getResponse(uri.toString() + "?" + httpRequestBuilder.paramString());
if (httpResponse.code() != 200) {
die("Unable to retrieve the datacenters", uri, httpResponse.code(), httpResponse.body());
}
//noinspection unchecked
return (ConsulResponse<Map<String, List<String>>>) (Object) RequestUtils.consulResponse(Map.class, httpResponse);
}
|
class class_name[name] begin[{]
method[getServices, return_type[type[ConsulResponse]], modifier[public], parameter[datacenter, tag, requestOptions]] begin[{]
local_variable[type[URI], uri]
local_variable[type[HttpRequestBuilder], httpRequestBuilder]
local_variable[type[HTTP], httpResponse]
if[binary_operation[call[httpResponse.code, parameter[]], !=, literal[200]]] begin[{]
call[.die, parameter[literal["Unable to retrieve the datacenters"], member[.uri], call[httpResponse.code, parameter[]], call[httpResponse.body, parameter[]]]]
else begin[{]
None
end[}]
return[Cast(expression=Cast(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Map, sub_type=None)), MemberReference(member=httpResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=consulResponse, postfix_operators=[], prefix_operators=[], qualifier=RequestUtils, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=[], name=ConsulResponse, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[ConsulResponse] operator[<] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[>] identifier[getServices] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[datacenter] , annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[tag] , Keyword[final] identifier[RequestOptions] identifier[requestOptions] operator[SEP] {
Keyword[final] identifier[URI] identifier[uri] operator[=] identifier[createURI] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[HttpRequestBuilder] identifier[httpRequestBuilder] operator[=] identifier[RequestUtils] operator[SEP] identifier[getHttpRequestBuilder] operator[SEP] identifier[datacenter] , identifier[tag] , identifier[requestOptions] , literal[String] operator[SEP] operator[SEP] identifier[HTTP] operator[SEP] identifier[Response] identifier[httpResponse] operator[=] identifier[HTTP] operator[SEP] identifier[getResponse] operator[SEP] identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[httpRequestBuilder] operator[SEP] identifier[paramString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpResponse] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[!=] Other[200] operator[SEP] {
identifier[die] operator[SEP] literal[String] , identifier[uri] , identifier[httpResponse] operator[SEP] identifier[code] operator[SEP] operator[SEP] , identifier[httpResponse] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[ConsulResponse] operator[<] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] identifier[Object] operator[SEP] identifier[RequestUtils] operator[SEP] identifier[consulResponse] operator[SEP] identifier[Map] operator[SEP] Keyword[class] , identifier[httpResponse] operator[SEP] operator[SEP]
}
|
public Formula getFormula() {
Reagent[] reagents = new Reagent[] {HEADER_NAME, HEADER_VALUE, SOURCE};
final Formula rslt = new SimpleFormula(ServletSetDateHeaderTask.class, reagents);
return rslt;
}
|
class class_name[name] begin[{]
method[getFormula, return_type[type[Formula]], modifier[public], parameter[]] begin[{]
local_variable[type[Reagent], reagents]
local_variable[type[Formula], rslt]
return[member[.rslt]]
end[}]
END[}]
|
Keyword[public] identifier[Formula] identifier[getFormula] operator[SEP] operator[SEP] {
identifier[Reagent] operator[SEP] operator[SEP] identifier[reagents] operator[=] Keyword[new] identifier[Reagent] operator[SEP] operator[SEP] {
identifier[HEADER_NAME] , identifier[HEADER_VALUE] , identifier[SOURCE]
} operator[SEP] Keyword[final] identifier[Formula] identifier[rslt] operator[=] Keyword[new] identifier[SimpleFormula] operator[SEP] identifier[ServletSetDateHeaderTask] operator[SEP] Keyword[class] , identifier[reagents] operator[SEP] operator[SEP] Keyword[return] identifier[rslt] operator[SEP]
}
|
public void write(String logService, LogLevel level, String msg)
{
doFileWrite(logService, level, msg, null);
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[logService, level, msg]] begin[{]
call[.doFileWrite, parameter[member[.logService], member[.level], member[.msg], literal[null]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[String] identifier[logService] , identifier[LogLevel] identifier[level] , identifier[String] identifier[msg] operator[SEP] {
identifier[doFileWrite] operator[SEP] identifier[logService] , identifier[level] , identifier[msg] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public CreatePlacementResult createPlacement(CreatePlacementRequest request) {
request = beforeClientExecution(request);
return executeCreatePlacement(request);
}
|
class class_name[name] begin[{]
method[createPlacement, return_type[type[CreatePlacementResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeCreatePlacement, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[CreatePlacementResult] identifier[createPlacement] operator[SEP] identifier[CreatePlacementRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeCreatePlacement] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private static CowFace getCowFace(final CommandLine commandLine) {
CowFace cowFace;
cowFace = new CowFace();
if (commandLine.hasOption(CowsayCli.Opt.EYES.toString())) {
cowFace.setEyes(commandLine.getOptionValue(CowsayCli.Opt.EYES.toString()));
}
if (commandLine.hasOption(CowsayCli.Opt.TONGUE.toString())) {
cowFace.setTongue(commandLine.getOptionValue(CowsayCli.Opt.TONGUE.toString()));
}
return cowFace;
}
|
class class_name[name] begin[{]
method[getCowFace, return_type[type[CowFace]], modifier[private static], parameter[commandLine]] begin[{]
local_variable[type[CowFace], cowFace]
assign[member[.cowFace], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CowFace, sub_type=None))]
if[call[commandLine.hasOption, parameter[call[CowsayCli.Opt.EYES.toString, parameter[]]]]] begin[{]
call[cowFace.setEyes, parameter[call[commandLine.getOptionValue, parameter[call[CowsayCli.Opt.EYES.toString, parameter[]]]]]]
else begin[{]
None
end[}]
if[call[commandLine.hasOption, parameter[call[CowsayCli.Opt.TONGUE.toString, parameter[]]]]] begin[{]
call[cowFace.setTongue, parameter[call[commandLine.getOptionValue, parameter[call[CowsayCli.Opt.TONGUE.toString, parameter[]]]]]]
else begin[{]
None
end[}]
return[member[.cowFace]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[CowFace] identifier[getCowFace] operator[SEP] Keyword[final] identifier[CommandLine] identifier[commandLine] operator[SEP] {
identifier[CowFace] identifier[cowFace] operator[SEP] identifier[cowFace] operator[=] Keyword[new] identifier[CowFace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commandLine] operator[SEP] identifier[hasOption] operator[SEP] identifier[CowsayCli] operator[SEP] identifier[Opt] operator[SEP] identifier[EYES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[cowFace] operator[SEP] identifier[setEyes] operator[SEP] identifier[commandLine] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CowsayCli] operator[SEP] identifier[Opt] operator[SEP] identifier[EYES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[commandLine] operator[SEP] identifier[hasOption] operator[SEP] identifier[CowsayCli] operator[SEP] identifier[Opt] operator[SEP] identifier[TONGUE] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[cowFace] operator[SEP] identifier[setTongue] operator[SEP] identifier[commandLine] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CowsayCli] operator[SEP] identifier[Opt] operator[SEP] identifier[TONGUE] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cowFace] operator[SEP]
}
|
public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof Interval)) {
throw new SuperCsvCellProcessorException(Interval.class, value,
context, this);
}
final Interval interval = (Interval) value;
final String result = interval.toString();
return next.execute(result, context);
}
|
class class_name[name] begin[{]
method[execute, return_type[type[Object]], modifier[public], parameter[value, context]] begin[{]
call[.validateInputNotNull, parameter[member[.value], member[.context]]]
if[binary_operation[member[.value], instanceof, type[Interval]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Interval, sub_type=None)), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SuperCsvCellProcessorException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Interval], interval]
local_variable[type[String], result]
return[call[next.execute, parameter[member[.result], member[.context]]]]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[execute] operator[SEP] Keyword[final] identifier[Object] identifier[value] , Keyword[final] identifier[CsvContext] identifier[context] operator[SEP] {
identifier[validateInputNotNull] operator[SEP] identifier[value] , identifier[context] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[value] Keyword[instanceof] identifier[Interval] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SuperCsvCellProcessorException] operator[SEP] identifier[Interval] operator[SEP] Keyword[class] , identifier[value] , identifier[context] , Keyword[this] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Interval] identifier[interval] operator[=] operator[SEP] identifier[Interval] operator[SEP] identifier[value] operator[SEP] Keyword[final] identifier[String] identifier[result] operator[=] identifier[interval] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[next] operator[SEP] identifier[execute] operator[SEP] identifier[result] , identifier[context] operator[SEP] operator[SEP]
}
|
private void internalRelease()
{
_facesContext = null;
_componentInstance = null;
_created = false;
_childrenAdded = null;
_facetsAdded = null;
}
|
class class_name[name] begin[{]
method[internalRelease, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[._facesContext], literal[null]]
assign[member[._componentInstance], literal[null]]
assign[member[._created], literal[false]]
assign[member[._childrenAdded], literal[null]]
assign[member[._facetsAdded], literal[null]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[internalRelease] operator[SEP] operator[SEP] {
identifier[_facesContext] operator[=] Other[null] operator[SEP] identifier[_componentInstance] operator[=] Other[null] operator[SEP] identifier[_created] operator[=] literal[boolean] operator[SEP] identifier[_childrenAdded] operator[=] Other[null] operator[SEP] identifier[_facetsAdded] operator[=] Other[null] operator[SEP]
}
|
protected int readUCS2(char[] ch, int offset, int length) throws IOException {
int byteLength = length << 1;
if (byteLength > fBuffer.length) {
byteLength = fBuffer.length;
}
int count = fInputStream.read(fBuffer, 0, byteLength);
if (count == -1) {
return -1;
}
// try and make count be a multiple of the number of bytes we're
// looking for (simply reading 1 to 3 bytes from input stream to
// ensure the last code point is complete)
int numToRead = count & 1;
if (numToRead != 0) {
count++;
int charRead = fInputStream.read();
if (charRead == -1) { // end of input; something likely went
// wrong! Pad buffer with nulls.
fBuffer[count] = 0;
} else {
fBuffer[count] = (byte) charRead;
}
}
// now count is a multiple of the right number of bytes
int numChars = count >> 1;
int curPos = 0;
for (int i = 0; i < numChars; i++) {
int b0 = fBuffer[curPos++] & 0xff;
int b1 = fBuffer[curPos++] & 0xff;
if (fEncoding == UCS2BE) {
ch[offset + i] = (char) ((b0 << 8) + b1);
} else {
ch[offset + i] = (char) ((b1 << 8) + b0);
}
}
return numChars;
}
|
class class_name[name] begin[{]
method[readUCS2, return_type[type[int]], modifier[protected], parameter[ch, offset, length]] begin[{]
local_variable[type[int], byteLength]
if[binary_operation[member[.byteLength], >, member[fBuffer.length]]] begin[{]
assign[member[.byteLength], member[fBuffer.length]]
else begin[{]
None
end[}]
local_variable[type[int], count]
if[binary_operation[member[.count], ==, literal[1]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], numToRead]
if[binary_operation[member[.numToRead], !=, literal[0]]] begin[{]
member[.count]
local_variable[type[int], charRead]
if[binary_operation[member[.charRead], ==, literal[1]]] begin[{]
assign[member[.fBuffer], literal[0]]
else begin[{]
assign[member[.fBuffer], Cast(expression=MemberReference(member=charRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
end[}]
else begin[{]
None
end[}]
local_variable[type[int], numChars]
local_variable[type[int], curPos]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=fBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=curPos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=b0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=fBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=curPos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=b1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fEncoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=UCS2BE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), type==, value=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<), operandr=MemberReference(member=b0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), type=BasicType(dimensions=[], name=char))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), type==, value=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<), operandr=MemberReference(member=b1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), type=BasicType(dimensions=[], name=char))), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numChars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.numChars]]
end[}]
END[}]
|
Keyword[protected] Keyword[int] identifier[readUCS2] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[ch] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[byteLength] operator[=] identifier[length] operator[<<] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[byteLength] operator[>] identifier[fBuffer] operator[SEP] identifier[length] operator[SEP] {
identifier[byteLength] operator[=] identifier[fBuffer] operator[SEP] identifier[length] operator[SEP]
}
Keyword[int] identifier[count] operator[=] identifier[fInputStream] operator[SEP] identifier[read] operator[SEP] identifier[fBuffer] , Other[0] , identifier[byteLength] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[int] identifier[numToRead] operator[=] identifier[count] operator[&] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[numToRead] operator[!=] Other[0] operator[SEP] {
identifier[count] operator[++] operator[SEP] Keyword[int] identifier[charRead] operator[=] identifier[fInputStream] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[charRead] operator[==] operator[-] Other[1] operator[SEP] {
identifier[fBuffer] operator[SEP] identifier[count] operator[SEP] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[fBuffer] operator[SEP] identifier[count] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[charRead] operator[SEP]
}
}
Keyword[int] identifier[numChars] operator[=] identifier[count] operator[>] operator[>] Other[1] operator[SEP] Keyword[int] identifier[curPos] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numChars] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[b0] operator[=] identifier[fBuffer] operator[SEP] identifier[curPos] operator[++] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[int] identifier[b1] operator[=] identifier[fBuffer] operator[SEP] identifier[curPos] operator[++] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[if] operator[SEP] identifier[fEncoding] operator[==] identifier[UCS2BE] operator[SEP] {
identifier[ch] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[b0] operator[<<] Other[8] operator[SEP] operator[+] identifier[b1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ch] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[b1] operator[<<] Other[8] operator[SEP] operator[+] identifier[b0] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[numChars] operator[SEP]
}
|
public static <T> boolean xMatch(final Stream<T> stream, final int num, final Predicate<? super T> c) {
return stream.filter(t -> c.test(t))
.collect(java.util.stream.Collectors.counting()) == num;
}
|
class class_name[name] begin[{]
method[xMatch, return_type[type[boolean]], modifier[public static], parameter[stream, num, c]] begin[{]
return[binary_operation[call[stream.filter, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=test, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]], ==, member[.num]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[boolean] identifier[xMatch] operator[SEP] Keyword[final] identifier[Stream] operator[<] identifier[T] operator[>] identifier[stream] , Keyword[final] Keyword[int] identifier[num] , Keyword[final] identifier[Predicate] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[c] operator[SEP] {
Keyword[return] identifier[stream] operator[SEP] identifier[filter] operator[SEP] identifier[t] operator[->] identifier[c] operator[SEP] identifier[test] operator[SEP] identifier[t] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[stream] operator[SEP] identifier[Collectors] operator[SEP] identifier[counting] operator[SEP] operator[SEP] operator[SEP] operator[==] identifier[num] operator[SEP]
}
|
@Override
public long getPausedWorkerCount() {
return PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, Long>() {
/**
* {@inheritDoc}
*/
@Override
public Long doWork(final Jedis jedis) throws Exception {
long pausedCount = 0L;
final Set<String> workerNames = jedis.smembers(key(WORKERS));
for (final String workerName : workerNames) {
if (isWorkerInState(workerName, WorkerInfo.State.PAUSED, jedis)) {
pausedCount++;
}
}
return pausedCount;
}
});
}
|
class class_name[name] begin[{]
method[getPausedWorkerCount, return_type[type[long]], modifier[public], parameter[]] begin[{]
return[call[PoolUtils.doWorkInPoolNicely, parameter[THIS[member[None.jedisPool]], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), name=pausedCount)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=WORKERS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=smembers, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None), name=workerNames)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=workerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PAUSED, postfix_operators=[], prefix_operators=[], qualifier=WorkerInfo.State, selectors=[]), MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isWorkerInState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=pausedCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=workerNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=workerName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=pausedCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=/**
* {@inheritDoc}
*/, modifiers={'public'}, name=doWork, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=jedis, type=ReferenceType(arguments=None, dimensions=[], name=Jedis, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None), throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Jedis, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=None, name=PoolWork, sub_type=None))]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[getPausedWorkerCount] operator[SEP] operator[SEP] {
Keyword[return] identifier[PoolUtils] operator[SEP] identifier[doWorkInPoolNicely] operator[SEP] Keyword[this] operator[SEP] identifier[jedisPool] , Keyword[new] identifier[PoolWork] operator[<] identifier[Jedis] , identifier[Long] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Long] identifier[doWork] operator[SEP] Keyword[final] identifier[Jedis] identifier[jedis] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[long] identifier[pausedCount] operator[=] Other[0L] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[workerNames] operator[=] identifier[jedis] operator[SEP] identifier[smembers] operator[SEP] identifier[key] operator[SEP] identifier[WORKERS] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[workerName] operator[:] identifier[workerNames] operator[SEP] {
Keyword[if] operator[SEP] identifier[isWorkerInState] operator[SEP] identifier[workerName] , identifier[WorkerInfo] operator[SEP] identifier[State] operator[SEP] identifier[PAUSED] , identifier[jedis] operator[SEP] operator[SEP] {
identifier[pausedCount] operator[++] operator[SEP]
}
}
Keyword[return] identifier[pausedCount] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public void changePermissions(String filename, String permissions)
throws SftpStatusException, SshException {
SftpFileAttributes attrs = new SftpFileAttributes(this,
SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
attrs.setPermissions(permissions);
setAttributes(filename, attrs);
}
|
class class_name[name] begin[{]
method[changePermissions, return_type[void], modifier[public], parameter[filename, permissions]] begin[{]
local_variable[type[SftpFileAttributes], attrs]
call[attrs.setPermissions, parameter[member[.permissions]]]
call[.setAttributes, parameter[member[.filename], member[.attrs]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[changePermissions] operator[SEP] identifier[String] identifier[filename] , identifier[String] identifier[permissions] operator[SEP] Keyword[throws] identifier[SftpStatusException] , identifier[SshException] {
identifier[SftpFileAttributes] identifier[attrs] operator[=] Keyword[new] identifier[SftpFileAttributes] operator[SEP] Keyword[this] , identifier[SftpFileAttributes] operator[SEP] identifier[SSH_FILEXFER_TYPE_UNKNOWN] operator[SEP] operator[SEP] identifier[attrs] operator[SEP] identifier[setPermissions] operator[SEP] identifier[permissions] operator[SEP] operator[SEP] identifier[setAttributes] operator[SEP] identifier[filename] , identifier[attrs] operator[SEP] operator[SEP]
}
|
protected void bprop(int target) {
assert (target != missing_int_value); // no correction of weights/biases for missing label
float m = momentum();
float r = _minfo.adaDelta() ? 0 : rate(_minfo.get_processed_total()) * (1f - m);
float g; //partial derivative dE/dy * dy/dnet
final float rows = _a.size();
for( int row = 0; row < rows; row++ ) {
final float t = (row == target ? 1f : 0f);
final float y = _a.get(row);
//dy/dnet = derivative of softmax = (1-y)*y
if (params.loss == Loss.CrossEntropy) {
//nothing else needed, -dCE/dy * dy/dnet = target - y
//cf. http://www.stanford.edu/group/pdplab/pdphandbook/handbookch6.html
g = t - y;
} else {
assert(params.loss == Loss.MeanSquare);
//-dMSE/dy = target-y
g = (t - y) * (1f - y) * y;
}
// this call expects dE/dnet
bprop(row, g, r, m);
}
}
|
class class_name[name] begin[{]
method[bprop, return_type[void], modifier[protected], parameter[target]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=missing_int_value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), label=None, value=None)
local_variable[type[float], m]
local_variable[type[float], r]
local_variable[type[float], g]
local_variable[type[float], rows]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0f), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1f)), name=t)], modifiers={'final'}, type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_a, selectors=[], type_arguments=None), name=y)], modifiers={'final'}, type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=loss, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[]), operandr=MemberReference(member=CrossEntropy, postfix_operators=[], prefix_operators=[], qualifier=Loss, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=loss, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[]), operandr=MemberReference(member=MeanSquare, postfix_operators=[], prefix_operators=[], qualifier=Loss, selectors=[]), operator===), label=None, value=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1f), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operator=*), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bprop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=rows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=row)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=row, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[bprop] operator[SEP] Keyword[int] identifier[target] operator[SEP] {
Keyword[assert] operator[SEP] identifier[target] operator[!=] identifier[missing_int_value] operator[SEP] operator[SEP] Keyword[float] identifier[m] operator[=] identifier[momentum] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[r] operator[=] identifier[_minfo] operator[SEP] identifier[adaDelta] operator[SEP] operator[SEP] operator[?] Other[0] operator[:] identifier[rate] operator[SEP] identifier[_minfo] operator[SEP] identifier[get_processed_total] operator[SEP] operator[SEP] operator[SEP] operator[*] operator[SEP] literal[Float] operator[-] identifier[m] operator[SEP] operator[SEP] Keyword[float] identifier[g] operator[SEP] Keyword[final] Keyword[float] identifier[rows] operator[=] identifier[_a] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[row] operator[=] Other[0] operator[SEP] identifier[row] operator[<] identifier[rows] operator[SEP] identifier[row] operator[++] operator[SEP] {
Keyword[final] Keyword[float] identifier[t] operator[=] operator[SEP] identifier[row] operator[==] identifier[target] operator[?] literal[Float] operator[:] literal[Float] operator[SEP] operator[SEP] Keyword[final] Keyword[float] identifier[y] operator[=] identifier[_a] operator[SEP] identifier[get] operator[SEP] identifier[row] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[params] operator[SEP] identifier[loss] operator[==] identifier[Loss] operator[SEP] identifier[CrossEntropy] operator[SEP] {
identifier[g] operator[=] identifier[t] operator[-] identifier[y] operator[SEP]
}
Keyword[else] {
Keyword[assert] operator[SEP] identifier[params] operator[SEP] identifier[loss] operator[==] identifier[Loss] operator[SEP] identifier[MeanSquare] operator[SEP] operator[SEP] identifier[g] operator[=] operator[SEP] identifier[t] operator[-] identifier[y] operator[SEP] operator[*] operator[SEP] literal[Float] operator[-] identifier[y] operator[SEP] operator[*] identifier[y] operator[SEP]
}
identifier[bprop] operator[SEP] identifier[row] , identifier[g] , identifier[r] , identifier[m] operator[SEP] operator[SEP]
}
}
|
public static DateValue add(DateValue date, DateValue duration) {
DTBuilder db = new DTBuilder(date);
db.year += duration.year();
db.month += duration.month();
db.day += duration.day();
if (duration instanceof TimeValue) {
TimeValue tdur = (TimeValue) duration;
db.hour += tdur.hour();
db.minute += tdur.minute();
db.second += tdur.second();
return db.toDateTime();
}
return (date instanceof TimeValue) ? db.toDateTime() : db.toDate();
}
|
class class_name[name] begin[{]
method[add, return_type[type[DateValue]], modifier[public static], parameter[date, duration]] begin[{]
local_variable[type[DTBuilder], db]
assign[member[db.year], call[duration.year, parameter[]]]
assign[member[db.month], call[duration.month, parameter[]]]
assign[member[db.day], call[duration.day, parameter[]]]
if[binary_operation[member[.duration], instanceof, type[TimeValue]]] begin[{]
local_variable[type[TimeValue], tdur]
assign[member[db.hour], call[tdur.hour, parameter[]]]
assign[member[db.minute], call[tdur.minute, parameter[]]]
assign[member[db.second], call[tdur.second, parameter[]]]
return[call[db.toDateTime, parameter[]]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=TimeValue, sub_type=None), operator=instanceof), if_false=MethodInvocation(arguments=[], member=toDate, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=toDateTime, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DateValue] identifier[add] operator[SEP] identifier[DateValue] identifier[date] , identifier[DateValue] identifier[duration] operator[SEP] {
identifier[DTBuilder] identifier[db] operator[=] Keyword[new] identifier[DTBuilder] operator[SEP] identifier[date] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[year] operator[+=] identifier[duration] operator[SEP] identifier[year] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[month] operator[+=] identifier[duration] operator[SEP] identifier[month] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[day] operator[+=] identifier[duration] operator[SEP] identifier[day] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[duration] Keyword[instanceof] identifier[TimeValue] operator[SEP] {
identifier[TimeValue] identifier[tdur] operator[=] operator[SEP] identifier[TimeValue] operator[SEP] identifier[duration] operator[SEP] identifier[db] operator[SEP] identifier[hour] operator[+=] identifier[tdur] operator[SEP] identifier[hour] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[minute] operator[+=] identifier[tdur] operator[SEP] identifier[minute] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[second] operator[+=] identifier[tdur] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[db] operator[SEP] identifier[toDateTime] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[date] Keyword[instanceof] identifier[TimeValue] operator[SEP] operator[?] identifier[db] operator[SEP] identifier[toDateTime] operator[SEP] operator[SEP] operator[:] identifier[db] operator[SEP] identifier[toDate] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void run() {
ApplicationContext ctx = ApplicationContext.getInstance();
LOGGER.debug("Starting resolution process on {}...",new Date());
try(WriteSession session=ctx.createSession()) {
ResourceSnapshot snapshot=
session.find(
ResourceSnapshot.class,
this.name,
DynamicResourceHandler.class);
DataSet dataSet = this.handler.get(snapshot);
Individual<?,?> individual =
dataSet.
individualOfId(ManagedIndividualId.createId(snapshot.name(),snapshot.templateId()));
SnapshotResolver snapshotResolver =
SnapshotResolver.
builder().
withReadSession(session).
withCanonicalBase(CANONICAL_BASE).
build();
URI snapshotEndpoint = snapshotResolver.toURI(snapshot);
individual.
addValue(
SNAPSHOT_ENDPOINT,
Literals.newLiteral(snapshotEndpoint));
individual.
addValue(
SNAPSHOT_RESOLUTION,
Literals.newLiteral(roundtrip(snapshotResolver,snapshotEndpoint,snapshot)));
this.handler.update(this.name, dataSet);
session.modify(snapshot);
session.saveChanges();
} catch (Exception e) {
LOGGER.error("Could not resolve resource",e);
} finally {
LOGGER.debug("Finalized resolution process");
}
}
|
class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[ApplicationContext], ctx]
call[LOGGER.debug, parameter[literal["Starting resolution process on {}..."], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceSnapshot, sub_type=None)), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DynamicResourceHandler, sub_type=None))], member=find, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), name=snapshot)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResourceSnapshot, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=handler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=dataSet)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataSet, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=templateId, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=createId, postfix_operators=[], prefix_operators=[], qualifier=ManagedIndividualId, selectors=[], type_arguments=None)], member=individualOfId, postfix_operators=[], prefix_operators=[], qualifier=dataSet, selectors=[], type_arguments=None), name=individual)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Individual, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=builder, postfix_operators=[], prefix_operators=[], qualifier=SnapshotResolver, selectors=[MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withReadSession, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CANONICAL_BASE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withCanonicalBase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=snapshotResolver)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SnapshotResolver, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=snapshotResolver, selectors=[], type_arguments=None), name=snapshotEndpoint)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SNAPSHOT_ENDPOINT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=snapshotEndpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newLiteral, postfix_operators=[], prefix_operators=[], qualifier=Literals, selectors=[], type_arguments=None)], member=addValue, postfix_operators=[], prefix_operators=[], qualifier=individual, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SNAPSHOT_RESOLUTION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=snapshotResolver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=snapshotEndpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=roundtrip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=newLiteral, postfix_operators=[], prefix_operators=[], qualifier=Literals, selectors=[], type_arguments=None)], member=addValue, postfix_operators=[], prefix_operators=[], qualifier=individual, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=handler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=dataSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=modify, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=saveChanges, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not resolve resource"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Finalized resolution process")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, resources=[TryResource(annotations=[], modifiers=set(), name=session, type=ReferenceType(arguments=None, dimensions=[], name=WriteSession, sub_type=None), value=MethodInvocation(arguments=[], member=createSession, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None))])
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[ApplicationContext] identifier[ctx] operator[=] identifier[ApplicationContext] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[WriteSession] identifier[session] operator[=] identifier[ctx] operator[SEP] identifier[createSession] operator[SEP] operator[SEP] operator[SEP] {
identifier[ResourceSnapshot] identifier[snapshot] operator[=] identifier[session] operator[SEP] identifier[find] operator[SEP] identifier[ResourceSnapshot] operator[SEP] Keyword[class] , Keyword[this] operator[SEP] identifier[name] , identifier[DynamicResourceHandler] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[DataSet] identifier[dataSet] operator[=] Keyword[this] operator[SEP] identifier[handler] operator[SEP] identifier[get] operator[SEP] identifier[snapshot] operator[SEP] operator[SEP] identifier[Individual] operator[<] operator[?] , operator[?] operator[>] identifier[individual] operator[=] identifier[dataSet] operator[SEP] identifier[individualOfId] operator[SEP] identifier[ManagedIndividualId] operator[SEP] identifier[createId] operator[SEP] identifier[snapshot] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[snapshot] operator[SEP] identifier[templateId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[SnapshotResolver] identifier[snapshotResolver] operator[=] identifier[SnapshotResolver] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[withReadSession] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[withCanonicalBase] operator[SEP] identifier[CANONICAL_BASE] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[URI] identifier[snapshotEndpoint] operator[=] identifier[snapshotResolver] operator[SEP] identifier[toURI] operator[SEP] identifier[snapshot] operator[SEP] operator[SEP] identifier[individual] operator[SEP] identifier[addValue] operator[SEP] identifier[SNAPSHOT_ENDPOINT] , identifier[Literals] operator[SEP] identifier[newLiteral] operator[SEP] identifier[snapshotEndpoint] operator[SEP] operator[SEP] operator[SEP] identifier[individual] operator[SEP] identifier[addValue] operator[SEP] identifier[SNAPSHOT_RESOLUTION] , identifier[Literals] operator[SEP] identifier[newLiteral] operator[SEP] identifier[roundtrip] operator[SEP] identifier[snapshotResolver] , identifier[snapshotEndpoint] , identifier[snapshot] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[handler] operator[SEP] identifier[update] operator[SEP] Keyword[this] operator[SEP] identifier[name] , identifier[dataSet] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[modify] operator[SEP] identifier[snapshot] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[saveChanges] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
private void addLinkValue(String targetObjID) {
int targetShardNo = getTargetObjectShardNumber(targetObjID);
if (targetShardNo > 0 && m_linkDef.isSharded()) {
m_dbTran.addShardedLinkValue(m_dbObj.getObjectID(), m_linkDef, targetObjID, targetShardNo);
} else {
m_dbTran.addLinkValue(m_dbObj.getObjectID(), m_linkDef, targetObjID);
}
addInverseLinkValue(targetObjID);
}
|
class class_name[name] begin[{]
method[addLinkValue, return_type[void], modifier[private], parameter[targetObjID]] begin[{]
local_variable[type[int], targetShardNo]
if[binary_operation[binary_operation[member[.targetShardNo], >, literal[0]], &&, call[m_linkDef.isSharded, parameter[]]]] begin[{]
call[m_dbTran.addShardedLinkValue, parameter[call[m_dbObj.getObjectID, parameter[]], member[.m_linkDef], member[.targetObjID], member[.targetShardNo]]]
else begin[{]
call[m_dbTran.addLinkValue, parameter[call[m_dbObj.getObjectID, parameter[]], member[.m_linkDef], member[.targetObjID]]]
end[}]
call[.addInverseLinkValue, parameter[member[.targetObjID]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[addLinkValue] operator[SEP] identifier[String] identifier[targetObjID] operator[SEP] {
Keyword[int] identifier[targetShardNo] operator[=] identifier[getTargetObjectShardNumber] operator[SEP] identifier[targetObjID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetShardNo] operator[>] Other[0] operator[&&] identifier[m_linkDef] operator[SEP] identifier[isSharded] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_dbTran] operator[SEP] identifier[addShardedLinkValue] operator[SEP] identifier[m_dbObj] operator[SEP] identifier[getObjectID] operator[SEP] operator[SEP] , identifier[m_linkDef] , identifier[targetObjID] , identifier[targetShardNo] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[m_dbTran] operator[SEP] identifier[addLinkValue] operator[SEP] identifier[m_dbObj] operator[SEP] identifier[getObjectID] operator[SEP] operator[SEP] , identifier[m_linkDef] , identifier[targetObjID] operator[SEP] operator[SEP]
}
identifier[addInverseLinkValue] operator[SEP] identifier[targetObjID] operator[SEP] operator[SEP]
}
|
@Deprecated
public static AsyncSearchQueryResult fromJson(JsonObject json) {
JsonObject jsonStatus = json.getObject("status");
SearchStatus status = new DefaultSearchStatus(
jsonStatus.getLong("total"),
jsonStatus.getLong("failed"),
jsonStatus.getLong("successful"));
long totalHits = json.getLong("total_hits");
long took = json.getLong("took");
double maxScore = json.getDouble("max_score");
SearchMetrics metrics = new DefaultSearchMetrics(took, totalHits, maxScore);
List<SearchQueryRow> hits = new ArrayList<SearchQueryRow>();
JsonArray rawHits = json.getArray("hits");
if (rawHits != null) {
for (Object rawHit : rawHits) {
JsonObject hit = (JsonObject) rawHit;
String index = hit.getString("index");
String id = hit.getString("id");
double score = hit.getDouble("score");
JsonObject explanationJson = hit.getObject("explanation");
if (explanationJson == null) {
explanationJson = JsonObject.empty();
}
HitLocations locations = DefaultHitLocations.from(hit.getObject("locations"));
JsonObject fragmentsJson = hit.getObject("fragments");
Map<String, List<String>> fragments;
if (fragmentsJson != null) {
fragments = new HashMap<String, List<String>>(fragmentsJson.size());
for (String field : fragmentsJson.getNames()) {
List<String> fragment;
JsonArray fragmentJson = fragmentsJson.getArray(field);
if (fragmentJson != null) {
fragment = new ArrayList<String>(fragmentJson.size());
for (int i = 0; i < fragmentJson.size(); i++) {
fragment.add(fragmentJson.getString(i));
}
} else {
fragment = Collections.emptyList();
}
fragments.put(field, fragment);
}
} else {
fragments = Collections.emptyMap();
}
Map<String, String> fields;
JsonObject fieldsJson = hit.getObject("fields");
if (fieldsJson != null) {
fields = new HashMap<String, String>(fieldsJson.size());
for (String f : fieldsJson.getNames()) {
fields.put(f, String.valueOf(fieldsJson.get(f)));
}
} else {
fields = Collections.emptyMap();
}
hits.add(new DefaultSearchQueryRow(index, id, score, explanationJson, locations, fragments, fields));
}
}
List<FacetResult> facets;
JsonObject facetsJson = json.getObject("facets");
if (facetsJson != null) {
facets = new ArrayList<FacetResult>(facetsJson.size());
for (String facetName : facetsJson.getNames()) {
JsonObject facetJson = facetsJson.getObject(facetName);
String field = facetJson.getString("field");
long total = facetJson.getLong("total");
long missing = facetJson.getLong("missing");
long other = facetJson.getLong("other");
if (facetJson.containsKey("numeric_ranges")) {
JsonArray rangesJson = facetJson.getArray("numeric_ranges");
List<NumericRange> nr = new ArrayList<NumericRange>(rangesJson.size());
for (Object o : rangesJson) {
JsonObject r = (JsonObject) o;
nr.add(new NumericRange(r.getString("name"), r.getDouble("min"), r.getDouble("max"), r.getLong("count")));
}
facets.add(new DefaultNumericRangeFacetResult(facetName, field, total, missing, other, nr));
} else if (facetJson.containsKey("date_ranges")) {
JsonArray rangesJson = facetJson.getArray("date_ranges");
List<DateRange> dr = new ArrayList<DateRange>(rangesJson.size());
for (Object o : rangesJson) {
JsonObject r = (JsonObject) o;
dr.add(new DateRange(r.getString("name"), r.getString("start"), r.getString("end"),
r.getLong("count")));
}
facets.add(new DefaultDateRangeFacetResult(facetName, field, total, missing, other, dr));
} else {
List<TermRange> tr;
JsonArray rangesJson = facetJson.getArray("terms");
if (rangesJson == null) {
tr = Collections.emptyList();
} else {
tr = new ArrayList<TermRange>(rangesJson.size());
for (Object o : rangesJson) {
JsonObject r = (JsonObject) o;
tr.add(new TermRange(r.getString("term"), r.getLong("count")));
}
}
facets.add(new DefaultTermFacetResult(facetName, field, total, missing, other, tr));
}
}
} else {
facets = Collections.emptyList();
}
Observable<SearchQueryRow> errors;
Object errorsRaw = jsonStatus.get("errors");
if (errorsRaw instanceof JsonArray) {
JsonArray errorsJson = (JsonArray) errorsRaw;
List<Exception> exceptions = new ArrayList<Exception>(errorsJson.size());
for (Object o : errorsJson) {
exceptions.add(new RuntimeException(String.valueOf(o)));
}
if (exceptions.isEmpty()){
errors = Observable.empty();
} else {
errors = Observable.error(new CompositeException(exceptions));
}
} else if (errorsRaw instanceof JsonObject) {
JsonObject errorsJson = (JsonObject) errorsRaw;
List<Exception> exceptions = new ArrayList<Exception>(errorsJson.size());
for (String key : errorsJson.getNames()) {
exceptions.add(new RuntimeException(key + ": " + errorsJson.get(key)));
}
if (exceptions.isEmpty()){
errors = Observable.empty();
} else {
errors = Observable.error(new CompositeException(exceptions));
}
} else {
errors = Observable.empty();
}
return new DefaultAsyncSearchQueryResult(status,
Observable.from(hits).concatWith(errors),
Observable.from(facets),
Observable.just(metrics));
}
|
class class_name[name] begin[{]
method[fromJson, return_type[type[AsyncSearchQueryResult]], modifier[public static], parameter[json]] begin[{]
local_variable[type[JsonObject], jsonStatus]
local_variable[type[SearchStatus], status]
local_variable[type[long], totalHits]
local_variable[type[long], took]
local_variable[type[double], maxScore]
local_variable[type[SearchMetrics], metrics]
local_variable[type[List], hits]
local_variable[type[JsonArray], rawHits]
if[binary_operation[member[.rawHits], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=rawHit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), name=hit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="index")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=index)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="score")], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=score)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="explanation")], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=explanationJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=explanationJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=explanationJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=empty, postfix_operators=[], prefix_operators=[], qualifier=JsonObject, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="locations")], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=DefaultHitLocations, selectors=[], type_arguments=None), name=locations)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HitLocations, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="fragments")], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=fragmentsJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=fragments)], 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fragmentsJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=emptyMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=fragmentsJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=fragment)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getArray, postfix_operators=[], prefix_operators=[], qualifier=fragmentsJson, selectors=[], type_arguments=None), name=fragmentJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fragmentJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=emptyList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=fragmentJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=fragmentJson, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fragment, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=fragmentJson, 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)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=fragments, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNames, postfix_operators=[], prefix_operators=[], qualifier=fragmentsJson, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=fields)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="fields")], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=hit, selectors=[], type_arguments=None), name=fieldsJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fieldsJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=emptyMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=fieldsJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=fieldsJson, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNames, postfix_operators=[], prefix_operators=[], qualifier=fieldsJson, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=score, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=explanationJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=locations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fields, 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=DefaultSearchQueryRow, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=hits, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rawHits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rawHit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[List], facets]
local_variable[type[JsonObject], facetsJson]
if[binary_operation[member[.facetsJson], !=, literal[null]]] begin[{]
assign[member[.facets], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=facetsJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FacetResult, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=facetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=facetsJson, selectors=[], type_arguments=None), name=facetJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="field")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="total")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=total)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="missing")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=missing)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="other")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=other)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="numeric_ranges")], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="date_ranges")], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=tr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TermRange, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="terms")], member=getArray, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=rangesJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rangesJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=rangesJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TermRange, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="term")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="count")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TermRange, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=tr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rangesJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=emptyList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=facetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=missing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tr, 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=DefaultTermFacetResult, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=facets, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="date_ranges")], member=getArray, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=rangesJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=rangesJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DateRange, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=dr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DateRange, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="start")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="end")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="count")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DateRange, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=dr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rangesJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=facetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=missing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dr, 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=DefaultDateRangeFacetResult, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=facets, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="numeric_ranges")], member=getArray, postfix_operators=[], prefix_operators=[], qualifier=facetJson, selectors=[], type_arguments=None), name=rangesJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=rangesJson, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NumericRange, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=nr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NumericRange, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="min")], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="max")], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="count")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NumericRange, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=nr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rangesJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=facetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=missing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nr, 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=DefaultNumericRangeFacetResult, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=facets, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNames, postfix_operators=[], prefix_operators=[], qualifier=facetsJson, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=facetName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
assign[member[.facets], call[Collections.emptyList, parameter[]]]
end[}]
local_variable[type[Observable], errors]
local_variable[type[Object], errorsRaw]
if[binary_operation[member[.errorsRaw], instanceof, type[JsonArray]]] begin[{]
local_variable[type[JsonArray], errorsJson]
local_variable[type[List], exceptions]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, 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=RuntimeException, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=exceptions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=errorsJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
if[call[exceptions.isEmpty, parameter[]]] begin[{]
assign[member[.errors], call[Observable.empty, parameter[]]]
else begin[{]
assign[member[.errors], call[Observable.error, parameter[ClassCreator(arguments=[MemberReference(member=exceptions, 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=CompositeException, sub_type=None))]]]
end[}]
else begin[{]
if[binary_operation[member[.errorsRaw], instanceof, type[JsonObject]]] begin[{]
local_variable[type[JsonObject], errorsJson]
local_variable[type[List], exceptions]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=errorsJson, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=exceptions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNames, postfix_operators=[], prefix_operators=[], qualifier=errorsJson, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[call[exceptions.isEmpty, parameter[]]] begin[{]
assign[member[.errors], call[Observable.empty, parameter[]]]
else begin[{]
assign[member[.errors], call[Observable.error, parameter[ClassCreator(arguments=[MemberReference(member=exceptions, 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=CompositeException, sub_type=None))]]]
end[}]
else begin[{]
assign[member[.errors], call[Observable.empty, parameter[]]]
end[}]
end[}]
return[ClassCreator(arguments=[MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=hits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=from, postfix_operators=[], prefix_operators=[], qualifier=Observable, selectors=[MethodInvocation(arguments=[MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=concatWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=facets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=from, postfix_operators=[], prefix_operators=[], qualifier=Observable, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=metrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=just, postfix_operators=[], prefix_operators=[], qualifier=Observable, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultAsyncSearchQueryResult, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[AsyncSearchQueryResult] identifier[fromJson] operator[SEP] identifier[JsonObject] identifier[json] operator[SEP] {
identifier[JsonObject] identifier[jsonStatus] operator[=] identifier[json] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SearchStatus] identifier[status] operator[=] Keyword[new] identifier[DefaultSearchStatus] operator[SEP] identifier[jsonStatus] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] , identifier[jsonStatus] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] , identifier[jsonStatus] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[totalHits] operator[=] identifier[json] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[took] operator[=] identifier[json] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] identifier[maxScore] operator[=] identifier[json] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SearchMetrics] identifier[metrics] operator[=] Keyword[new] identifier[DefaultSearchMetrics] operator[SEP] identifier[took] , identifier[totalHits] , identifier[maxScore] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[SearchQueryRow] operator[>] identifier[hits] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SearchQueryRow] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[JsonArray] identifier[rawHits] operator[=] identifier[json] operator[SEP] identifier[getArray] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rawHits] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Object] identifier[rawHit] operator[:] identifier[rawHits] operator[SEP] {
identifier[JsonObject] identifier[hit] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[rawHit] operator[SEP] identifier[String] identifier[index] operator[=] identifier[hit] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] identifier[hit] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] identifier[score] operator[=] identifier[hit] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[JsonObject] identifier[explanationJson] operator[=] identifier[hit] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[explanationJson] operator[==] Other[null] operator[SEP] {
identifier[explanationJson] operator[=] identifier[JsonObject] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
identifier[HitLocations] identifier[locations] operator[=] identifier[DefaultHitLocations] operator[SEP] identifier[from] operator[SEP] identifier[hit] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[JsonObject] identifier[fragmentsJson] operator[=] identifier[hit] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[fragments] operator[SEP] Keyword[if] operator[SEP] identifier[fragmentsJson] operator[!=] Other[null] operator[SEP] {
identifier[fragments] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] identifier[fragmentsJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[field] operator[:] identifier[fragmentsJson] operator[SEP] identifier[getNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[fragment] operator[SEP] identifier[JsonArray] identifier[fragmentJson] operator[=] identifier[fragmentsJson] operator[SEP] identifier[getArray] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fragmentJson] operator[!=] Other[null] operator[SEP] {
identifier[fragment] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[fragmentJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fragmentJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[fragment] operator[SEP] identifier[add] operator[SEP] identifier[fragmentJson] operator[SEP] identifier[getString] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[fragment] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[fragments] operator[SEP] identifier[put] operator[SEP] identifier[field] , identifier[fragment] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[fragments] operator[=] identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[fields] operator[SEP] identifier[JsonObject] identifier[fieldsJson] operator[=] identifier[hit] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fieldsJson] operator[!=] Other[null] operator[SEP] {
identifier[fields] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] identifier[fieldsJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[f] operator[:] identifier[fieldsJson] operator[SEP] identifier[getNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[fields] operator[SEP] identifier[put] operator[SEP] identifier[f] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[fieldsJson] operator[SEP] identifier[get] operator[SEP] identifier[f] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[fields] operator[=] identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP]
}
identifier[hits] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DefaultSearchQueryRow] operator[SEP] identifier[index] , identifier[id] , identifier[score] , identifier[explanationJson] , identifier[locations] , identifier[fragments] , identifier[fields] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[FacetResult] operator[>] identifier[facets] operator[SEP] identifier[JsonObject] identifier[facetsJson] operator[=] identifier[json] operator[SEP] identifier[getObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facetsJson] operator[!=] Other[null] operator[SEP] {
identifier[facets] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[FacetResult] operator[>] operator[SEP] identifier[facetsJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[facetName] operator[:] identifier[facetsJson] operator[SEP] identifier[getNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[JsonObject] identifier[facetJson] operator[=] identifier[facetsJson] operator[SEP] identifier[getObject] operator[SEP] identifier[facetName] operator[SEP] operator[SEP] identifier[String] identifier[field] operator[=] identifier[facetJson] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[total] operator[=] identifier[facetJson] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[missing] operator[=] identifier[facetJson] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[other] operator[=] identifier[facetJson] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facetJson] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[JsonArray] identifier[rangesJson] operator[=] identifier[facetJson] operator[SEP] identifier[getArray] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[NumericRange] operator[>] identifier[nr] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[NumericRange] operator[>] operator[SEP] identifier[rangesJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[rangesJson] operator[SEP] {
identifier[JsonObject] identifier[r] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[o] operator[SEP] identifier[nr] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[NumericRange] operator[SEP] identifier[r] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[facets] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DefaultNumericRangeFacetResult] operator[SEP] identifier[facetName] , identifier[field] , identifier[total] , identifier[missing] , identifier[other] , identifier[nr] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[facetJson] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[JsonArray] identifier[rangesJson] operator[=] identifier[facetJson] operator[SEP] identifier[getArray] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[DateRange] operator[>] identifier[dr] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DateRange] operator[>] operator[SEP] identifier[rangesJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[rangesJson] operator[SEP] {
identifier[JsonObject] identifier[r] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[o] operator[SEP] identifier[dr] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DateRange] operator[SEP] identifier[r] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[facets] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DefaultDateRangeFacetResult] operator[SEP] identifier[facetName] , identifier[field] , identifier[total] , identifier[missing] , identifier[other] , identifier[dr] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[TermRange] operator[>] identifier[tr] operator[SEP] identifier[JsonArray] identifier[rangesJson] operator[=] identifier[facetJson] operator[SEP] identifier[getArray] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rangesJson] operator[==] Other[null] operator[SEP] {
identifier[tr] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[tr] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TermRange] operator[>] operator[SEP] identifier[rangesJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[rangesJson] operator[SEP] {
identifier[JsonObject] identifier[r] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[o] operator[SEP] identifier[tr] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[TermRange] operator[SEP] identifier[r] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[r] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[facets] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DefaultTermFacetResult] operator[SEP] identifier[facetName] , identifier[field] , identifier[total] , identifier[missing] , identifier[other] , identifier[tr] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[facets] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Observable] operator[<] identifier[SearchQueryRow] operator[>] identifier[errors] operator[SEP] identifier[Object] identifier[errorsRaw] operator[=] identifier[jsonStatus] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[errorsRaw] Keyword[instanceof] identifier[JsonArray] operator[SEP] {
identifier[JsonArray] identifier[errorsJson] operator[=] operator[SEP] identifier[JsonArray] operator[SEP] identifier[errorsRaw] operator[SEP] identifier[List] operator[<] identifier[Exception] operator[>] identifier[exceptions] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Exception] operator[>] operator[SEP] identifier[errorsJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[errorsJson] operator[SEP] {
identifier[exceptions] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[o] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[exceptions] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[errors] operator[=] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[errors] operator[=] identifier[Observable] operator[SEP] identifier[error] operator[SEP] Keyword[new] identifier[CompositeException] operator[SEP] identifier[exceptions] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[errorsRaw] Keyword[instanceof] identifier[JsonObject] operator[SEP] {
identifier[JsonObject] identifier[errorsJson] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[errorsRaw] operator[SEP] identifier[List] operator[<] identifier[Exception] operator[>] identifier[exceptions] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Exception] operator[>] operator[SEP] identifier[errorsJson] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[errorsJson] operator[SEP] identifier[getNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[exceptions] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[key] operator[+] literal[String] operator[+] identifier[errorsJson] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[exceptions] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[errors] operator[=] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[errors] operator[=] identifier[Observable] operator[SEP] identifier[error] operator[SEP] Keyword[new] identifier[CompositeException] operator[SEP] identifier[exceptions] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[errors] operator[=] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[DefaultAsyncSearchQueryResult] operator[SEP] identifier[status] , identifier[Observable] operator[SEP] identifier[from] operator[SEP] identifier[hits] operator[SEP] operator[SEP] identifier[concatWith] operator[SEP] identifier[errors] operator[SEP] , identifier[Observable] operator[SEP] identifier[from] operator[SEP] identifier[facets] operator[SEP] , identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[metrics] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void setUpSubject() throws WSLoginFailedException {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
updateSubjectWithTemporarySubjectContents();
return null;
}
});
} catch (PrivilegedActionException e) {
throw new WSLoginFailedException("Unable to setup the Subject: " + e.getLocalizedMessage());
}
}
|
class class_name[name] begin[{]
method[setUpSubject, return_type[void], modifier[protected], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=updateSubjectWithTemporarySubjectContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=PrivilegedExceptionAction, sub_type=None))], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=AccessController, 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 setup the Subject: "), operandr=MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WSLoginFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['PrivilegedActionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[setUpSubject] operator[SEP] operator[SEP] Keyword[throws] identifier[WSLoginFailedException] {
Keyword[try] {
identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] Keyword[new] identifier[PrivilegedExceptionAction] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[updateSubjectWithTemporarySubjectContents] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PrivilegedActionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WSLoginFailedException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static UIContext getPrimaryUIContext(final UIContext uic) {
if (uic == null) {
return null;
}
UIContext primary = null;
UIContext current = uic;
while (primary == null) {
if (current instanceof UIContextDelegate) {
UIContext backing = ((UIContextDelegate) current).getBacking();
if (backing != null) {
current = backing;
} else {
// This case should probably never happen.
primary = current;
LOG.warn("UIContextDelegate found without a backing context");
}
} else {
primary = current;
}
}
return primary;
}
|
class class_name[name] begin[{]
method[getPrimaryUIContext, return_type[type[UIContext]], modifier[public static], parameter[uic]] begin[{]
if[binary_operation[member[.uic], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[UIContext], primary]
local_variable[type[UIContext], current]
while[binary_operation[member[.primary], ==, literal[null]]] begin[{]
if[binary_operation[member[.current], instanceof, type[UIContextDelegate]]] begin[{]
local_variable[type[UIContext], backing]
if[binary_operation[member[.backing], !=, literal[null]]] begin[{]
assign[member[.current], member[.backing]]
else begin[{]
assign[member[.primary], member[.current]]
call[LOG.warn, parameter[literal["UIContextDelegate found without a backing context"]]]
end[}]
else begin[{]
assign[member[.primary], member[.current]]
end[}]
end[}]
return[member[.primary]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[UIContext] identifier[getPrimaryUIContext] operator[SEP] Keyword[final] identifier[UIContext] identifier[uic] operator[SEP] {
Keyword[if] operator[SEP] identifier[uic] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[UIContext] identifier[primary] operator[=] Other[null] operator[SEP] identifier[UIContext] identifier[current] operator[=] identifier[uic] operator[SEP] Keyword[while] operator[SEP] identifier[primary] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[current] Keyword[instanceof] identifier[UIContextDelegate] operator[SEP] {
identifier[UIContext] identifier[backing] operator[=] operator[SEP] operator[SEP] identifier[UIContextDelegate] operator[SEP] identifier[current] operator[SEP] operator[SEP] identifier[getBacking] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[backing] operator[!=] Other[null] operator[SEP] {
identifier[current] operator[=] identifier[backing] operator[SEP]
}
Keyword[else] {
identifier[primary] operator[=] identifier[current] operator[SEP] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[primary] operator[=] identifier[current] operator[SEP]
}
}
Keyword[return] identifier[primary] operator[SEP]
}
|
public void marshall(GetTableVersionRequest getTableVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (getTableVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getTableVersionRequest.getCatalogId(), CATALOGID_BINDING);
protocolMarshaller.marshall(getTableVersionRequest.getDatabaseName(), DATABASENAME_BINDING);
protocolMarshaller.marshall(getTableVersionRequest.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(getTableVersionRequest.getVersionId(), VERSIONID_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[getTableVersionRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getTableVersionRequest], ==, 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=getCatalogId, postfix_operators=[], prefix_operators=[], qualifier=getTableVersionRequest, selectors=[], type_arguments=None), MemberReference(member=CATALOGID_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=getDatabaseName, postfix_operators=[], prefix_operators=[], qualifier=getTableVersionRequest, selectors=[], type_arguments=None), MemberReference(member=DATABASENAME_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=getTableName, postfix_operators=[], prefix_operators=[], qualifier=getTableVersionRequest, selectors=[], type_arguments=None), MemberReference(member=TABLENAME_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=getVersionId, postfix_operators=[], prefix_operators=[], qualifier=getTableVersionRequest, selectors=[], type_arguments=None), MemberReference(member=VERSIONID_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[GetTableVersionRequest] identifier[getTableVersionRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getTableVersionRequest] 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[getTableVersionRequest] operator[SEP] identifier[getCatalogId] operator[SEP] operator[SEP] , identifier[CATALOGID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getTableVersionRequest] operator[SEP] identifier[getDatabaseName] operator[SEP] operator[SEP] , identifier[DATABASENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getTableVersionRequest] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[TABLENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getTableVersionRequest] operator[SEP] identifier[getVersionId] operator[SEP] operator[SEP] , identifier[VERSIONID_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 static XClass getMemberType() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getType();
}
else if (getCurrentMethod() != null) {
XMethod method = getCurrentMethod();
if (MethodTagsHandler.isGetterMethod(method)) {
return method.getReturnType().getType();
}
else if (MethodTagsHandler.isSetterMethod(method)) {
XParameter param = (XParameter)method.getParameters().iterator().next();
return param.getType();
}
}
return null;
}
|
class class_name[name] begin[{]
method[getMemberType, return_type[type[XClass]], modifier[public static], parameter[]] begin[{]
if[binary_operation[call[.getCurrentField, parameter[]], !=, literal[null]]] begin[{]
return[call[.getCurrentField, parameter[]]]
else begin[{]
if[binary_operation[call[.getCurrentMethod, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[XMethod], method]
if[call[MethodTagsHandler.isGetterMethod, parameter[member[.method]]]] begin[{]
return[call[method.getReturnType, parameter[]]]
else begin[{]
if[call[MethodTagsHandler.isSetterMethod, parameter[member[.method]]]] begin[{]
local_variable[type[XParameter], param]
return[call[param.getType, parameter[]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[XClass] identifier[getMemberType] operator[SEP] operator[SEP] Keyword[throws] identifier[XDocletException] {
Keyword[if] operator[SEP] identifier[getCurrentField] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[getCurrentField] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[getCurrentMethod] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[XMethod] identifier[method] operator[=] identifier[getCurrentMethod] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MethodTagsHandler] operator[SEP] identifier[isGetterMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
Keyword[return] identifier[method] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[MethodTagsHandler] operator[SEP] identifier[isSetterMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
identifier[XParameter] identifier[param] operator[=] operator[SEP] identifier[XParameter] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[param] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public SubscriptionQos setPublicationTtlMs(final long publicationTtlMs) {
if (publicationTtlMs < MIN_PUBLICATION_TTL_MS) {
this.publicationTtlMs = MIN_PUBLICATION_TTL_MS;
logger.warn("publicationTtlMs < MIN_PUBLICATION_TTL. Using MIN_PUBLICATION_TTL: {}",
MIN_PUBLICATION_TTL_MS);
} else if (publicationTtlMs > MAX_PUBLICATION_TTL_MS) {
this.publicationTtlMs = MAX_PUBLICATION_TTL_MS;
logger.warn("publicationTtlMs > MAX_PUBLICATION_TTL. Using MAX_PUBLICATION_TTL: {}",
MAX_PUBLICATION_TTL_MS);
} else {
this.publicationTtlMs = publicationTtlMs;
}
return this;
}
|
class class_name[name] begin[{]
method[setPublicationTtlMs, return_type[type[SubscriptionQos]], modifier[public], parameter[publicationTtlMs]] begin[{]
if[binary_operation[member[.publicationTtlMs], <, member[.MIN_PUBLICATION_TTL_MS]]] begin[{]
assign[THIS[member[None.publicationTtlMs]], member[.MIN_PUBLICATION_TTL_MS]]
call[logger.warn, parameter[literal["publicationTtlMs < MIN_PUBLICATION_TTL. Using MIN_PUBLICATION_TTL: {}"], member[.MIN_PUBLICATION_TTL_MS]]]
else begin[{]
if[binary_operation[member[.publicationTtlMs], >, member[.MAX_PUBLICATION_TTL_MS]]] begin[{]
assign[THIS[member[None.publicationTtlMs]], member[.MAX_PUBLICATION_TTL_MS]]
call[logger.warn, parameter[literal["publicationTtlMs > MAX_PUBLICATION_TTL. Using MAX_PUBLICATION_TTL: {}"], member[.MAX_PUBLICATION_TTL_MS]]]
else begin[{]
assign[THIS[member[None.publicationTtlMs]], member[.publicationTtlMs]]
end[}]
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[SubscriptionQos] identifier[setPublicationTtlMs] operator[SEP] Keyword[final] Keyword[long] identifier[publicationTtlMs] operator[SEP] {
Keyword[if] operator[SEP] identifier[publicationTtlMs] operator[<] identifier[MIN_PUBLICATION_TTL_MS] operator[SEP] {
Keyword[this] operator[SEP] identifier[publicationTtlMs] operator[=] identifier[MIN_PUBLICATION_TTL_MS] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[MIN_PUBLICATION_TTL_MS] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[publicationTtlMs] operator[>] identifier[MAX_PUBLICATION_TTL_MS] operator[SEP] {
Keyword[this] operator[SEP] identifier[publicationTtlMs] operator[=] identifier[MAX_PUBLICATION_TTL_MS] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[MAX_PUBLICATION_TTL_MS] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[publicationTtlMs] operator[=] identifier[publicationTtlMs] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static String getFilename(Resource resource, String extFallback) {
String filename = getResourceName(resource);
if (!HAS_FILE_EXT_PATTERN.matcher(filename).matches()) {
String filenameEnd = null;
MimeType mimeType = getMimeType(resource);
if (mimeType != null) {
String ext = mimeType.getExtension();
if (StringUtils.isNotBlank(ext)) {
filenameEnd = ext;
} else {
Matcher matcher = FILE_EXT_FROM_MIME.matcher(mimeType.toString());
if (matcher.matches()) {
filenameEnd = "." + matcher.group(1);
}
}
}
if (StringUtils.isBlank(filenameEnd) && StringUtils.isNotBlank(extFallback)) {
filenameEnd = "." + extFallback;
}
if (StringUtils.isNotBlank(filenameEnd) &&
!filename.toLowerCase().endsWith(filenameEnd.toLowerCase())) {
filename += filenameEnd;
}
}
return filename;
}
|
class class_name[name] begin[{]
method[getFilename, return_type[type[String]], modifier[public static], parameter[resource, extFallback]] begin[{]
local_variable[type[String], filename]
if[call[HAS_FILE_EXT_PATTERN.matcher, parameter[member[.filename]]]] begin[{]
local_variable[type[String], filenameEnd]
local_variable[type[MimeType], mimeType]
if[binary_operation[member[.mimeType], !=, literal[null]]] begin[{]
local_variable[type[String], ext]
if[call[StringUtils.isNotBlank, parameter[member[.ext]]]] begin[{]
assign[member[.filenameEnd], member[.ext]]
else begin[{]
local_variable[type[Matcher], matcher]
if[call[matcher.matches, parameter[]]] begin[{]
assign[member[.filenameEnd], binary_operation[literal["."], +, call[matcher.group, parameter[literal[1]]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[StringUtils.isBlank, parameter[member[.filenameEnd]]], &&, call[StringUtils.isNotBlank, parameter[member[.extFallback]]]]] begin[{]
assign[member[.filenameEnd], binary_operation[literal["."], +, member[.extFallback]]]
else begin[{]
None
end[}]
if[binary_operation[call[StringUtils.isNotBlank, parameter[member[.filenameEnd]]], &&, call[filename.toLowerCase, parameter[]]]] begin[{]
assign[member[.filename], member[.filenameEnd]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.filename]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getFilename] operator[SEP] identifier[Resource] identifier[resource] , identifier[String] identifier[extFallback] operator[SEP] {
identifier[String] identifier[filename] operator[=] identifier[getResourceName] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[HAS_FILE_EXT_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[filename] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[filenameEnd] operator[=] Other[null] operator[SEP] identifier[MimeType] identifier[mimeType] operator[=] identifier[getMimeType] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mimeType] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[ext] operator[=] identifier[mimeType] operator[SEP] identifier[getExtension] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[ext] operator[SEP] operator[SEP] {
identifier[filenameEnd] operator[=] identifier[ext] operator[SEP]
}
Keyword[else] {
identifier[Matcher] identifier[matcher] operator[=] identifier[FILE_EXT_FROM_MIME] operator[SEP] identifier[matcher] operator[SEP] identifier[mimeType] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[filenameEnd] operator[=] literal[String] operator[+] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[filenameEnd] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[extFallback] operator[SEP] operator[SEP] {
identifier[filenameEnd] operator[=] literal[String] operator[+] identifier[extFallback] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[filenameEnd] operator[SEP] operator[&&] operator[!] identifier[filename] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] identifier[filenameEnd] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[filename] operator[+=] identifier[filenameEnd] operator[SEP]
}
}
Keyword[return] identifier[filename] operator[SEP]
}
|
public String getLdapEncoded() {
if (components.size() == 0) {
throw new IndexOutOfBoundsException("No components in Rdn.");
}
StringBuffer sb = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (Iterator iter = components.values().iterator(); iter.hasNext();) {
LdapRdnComponent component = (LdapRdnComponent) iter.next();
sb.append(component.encodeLdap());
if (iter.hasNext()) {
sb.append("+");
}
}
return sb.toString();
}
|
class class_name[name] begin[{]
method[getLdapEncoded, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[components.size, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No components in Rdn.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[StringBuffer], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=LdapRdnComponent, sub_type=None)), name=component)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LdapRdnComponent, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=encodeLdap, postfix_operators=[], prefix_operators=[], qualifier=component, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="+")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=components, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getLdapEncoded] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[components] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[StringBuffer] identifier[sb] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[DEFAULT_BUFFER_SIZE] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] identifier[iter] operator[=] identifier[components] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LdapRdnComponent] identifier[component] operator[=] operator[SEP] identifier[LdapRdnComponent] operator[SEP] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[component] operator[SEP] identifier[encodeLdap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public List<String> getVirtualHosts() {
if (null == this.vhostArray) {
// nothing here but the api says it returns a non-null empty list
this.vhostArray = new ArrayList<String>(0);
}
return this.vhostArray;
}
|
class class_name[name] begin[{]
method[getVirtualHosts, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[literal[null], ==, THIS[member[None.vhostArray]]]] begin[{]
assign[THIS[member[None.vhostArray]], 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=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
return[THIS[member[None.vhostArray]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getVirtualHosts] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] Keyword[this] operator[SEP] identifier[vhostArray] operator[SEP] {
Keyword[this] operator[SEP] identifier[vhostArray] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[vhostArray] operator[SEP]
}
|
private int transpositions(String text1, String text2) {
int transpositions = 0;
for (int i = 0; i < text1.length(); i++) {
if (text1.charAt(i) != text2.charAt(i)) {
transpositions++;
}
}
return transpositions;
}
|
class class_name[name] begin[{]
method[transpositions, return_type[type[int]], modifier[private], parameter[text1, text2]] begin[{]
local_variable[type[int], transpositions]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=text1, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=text2, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=transpositions, 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=length, postfix_operators=[], prefix_operators=[], qualifier=text1, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.transpositions]]
end[}]
END[}]
|
Keyword[private] Keyword[int] identifier[transpositions] operator[SEP] identifier[String] identifier[text1] , identifier[String] identifier[text2] operator[SEP] {
Keyword[int] identifier[transpositions] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[text1] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[text1] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[text2] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[transpositions] operator[++] operator[SEP]
}
}
Keyword[return] identifier[transpositions] operator[SEP]
}
|
public static CommerceOrderNote fetchByC_ERC(long companyId,
String externalReferenceCode, boolean retrieveFromCache) {
return getPersistence()
.fetchByC_ERC(companyId, externalReferenceCode,
retrieveFromCache);
}
|
class class_name[name] begin[{]
method[fetchByC_ERC, return_type[type[CommerceOrderNote]], modifier[public static], parameter[companyId, externalReferenceCode, retrieveFromCache]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CommerceOrderNote] identifier[fetchByC_ERC] operator[SEP] Keyword[long] identifier[companyId] , identifier[String] identifier[externalReferenceCode] , Keyword[boolean] identifier[retrieveFromCache] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[fetchByC_ERC] operator[SEP] identifier[companyId] , identifier[externalReferenceCode] , identifier[retrieveFromCache] operator[SEP] operator[SEP]
}
|
public static <E extends Comparable> TreeMultiset<E> create(Iterable<? extends E> elements) {
TreeMultiset<E> multiset = create();
Iterables.addAll(multiset, elements);
return multiset;
}
|
class class_name[name] begin[{]
method[create, return_type[type[TreeMultiset]], modifier[public static], parameter[elements]] begin[{]
local_variable[type[TreeMultiset], multiset]
call[Iterables.addAll, parameter[member[.multiset], member[.elements]]]
return[member[.multiset]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[E] Keyword[extends] identifier[Comparable] operator[>] identifier[TreeMultiset] operator[<] identifier[E] operator[>] identifier[create] operator[SEP] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[E] operator[>] identifier[elements] operator[SEP] {
identifier[TreeMultiset] operator[<] identifier[E] operator[>] identifier[multiset] operator[=] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[Iterables] operator[SEP] identifier[addAll] operator[SEP] identifier[multiset] , identifier[elements] operator[SEP] operator[SEP] Keyword[return] identifier[multiset] operator[SEP]
}
|
public static String getActionMappingPath( ServletRequest request )
{
ActionMapping actionMapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
return actionMapping != null ? actionMapping.getPath() : null;
}
|
class class_name[name] begin[{]
method[getActionMappingPath, return_type[type[String]], modifier[public static], parameter[request]] begin[{]
local_variable[type[ActionMapping], actionMapping]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=actionMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=actionMapping, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getActionMappingPath] operator[SEP] identifier[ServletRequest] identifier[request] operator[SEP] {
identifier[ActionMapping] identifier[actionMapping] operator[=] operator[SEP] identifier[ActionMapping] operator[SEP] identifier[request] operator[SEP] identifier[getAttribute] operator[SEP] identifier[Globals] operator[SEP] identifier[MAPPING_KEY] operator[SEP] operator[SEP] Keyword[return] identifier[actionMapping] operator[!=] Other[null] operator[?] identifier[actionMapping] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public boolean hasAncestorOfType( Type firstType,
Type... additionalTypes ) {
return hasAncestorOfType(EnumSet.of(firstType, additionalTypes));
}
|
class class_name[name] begin[{]
method[hasAncestorOfType, return_type[type[boolean]], modifier[public], parameter[firstType, additionalTypes]] begin[{]
return[call[.hasAncestorOfType, parameter[call[EnumSet.of, parameter[member[.firstType], member[.additionalTypes]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[hasAncestorOfType] operator[SEP] identifier[Type] identifier[firstType] , identifier[Type] operator[...] identifier[additionalTypes] operator[SEP] {
Keyword[return] identifier[hasAncestorOfType] operator[SEP] identifier[EnumSet] operator[SEP] identifier[of] operator[SEP] identifier[firstType] , identifier[additionalTypes] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Result movedPermanently(Call call) {
return new Result(MOVED_PERMANENTLY, Collections.singletonMap(LOCATION, call.path()));
}
|
class class_name[name] begin[{]
method[movedPermanently, return_type[type[Result]], modifier[public static], parameter[call]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=MOVED_PERMANENTLY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=LOCATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=path, postfix_operators=[], prefix_operators=[], qualifier=call, selectors=[], type_arguments=None)], member=singletonMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Result, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Result] identifier[movedPermanently] operator[SEP] identifier[Call] identifier[call] operator[SEP] {
Keyword[return] Keyword[new] identifier[Result] operator[SEP] identifier[MOVED_PERMANENTLY] , identifier[Collections] operator[SEP] identifier[singletonMap] operator[SEP] identifier[LOCATION] , identifier[call] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void findAllExpressionsOfClass(Class< ? extends AbstractExpression> aeClass,
Set<AbstractExpression> collected) {
// Check the inlined plan nodes
for (AbstractPlanNode inlineNode: getInlinePlanNodes().values()) {
// For inline node we MUST go recursive to its children!!!!!
inlineNode.findAllExpressionsOfClass(aeClass, collected);
}
// and the output column expressions if there were no projection
NodeSchema schema = getOutputSchema();
if (schema != null) {
schema.addAllSubexpressionsOfClassFromNodeSchema(collected, aeClass);
}
}
|
class class_name[name] begin[{]
method[findAllExpressionsOfClass, return_type[void], modifier[protected], parameter[aeClass, collected]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aeClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=collected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findAllExpressionsOfClass, postfix_operators=[], prefix_operators=[], qualifier=inlineNode, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInlinePlanNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=inlineNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AbstractPlanNode, sub_type=None))), label=None)
local_variable[type[NodeSchema], schema]
if[binary_operation[member[.schema], !=, literal[null]]] begin[{]
call[schema.addAllSubexpressionsOfClassFromNodeSchema, parameter[member[.collected], member[.aeClass]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[findAllExpressionsOfClass] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[AbstractExpression] operator[>] identifier[aeClass] , identifier[Set] operator[<] identifier[AbstractExpression] operator[>] identifier[collected] operator[SEP] {
Keyword[for] operator[SEP] identifier[AbstractPlanNode] identifier[inlineNode] operator[:] identifier[getInlinePlanNodes] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[inlineNode] operator[SEP] identifier[findAllExpressionsOfClass] operator[SEP] identifier[aeClass] , identifier[collected] operator[SEP] operator[SEP]
}
identifier[NodeSchema] identifier[schema] operator[=] identifier[getOutputSchema] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[schema] operator[!=] Other[null] operator[SEP] {
identifier[schema] operator[SEP] identifier[addAllSubexpressionsOfClassFromNodeSchema] operator[SEP] identifier[collected] , identifier[aeClass] operator[SEP] operator[SEP]
}
}
|
public JSONObject saveObjects(JSONArray inputArray, @Nullable RequestOptions requestOptions) throws AlgoliaException {
try {
JSONArray array = new JSONArray();
for (int n = 0; n < inputArray.length(); n++) {
JSONObject obj = inputArray.getJSONObject(n);
JSONObject action = new JSONObject();
action.put("action", "updateObject");
action.put("objectID", obj.getString("objectID"));
action.put("body", obj);
array.put(action);
}
return batch(array, requestOptions);
} catch (JSONException e) {
throw new AlgoliaException(e.getMessage());
}
}
|
class class_name[name] begin[{]
method[saveObjects, return_type[type[JSONObject]], modifier[public], parameter[inputArray, requestOptions]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONArray, sub_type=None)), name=array)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJSONObject, postfix_operators=[], prefix_operators=[], qualifier=inputArray, selectors=[], type_arguments=None), name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONObject, sub_type=None)), name=action)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="action"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="updateObject")], member=put, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="objectID"), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="objectID")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="body"), MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=action, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=inputArray, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=n, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requestOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=batch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AlgoliaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[JSONObject] identifier[saveObjects] operator[SEP] identifier[JSONArray] identifier[inputArray] , annotation[@] identifier[Nullable] identifier[RequestOptions] identifier[requestOptions] operator[SEP] Keyword[throws] identifier[AlgoliaException] {
Keyword[try] {
identifier[JSONArray] identifier[array] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[n] operator[=] Other[0] operator[SEP] identifier[n] operator[<] identifier[inputArray] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[++] operator[SEP] {
identifier[JSONObject] identifier[obj] operator[=] identifier[inputArray] operator[SEP] identifier[getJSONObject] operator[SEP] identifier[n] operator[SEP] operator[SEP] identifier[JSONObject] identifier[action] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[action] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[action] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[obj] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[action] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[obj] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[put] operator[SEP] identifier[action] operator[SEP] operator[SEP]
}
Keyword[return] identifier[batch] operator[SEP] identifier[array] , identifier[requestOptions] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AlgoliaException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public char[] getSmallCBuffer(int minSize)
{
char[] result = null;
if (mSmallCBuffer != null && mSmallCBuffer.length >= minSize) {
result = mSmallCBuffer;
mSmallCBuffer = null;
}
//System.err.println("DEBUG: Alloc CSmall: "+result);
return result;
}
|
class class_name[name] begin[{]
method[getSmallCBuffer, return_type[type[char]], modifier[public], parameter[minSize]] begin[{]
local_variable[type[char], result]
if[binary_operation[binary_operation[member[.mSmallCBuffer], !=, literal[null]], &&, binary_operation[member[mSmallCBuffer.length], >=, member[.minSize]]]] begin[{]
assign[member[.result], member[.mSmallCBuffer]]
assign[member[.mSmallCBuffer], literal[null]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[char] operator[SEP] operator[SEP] identifier[getSmallCBuffer] operator[SEP] Keyword[int] identifier[minSize] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[mSmallCBuffer] operator[!=] Other[null] operator[&&] identifier[mSmallCBuffer] operator[SEP] identifier[length] operator[>=] identifier[minSize] operator[SEP] {
identifier[result] operator[=] identifier[mSmallCBuffer] operator[SEP] identifier[mSmallCBuffer] operator[=] Other[null] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public synchronized void addConnector(Connector connector) {
if( log.isDebugEnabled() ) {
log.debug("Adding connector (" + connector.getInfo() + ")");
}
// Make sure we have a Container to send requests to
if (engines.length < 1)
throw new IllegalStateException
(sm.getString("embedded.noEngines"));
/*
* Add the connector. This will set the connector's container to the
* most recently added Engine
*/
service.addConnector(connector);
}
|
class class_name[name] begin[{]
method[addConnector, return_type[void], modifier[synchronized public], parameter[connector]] begin[{]
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[binary_operation[binary_operation[literal["Adding connector ("], +, call[connector.getInfo, parameter[]]], +, literal[")"]]]]
else begin[{]
None
end[}]
if[binary_operation[member[engines.length], <, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="embedded.noEngines")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=sm, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[service.addConnector, parameter[member[.connector]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[void] identifier[addConnector] operator[SEP] identifier[Connector] identifier[connector] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[connector] operator[SEP] identifier[getInfo] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[engines] operator[SEP] identifier[length] operator[<] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[sm] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[addConnector] operator[SEP] identifier[connector] operator[SEP] operator[SEP]
}
|
@Override
public Plan createPlan(QueryData data, Transaction tx) {
// Step 1: Create a plan for each mentioned table or view
List<Plan> plans = new ArrayList<Plan>();
for (String tblname : data.tables()) {
String viewdef = VanillaDb.catalogMgr().getViewDef(tblname, tx);
if (viewdef != null)
plans.add(VanillaDb.newPlanner().createQueryPlan(viewdef, tx));
else
plans.add(new TablePlan(tblname, tx));
}
// Step 2: Create the product of all table plans
Plan p = plans.remove(0);
for (Plan nextplan : plans)
p = new ProductPlan(p, nextplan);
// Step 3: Add a selection plan for the predicate
p = new SelectPlan(p, data.pred());
// Step 4: Add a group-by plan if specified
if (data.groupFields() != null) {
p = new GroupByPlan(p, data.groupFields(), data.aggregationFn(), tx);
}
// Step 5: Project onto the specified fields
p = new ProjectPlan(p, data.projectFields());
// Step 6: Add a sort plan if specified
if (data.sortFields() != null)
p = new SortPlan(p, data.sortFields(), data.sortDirections(), tx);
// Step 7: Add a explain plan if the query is explain statement
if (data.isExplain())
p = new ExplainPlan(p);
return p;
}
|
class class_name[name] begin[{]
method[createPlan, return_type[type[Plan]], modifier[public], parameter[data, tx]] begin[{]
local_variable[type[List], plans]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=catalogMgr, postfix_operators=[], prefix_operators=[], qualifier=VanillaDb, selectors=[MethodInvocation(arguments=[MemberReference(member=tblname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getViewDef, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=viewdef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=viewdef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=tblname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx, 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=TablePlan, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=plans, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newPlanner, postfix_operators=[], prefix_operators=[], qualifier=VanillaDb, selectors=[MethodInvocation(arguments=[MemberReference(member=viewdef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createQueryPlan, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=plans, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=tables, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tblname)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[Plan], p]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nextplan, 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=ProductPlan, sub_type=None))), label=None), control=EnhancedForControl(iterable=MemberReference(member=plans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=nextplan)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Plan, sub_type=None))), label=None)
assign[member[.p], ClassCreator(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=pred, 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=SelectPlan, sub_type=None))]
if[binary_operation[call[data.groupFields, parameter[]], !=, literal[null]]] begin[{]
assign[member[.p], ClassCreator(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=groupFields, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=aggregationFn, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), MemberReference(member=tx, 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=GroupByPlan, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.p], ClassCreator(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=projectFields, 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=ProjectPlan, sub_type=None))]
if[binary_operation[call[data.sortFields, parameter[]], !=, literal[null]]] begin[{]
assign[member[.p], ClassCreator(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=sortFields, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=sortDirections, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), MemberReference(member=tx, 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=SortPlan, sub_type=None))]
else begin[{]
None
end[}]
if[call[data.isExplain, parameter[]]] begin[{]
assign[member[.p], ClassCreator(arguments=[MemberReference(member=p, 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=ExplainPlan, sub_type=None))]
else begin[{]
None
end[}]
return[member[.p]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Plan] identifier[createPlan] operator[SEP] identifier[QueryData] identifier[data] , identifier[Transaction] identifier[tx] operator[SEP] {
identifier[List] operator[<] identifier[Plan] operator[>] identifier[plans] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Plan] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[tblname] operator[:] identifier[data] operator[SEP] identifier[tables] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[viewdef] operator[=] identifier[VanillaDb] operator[SEP] identifier[catalogMgr] operator[SEP] operator[SEP] operator[SEP] identifier[getViewDef] operator[SEP] identifier[tblname] , identifier[tx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[viewdef] operator[!=] Other[null] operator[SEP] identifier[plans] operator[SEP] identifier[add] operator[SEP] identifier[VanillaDb] operator[SEP] identifier[newPlanner] operator[SEP] operator[SEP] operator[SEP] identifier[createQueryPlan] operator[SEP] identifier[viewdef] , identifier[tx] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[plans] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[TablePlan] operator[SEP] identifier[tblname] , identifier[tx] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Plan] identifier[p] operator[=] identifier[plans] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Plan] identifier[nextplan] operator[:] identifier[plans] operator[SEP] identifier[p] operator[=] Keyword[new] identifier[ProductPlan] operator[SEP] identifier[p] , identifier[nextplan] operator[SEP] operator[SEP] identifier[p] operator[=] Keyword[new] identifier[SelectPlan] operator[SEP] identifier[p] , identifier[data] operator[SEP] identifier[pred] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[groupFields] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[p] operator[=] Keyword[new] identifier[GroupByPlan] operator[SEP] identifier[p] , identifier[data] operator[SEP] identifier[groupFields] operator[SEP] operator[SEP] , identifier[data] operator[SEP] identifier[aggregationFn] operator[SEP] operator[SEP] , identifier[tx] operator[SEP] operator[SEP]
}
identifier[p] operator[=] Keyword[new] identifier[ProjectPlan] operator[SEP] identifier[p] , identifier[data] operator[SEP] identifier[projectFields] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[sortFields] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[p] operator[=] Keyword[new] identifier[SortPlan] operator[SEP] identifier[p] , identifier[data] operator[SEP] identifier[sortFields] operator[SEP] operator[SEP] , identifier[data] operator[SEP] identifier[sortDirections] operator[SEP] operator[SEP] , identifier[tx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[isExplain] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[=] Keyword[new] identifier[ExplainPlan] operator[SEP] identifier[p] operator[SEP] operator[SEP] Keyword[return] identifier[p] operator[SEP]
}
|
public void configureDefaults() throws Exception
{
//cannot configure if the context is already started
if (_context.isStarted())
{
if (log.isDebugEnabled()){log.debug("Cannot configure webapp after it is started");};
return;
}
getWebApplicationContext().setWelcomeFiles(null);
String defaultsDescriptor=getWebApplicationContext().getDefaultsDescriptor();
if(defaultsDescriptor!=null&&defaultsDescriptor.length()>0)
{
Resource dftResource=Resource.newSystemResource(defaultsDescriptor);
if(dftResource==null)
dftResource=Resource.newResource(defaultsDescriptor);
XmlParser.Node defaultConfig=xmlParser.parse(dftResource.getURL());
initialize(defaultConfig);
}
}
|
class class_name[name] begin[{]
method[configureDefaults, return_type[void], modifier[public], parameter[]] begin[{]
if[call[_context.isStarted, parameter[]]] begin[{]
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[literal["Cannot configure webapp after it is started"]]]
else begin[{]
None
end[}]
Statement(label=None)
return[None]
else begin[{]
None
end[}]
call[.getWebApplicationContext, parameter[]]
local_variable[type[String], defaultsDescriptor]
if[binary_operation[binary_operation[member[.defaultsDescriptor], !=, literal[null]], &&, binary_operation[call[defaultsDescriptor.length, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[Resource], dftResource]
if[binary_operation[member[.dftResource], ==, literal[null]]] begin[{]
assign[member[.dftResource], call[Resource.newResource, parameter[member[.defaultsDescriptor]]]]
else begin[{]
None
end[}]
local_variable[type[XmlParser], defaultConfig]
call[.initialize, parameter[member[.defaultConfig]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[configureDefaults] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[_context] operator[SEP] identifier[isStarted] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
} operator[SEP] Keyword[return] operator[SEP]
}
identifier[getWebApplicationContext] operator[SEP] operator[SEP] operator[SEP] identifier[setWelcomeFiles] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[String] identifier[defaultsDescriptor] operator[=] identifier[getWebApplicationContext] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultsDescriptor] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[defaultsDescriptor] operator[!=] Other[null] operator[&&] identifier[defaultsDescriptor] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[Resource] identifier[dftResource] operator[=] identifier[Resource] operator[SEP] identifier[newSystemResource] operator[SEP] identifier[defaultsDescriptor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dftResource] operator[==] Other[null] operator[SEP] identifier[dftResource] operator[=] identifier[Resource] operator[SEP] identifier[newResource] operator[SEP] identifier[defaultsDescriptor] operator[SEP] operator[SEP] identifier[XmlParser] operator[SEP] identifier[Node] identifier[defaultConfig] operator[=] identifier[xmlParser] operator[SEP] identifier[parse] operator[SEP] identifier[dftResource] operator[SEP] identifier[getURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[initialize] operator[SEP] identifier[defaultConfig] operator[SEP] operator[SEP]
}
}
|
public List<KafkaTopicPartitionLeader> getPartitionLeadersForTopics(List<String> topics) {
List<KafkaTopicPartitionLeader> partitions = new LinkedList<>();
retryLoop: for (int retry = 0; retry < numRetries; retry++) {
brokersLoop: for (int arrIdx = 0; arrIdx < seedBrokerAddresses.length; arrIdx++) {
LOG.info("Trying to get topic metadata from broker {} in try {}/{}", seedBrokerAddresses[currentContactSeedBrokerIndex], retry, numRetries);
try {
// clear in case we have an incomplete list from previous tries
partitions.clear();
for (TopicMetadata item : consumer.send(new TopicMetadataRequest(topics)).topicsMetadata()) {
if (item.errorCode() != ErrorMapping.NoError()) {
// warn and try more brokers
LOG.warn("Error while getting metadata from broker {} to find partitions for {}. Error: {}.",
seedBrokerAddresses[currentContactSeedBrokerIndex], topics.toString(), ErrorMapping.exceptionFor(item.errorCode()).getMessage());
useNextAddressAsNewContactSeedBroker();
continue brokersLoop;
}
if (!topics.contains(item.topic())) {
LOG.warn("Received metadata from topic " + item.topic() + " even though it was not requested. Skipping ...");
useNextAddressAsNewContactSeedBroker();
continue brokersLoop;
}
for (PartitionMetadata part : item.partitionsMetadata()) {
Node leader = brokerToNode(part.leader());
KafkaTopicPartition ktp = new KafkaTopicPartition(item.topic(), part.partitionId());
KafkaTopicPartitionLeader pInfo = new KafkaTopicPartitionLeader(ktp, leader);
partitions.add(pInfo);
}
}
break retryLoop; // leave the loop through the brokers
}
catch (Exception e) {
//validates seed brokers in case of a ClosedChannelException
validateSeedBrokers(seedBrokerAddresses, e);
LOG.warn("Error communicating with broker {} to find partitions for {}. {} Message: {}",
seedBrokerAddresses[currentContactSeedBrokerIndex], topics, e.getClass().getName(), e.getMessage());
LOG.debug("Detailed trace", e);
// we sleep a bit. Retrying immediately doesn't make sense in cases where Kafka is reorganizing the leader metadata
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
// sleep shorter.
}
useNextAddressAsNewContactSeedBroker();
}
} // brokers loop
} // retries loop
return partitions;
}
|
class class_name[name] begin[{]
method[getPartitionLeadersForTopics, return_type[type[List]], modifier[public], parameter[topics]] begin[{]
local_variable[type[List], partitions]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Trying to get topic metadata from broker {} in try {}/{}"), MemberReference(member=seedBrokerAddresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentContactSeedBrokerIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=numRetries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=partitions, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=errorCode, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=NoError, postfix_operators=[], prefix_operators=[], qualifier=ErrorMapping, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while getting metadata from broker {} to find partitions for {}. Error: {}."), MemberReference(member=seedBrokerAddresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentContactSeedBrokerIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=topics, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=errorCode, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=exceptionFor, postfix_operators=[], prefix_operators=[], qualifier=ErrorMapping, selectors=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=useNextAddressAsNewContactSeedBroker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=brokersLoop, label=None)])), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=topic, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=topics, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received metadata from topic "), operandr=MethodInvocation(arguments=[], member=topic, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" even though it was not requested. Skipping ..."), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=useNextAddressAsNewContactSeedBroker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=brokersLoop, label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=leader, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None)], member=brokerToNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=leader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=topic, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=partitionId, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KafkaTopicPartition, sub_type=None)), name=ktp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KafkaTopicPartition, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ktp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=leader, 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=KafkaTopicPartitionLeader, sub_type=None)), name=pInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KafkaTopicPartitionLeader, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=partitions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=partitionsMetadata, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=part)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PartitionMetadata, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=topics, 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=TopicMetadataRequest, sub_type=None))], member=send, postfix_operators=[], prefix_operators=[], qualifier=consumer, selectors=[MethodInvocation(arguments=[], member=topicsMetadata, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TopicMetadata, sub_type=None))), label=None), BreakStatement(goto=retryLoop, label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seedBrokerAddresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateSeedBrokers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error communicating with broker {} to find partitions for {}. {} Message: {}"), MemberReference(member=seedBrokerAddresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentContactSeedBrokerIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=topics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Detailed trace"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['InterruptedException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[], member=useNextAddressAsNewContactSeedBroker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=arrIdx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=seedBrokerAddresses, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=arrIdx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=arrIdx, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=brokersLoop)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numRetries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=retry)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=retry, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=retryLoop)
return[member[.partitions]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[KafkaTopicPartitionLeader] operator[>] identifier[getPartitionLeadersForTopics] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[topics] operator[SEP] {
identifier[List] operator[<] identifier[KafkaTopicPartitionLeader] operator[>] identifier[partitions] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[retryLoop] operator[:] Keyword[for] operator[SEP] Keyword[int] identifier[retry] operator[=] Other[0] operator[SEP] identifier[retry] operator[<] identifier[numRetries] operator[SEP] identifier[retry] operator[++] operator[SEP] {
identifier[brokersLoop] operator[:] Keyword[for] operator[SEP] Keyword[int] identifier[arrIdx] operator[=] Other[0] operator[SEP] identifier[arrIdx] operator[<] identifier[seedBrokerAddresses] operator[SEP] identifier[length] operator[SEP] identifier[arrIdx] operator[++] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[seedBrokerAddresses] operator[SEP] identifier[currentContactSeedBrokerIndex] operator[SEP] , identifier[retry] , identifier[numRetries] operator[SEP] operator[SEP] Keyword[try] {
identifier[partitions] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TopicMetadata] identifier[item] operator[:] identifier[consumer] operator[SEP] identifier[send] operator[SEP] Keyword[new] identifier[TopicMetadataRequest] operator[SEP] identifier[topics] operator[SEP] operator[SEP] operator[SEP] identifier[topicsMetadata] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[item] operator[SEP] identifier[errorCode] operator[SEP] operator[SEP] operator[!=] identifier[ErrorMapping] operator[SEP] identifier[NoError] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[seedBrokerAddresses] operator[SEP] identifier[currentContactSeedBrokerIndex] operator[SEP] , identifier[topics] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[ErrorMapping] operator[SEP] identifier[exceptionFor] operator[SEP] identifier[item] operator[SEP] identifier[errorCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[useNextAddressAsNewContactSeedBroker] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] identifier[brokersLoop] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[topics] operator[SEP] identifier[contains] operator[SEP] identifier[item] operator[SEP] identifier[topic] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[item] operator[SEP] identifier[topic] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[useNextAddressAsNewContactSeedBroker] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] identifier[brokersLoop] operator[SEP]
}
Keyword[for] operator[SEP] identifier[PartitionMetadata] identifier[part] operator[:] identifier[item] operator[SEP] identifier[partitionsMetadata] operator[SEP] operator[SEP] operator[SEP] {
identifier[Node] identifier[leader] operator[=] identifier[brokerToNode] operator[SEP] identifier[part] operator[SEP] identifier[leader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[KafkaTopicPartition] identifier[ktp] operator[=] Keyword[new] identifier[KafkaTopicPartition] operator[SEP] identifier[item] operator[SEP] identifier[topic] operator[SEP] operator[SEP] , identifier[part] operator[SEP] identifier[partitionId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[KafkaTopicPartitionLeader] identifier[pInfo] operator[=] Keyword[new] identifier[KafkaTopicPartitionLeader] operator[SEP] identifier[ktp] , identifier[leader] operator[SEP] operator[SEP] identifier[partitions] operator[SEP] identifier[add] operator[SEP] identifier[pInfo] operator[SEP] operator[SEP]
}
}
Keyword[break] identifier[retryLoop] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[validateSeedBrokers] operator[SEP] identifier[seedBrokerAddresses] , identifier[e] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[seedBrokerAddresses] operator[SEP] identifier[currentContactSeedBrokerIndex] operator[SEP] , identifier[topics] , identifier[e] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[500] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e1] operator[SEP] {
}
identifier[useNextAddressAsNewContactSeedBroker] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[partitions] operator[SEP]
}
|
private Schema getCustomColumnSchema(String columnName) {
Schema schema = new Schema();
String dataType = "string";
schema.setColumnName(columnName);
String elementDataType = "string";
List<String> mapSymbols = null;
JsonObject newDataType = this.convertDataType(columnName, dataType, elementDataType, mapSymbols);
schema.setDataType(newDataType);
schema.setWaterMark(false);
schema.setPrimaryKey(0);
schema.setLength(0);
schema.setPrecision(0);
schema.setScale(0);
schema.setNullable(true);
schema.setFormat(null);
schema.setComment("Custom column");
schema.setDefaultValue(null);
schema.setUnique(false);
return schema;
}
|
class class_name[name] begin[{]
method[getCustomColumnSchema, return_type[type[Schema]], modifier[private], parameter[columnName]] begin[{]
local_variable[type[Schema], schema]
local_variable[type[String], dataType]
call[schema.setColumnName, parameter[member[.columnName]]]
local_variable[type[String], elementDataType]
local_variable[type[List], mapSymbols]
local_variable[type[JsonObject], newDataType]
call[schema.setDataType, parameter[member[.newDataType]]]
call[schema.setWaterMark, parameter[literal[false]]]
call[schema.setPrimaryKey, parameter[literal[0]]]
call[schema.setLength, parameter[literal[0]]]
call[schema.setPrecision, parameter[literal[0]]]
call[schema.setScale, parameter[literal[0]]]
call[schema.setNullable, parameter[literal[true]]]
call[schema.setFormat, parameter[literal[null]]]
call[schema.setComment, parameter[literal["Custom column"]]]
call[schema.setDefaultValue, parameter[literal[null]]]
call[schema.setUnique, parameter[literal[false]]]
return[member[.schema]]
end[}]
END[}]
|
Keyword[private] identifier[Schema] identifier[getCustomColumnSchema] operator[SEP] identifier[String] identifier[columnName] operator[SEP] {
identifier[Schema] identifier[schema] operator[=] Keyword[new] identifier[Schema] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[dataType] operator[=] literal[String] operator[SEP] identifier[schema] operator[SEP] identifier[setColumnName] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] identifier[String] identifier[elementDataType] operator[=] literal[String] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[mapSymbols] operator[=] Other[null] operator[SEP] identifier[JsonObject] identifier[newDataType] operator[=] Keyword[this] operator[SEP] identifier[convertDataType] operator[SEP] identifier[columnName] , identifier[dataType] , identifier[elementDataType] , identifier[mapSymbols] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setDataType] operator[SEP] identifier[newDataType] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setWaterMark] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setPrimaryKey] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setPrecision] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setScale] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setNullable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setFormat] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setComment] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setDefaultValue] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[schema] operator[SEP] identifier[setUnique] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[schema] operator[SEP]
}
|
public List<Object> syncAndReturnAll() throws Exception {
try {
JedisClusterPipeline pipeline = new JedisClusterPipeline(clusterInfoCache);
execute(pipeline);
return pipeline.syncAndReturnAll();
} catch (JedisMovedDataException jre) {
// if MOVED redirection occurred, rebuilds cluster's slot cache,
// recommended by Redis cluster specification
connectionHandler.renewSlotCache();
if (maxAttempts > 0) {
maxAttempts--;
return syncAndReturnAll();
}
throw jre;
} catch (Exception ex) {
throw ex;
}
}
|
class class_name[name] begin[{]
method[syncAndReturnAll, return_type[type[List]], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=clusterInfoCache, 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=JedisClusterPipeline, sub_type=None)), name=pipeline)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JedisClusterPipeline, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pipeline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=execute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=syncAndReturnAll, postfix_operators=[], prefix_operators=[], qualifier=pipeline, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=renewSlotCache, postfix_operators=[], prefix_operators=[], qualifier=connectionHandler, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=maxAttempts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=maxAttempts, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=syncAndReturnAll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), ThrowStatement(expression=MemberReference(member=jre, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=jre, types=['JedisMovedDataException'])), CatchClause(block=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Object] operator[>] identifier[syncAndReturnAll] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] {
identifier[JedisClusterPipeline] identifier[pipeline] operator[=] Keyword[new] identifier[JedisClusterPipeline] operator[SEP] identifier[clusterInfoCache] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[pipeline] operator[SEP] operator[SEP] Keyword[return] identifier[pipeline] operator[SEP] identifier[syncAndReturnAll] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JedisMovedDataException] identifier[jre] operator[SEP] {
identifier[connectionHandler] operator[SEP] identifier[renewSlotCache] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxAttempts] operator[>] Other[0] operator[SEP] {
identifier[maxAttempts] operator[--] operator[SEP] Keyword[return] identifier[syncAndReturnAll] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] identifier[jre] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
}
|
@Nonnull
public static <T> LObjCharConsumerBuilder<T> objCharConsumer(Consumer<LObjCharConsumer<T>> consumer) {
return new LObjCharConsumerBuilder(consumer);
}
|
class class_name[name] begin[{]
method[objCharConsumer, return_type[type[LObjCharConsumerBuilder]], modifier[public static], parameter[consumer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LObjCharConsumerBuilder, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[LObjCharConsumerBuilder] operator[<] identifier[T] operator[>] identifier[objCharConsumer] operator[SEP] identifier[Consumer] operator[<] identifier[LObjCharConsumer] operator[<] identifier[T] operator[>] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] Keyword[new] identifier[LObjCharConsumerBuilder] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
|
private boolean uriMatch(String requestURI, IFilterMapping fmInfo, DispatcherType dispatcherType) {
boolean theyMatch = false;
// determine what type of filter uri we have
switch (fmInfo.getMappingType()) {
case FMI_MAPPING_SINGLE_SLASH:
// default servlet mapping...if requestURI is "/", they match
if (requestURI.equals("/")) // 144908
theyMatch = true;
break;
case FMI_MAPPING_PATH_MATCH:
// it's a path mapping...match string is already stripped
if (requestURI.startsWith(fmInfo.getUrlPattern() + "/") || requestURI.equals(fmInfo.getUrlPattern()))
theyMatch = true;
break;
case FMI_MAPPING_EXTENSION_MATCH:
// it's an extension mapping...get the extension
String ext = fmInfo.getUrlPattern().substring(2);
// compare to any extension on the request uri
int index = requestURI.lastIndexOf('.');
if (index != -1)
if (ext.equals(requestURI.substring(index + 1)))
theyMatch = true;
break;
case FMI_MAPPING_EXACT_MATCH:
// it's an exact match
if (requestURI.equals(fmInfo.getUrlPattern()))
theyMatch = true;
break;
default:
// should never happen...give a message?
break;
}
// Check if dispatch mode matches
boolean dispMatch = false;
if (theyMatch) {
for (int i = 0; i < fmInfo.getDispatchMode().length; i++) {
if (dispatcherType == fmInfo.getDispatchMode()[i]) {
dispMatch = true;
break;
}
}
}
return dispMatch && theyMatch;
}
|
class class_name[name] begin[{]
method[uriMatch, return_type[type[boolean]], modifier[private], parameter[requestURI, fmInfo, dispatcherType]] begin[{]
local_variable[type[boolean], theyMatch]
SwitchStatement(cases=[SwitchStatementCase(case=['FMI_MAPPING_SINGLE_SLASH'], statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=theyMatch, 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=['FMI_MAPPING_PATH_MATCH'], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getUrlPattern, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+)], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUrlPattern, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=theyMatch, 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=['FMI_MAPPING_EXTENSION_MATCH'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getUrlPattern, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=lastIndexOf, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=ext, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=theyMatch, 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=['FMI_MAPPING_EXACT_MATCH'], statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUrlPattern, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=requestURI, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=theyMatch, 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=[], statements=[BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getMappingType, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[], type_arguments=None), label=None)
local_variable[type[boolean], dispMatch]
if[member[.theyMatch]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dispatcherType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getDispatchMode, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dispMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getDispatchMode, postfix_operators=[], prefix_operators=[], qualifier=fmInfo, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[binary_operation[member[.dispMatch], &&, member[.theyMatch]]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[uriMatch] operator[SEP] identifier[String] identifier[requestURI] , identifier[IFilterMapping] identifier[fmInfo] , identifier[DispatcherType] identifier[dispatcherType] operator[SEP] {
Keyword[boolean] identifier[theyMatch] operator[=] literal[boolean] operator[SEP] Keyword[switch] operator[SEP] identifier[fmInfo] operator[SEP] identifier[getMappingType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[FMI_MAPPING_SINGLE_SLASH] operator[:] Keyword[if] operator[SEP] identifier[requestURI] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[theyMatch] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FMI_MAPPING_PATH_MATCH] operator[:] Keyword[if] operator[SEP] identifier[requestURI] operator[SEP] identifier[startsWith] operator[SEP] identifier[fmInfo] operator[SEP] identifier[getUrlPattern] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[||] identifier[requestURI] operator[SEP] identifier[equals] operator[SEP] identifier[fmInfo] operator[SEP] identifier[getUrlPattern] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[theyMatch] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FMI_MAPPING_EXTENSION_MATCH] operator[:] identifier[String] identifier[ext] operator[=] identifier[fmInfo] operator[SEP] identifier[getUrlPattern] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[requestURI] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[!=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[ext] operator[SEP] identifier[equals] operator[SEP] identifier[requestURI] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[theyMatch] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FMI_MAPPING_EXACT_MATCH] operator[:] Keyword[if] operator[SEP] identifier[requestURI] operator[SEP] identifier[equals] operator[SEP] identifier[fmInfo] operator[SEP] identifier[getUrlPattern] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[theyMatch] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
Keyword[boolean] identifier[dispMatch] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[theyMatch] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fmInfo] operator[SEP] identifier[getDispatchMode] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[dispatcherType] operator[==] identifier[fmInfo] operator[SEP] identifier[getDispatchMode] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[dispMatch] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[return] identifier[dispMatch] operator[&&] identifier[theyMatch] operator[SEP]
}
|
private void listRegisteredHandlers(final HttpServletResponse response) throws IOException {
//Build the array of registered roots
JSONArray keyArray = new JSONArray();
Iterator<String> keys = REST_HANDLER_CONTAINER.registeredKeys();
if (keys != null) {
while (keys.hasNext()) {
keyArray.add(keys.next());
}
}
//Add the version.
JSONObject jsonObject = new OrderedJSONObject();
jsonObject.put("version", RESTHandlerContainer.REST_HANDLER_CONTAINER_VERSION);
jsonObject.put("roots", keyArray);
//The JSON library escapes forward slashes, but there's no need to in this case, so we unescape them.
String serialized = jsonObject.serialize();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(serialized.replace("\\/", "/"));
}
|
class class_name[name] begin[{]
method[listRegisteredHandlers, return_type[void], modifier[private], parameter[response]] begin[{]
local_variable[type[JSONArray], keyArray]
local_variable[type[Iterator], keys]
if[binary_operation[member[.keys], !=, literal[null]]] begin[{]
while[call[keys.hasNext, parameter[]]] begin[{]
call[keyArray.add, parameter[call[keys.next, parameter[]]]]
end[}]
else begin[{]
None
end[}]
local_variable[type[JSONObject], jsonObject]
call[jsonObject.put, parameter[literal["version"], member[RESTHandlerContainer.REST_HANDLER_CONTAINER_VERSION]]]
call[jsonObject.put, parameter[literal["roots"], member[.keyArray]]]
local_variable[type[String], serialized]
call[response.setContentType, parameter[literal["application/json"]]]
call[response.setCharacterEncoding, parameter[literal["UTF-8"]]]
call[response.getWriter, parameter[]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[listRegisteredHandlers] operator[SEP] Keyword[final] identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[JSONArray] identifier[keyArray] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[keys] operator[=] identifier[REST_HANDLER_CONTAINER] operator[SEP] identifier[registeredKeys] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keys] operator[!=] Other[null] operator[SEP] {
Keyword[while] operator[SEP] identifier[keys] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[keyArray] operator[SEP] identifier[add] operator[SEP] identifier[keys] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[JSONObject] identifier[jsonObject] operator[=] Keyword[new] identifier[OrderedJSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonObject] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[RESTHandlerContainer] operator[SEP] identifier[REST_HANDLER_CONTAINER_VERSION] operator[SEP] operator[SEP] identifier[jsonObject] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[keyArray] operator[SEP] operator[SEP] identifier[String] identifier[serialized] operator[=] identifier[jsonObject] operator[SEP] identifier[serialize] operator[SEP] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setCharacterEncoding] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[serialized] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public static JsonValue serializeAsJson(Object o) throws IOException {
try {
return findFieldsToSerialize(o).mainObject;
} catch (IllegalStateException ise) {
// the reflective attempt to build the object failed.
throw new IOException("Unable to build JSON for Object", ise);
} catch (JsonException e) {
throw new IOException("Unable to build JSON for Object", e);
}
}
|
class class_name[name] begin[{]
method[serializeAsJson, return_type[type[JsonValue]], modifier[public static], parameter[o]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findFieldsToSerialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MemberReference(member=mainObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to build JSON for Object"), MemberReference(member=ise, 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ise, types=['IllegalStateException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to build JSON for Object"), 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[JsonValue] identifier[serializeAsJson] operator[SEP] identifier[Object] identifier[o] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
Keyword[return] identifier[findFieldsToSerialize] operator[SEP] identifier[o] operator[SEP] operator[SEP] identifier[mainObject] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalStateException] identifier[ise] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[ise] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void unregisterRootDirectory(
final Path pToBeUnregistered,
final WatchedDirectory pWatchedDirectory) {
unregisterRootDirectory(manager.getDefaultDispatcher(), pToBeUnregistered, pWatchedDirectory);
}
|
class class_name[name] begin[{]
method[unregisterRootDirectory, return_type[void], modifier[public], parameter[pToBeUnregistered, pWatchedDirectory]] begin[{]
call[.unregisterRootDirectory, parameter[call[manager.getDefaultDispatcher, parameter[]], member[.pToBeUnregistered], member[.pWatchedDirectory]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[unregisterRootDirectory] operator[SEP] Keyword[final] identifier[Path] identifier[pToBeUnregistered] , Keyword[final] identifier[WatchedDirectory] identifier[pWatchedDirectory] operator[SEP] {
identifier[unregisterRootDirectory] operator[SEP] identifier[manager] operator[SEP] identifier[getDefaultDispatcher] operator[SEP] operator[SEP] , identifier[pToBeUnregistered] , identifier[pWatchedDirectory] operator[SEP] operator[SEP]
}
|
public static SetAclAction fromProto(File.PSetAclAction pSetAclAction) {
if (pSetAclAction == null) {
throw new IllegalStateException("Null proto set acl action.");
}
switch (pSetAclAction) {
case REPLACE:
return SetAclAction.REPLACE;
case MODIFY:
return SetAclAction.MODIFY;
case REMOVE:
return SetAclAction.REMOVE;
case REMOVE_ALL:
return SetAclAction.REMOVE_ALL;
case REMOVE_DEFAULT:
return SetAclAction.REMOVE_DEFAULT;
default:
throw new IllegalStateException("Unrecognized proto set acl action: " + pSetAclAction);
}
}
|
class class_name[name] begin[{]
method[fromProto, return_type[type[SetAclAction]], modifier[public static], parameter[pSetAclAction]] begin[{]
if[binary_operation[member[.pSetAclAction], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null proto set acl action.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['REPLACE'], statements=[ReturnStatement(expression=MemberReference(member=REPLACE, postfix_operators=[], prefix_operators=[], qualifier=SetAclAction, selectors=[]), label=None)]), SwitchStatementCase(case=['MODIFY'], statements=[ReturnStatement(expression=MemberReference(member=MODIFY, postfix_operators=[], prefix_operators=[], qualifier=SetAclAction, selectors=[]), label=None)]), SwitchStatementCase(case=['REMOVE'], statements=[ReturnStatement(expression=MemberReference(member=REMOVE, postfix_operators=[], prefix_operators=[], qualifier=SetAclAction, selectors=[]), label=None)]), SwitchStatementCase(case=['REMOVE_ALL'], statements=[ReturnStatement(expression=MemberReference(member=REMOVE_ALL, postfix_operators=[], prefix_operators=[], qualifier=SetAclAction, selectors=[]), label=None)]), SwitchStatementCase(case=['REMOVE_DEFAULT'], statements=[ReturnStatement(expression=MemberReference(member=REMOVE_DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=SetAclAction, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unrecognized proto set acl action: "), operandr=MemberReference(member=pSetAclAction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])], expression=MemberReference(member=pSetAclAction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SetAclAction] identifier[fromProto] operator[SEP] identifier[File] operator[SEP] identifier[PSetAclAction] identifier[pSetAclAction] operator[SEP] {
Keyword[if] operator[SEP] identifier[pSetAclAction] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[pSetAclAction] operator[SEP] {
Keyword[case] identifier[REPLACE] operator[:] Keyword[return] identifier[SetAclAction] operator[SEP] identifier[REPLACE] operator[SEP] Keyword[case] identifier[MODIFY] operator[:] Keyword[return] identifier[SetAclAction] operator[SEP] identifier[MODIFY] operator[SEP] Keyword[case] identifier[REMOVE] operator[:] Keyword[return] identifier[SetAclAction] operator[SEP] identifier[REMOVE] operator[SEP] Keyword[case] identifier[REMOVE_ALL] operator[:] Keyword[return] identifier[SetAclAction] operator[SEP] identifier[REMOVE_ALL] operator[SEP] Keyword[case] identifier[REMOVE_DEFAULT] operator[:] Keyword[return] identifier[SetAclAction] operator[SEP] identifier[REMOVE_DEFAULT] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[pSetAclAction] operator[SEP] operator[SEP]
}
}
|
public String format(Object number) {
synchronized (fmt) {
return style.format(
fmt.formatToCharacterIterator(number),
preExponent);
}
}
|
class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[public], parameter[number]] begin[{]
SYNCHRONIZED[member[.fmt]] BEGIN[{]
return[call[style.format, parameter[call[fmt.formatToCharacterIterator, parameter[member[.number]]], member[.preExponent]]]]
END[}]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[format] operator[SEP] identifier[Object] identifier[number] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[fmt] operator[SEP] {
Keyword[return] identifier[style] operator[SEP] identifier[format] operator[SEP] identifier[fmt] operator[SEP] identifier[formatToCharacterIterator] operator[SEP] identifier[number] operator[SEP] , identifier[preExponent] operator[SEP] operator[SEP]
}
}
|
public void shutdown() {
if (open == 0 || shutdown) {
return;
}
shutdown = true;
sink.getIoThread().execute(new Runnable() {
@Override
public void run() {
synchronized (ServerSentEventConnection.this) {
if (queue.isEmpty() && pooled == null) {
exchange.endExchange();
}
}
}
});
}
|
class class_name[name] begin[{]
method[shutdown, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.open], ==, literal[0]], ||, member[.shutdown]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.shutdown], literal[true]]
call[sink.getIoThread, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[shutdown] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[open] operator[==] Other[0] operator[||] identifier[shutdown] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[shutdown] operator[=] literal[boolean] operator[SEP] identifier[sink] operator[SEP] identifier[getIoThread] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[ServerSentEventConnection] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[queue] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[pooled] operator[==] Other[null] operator[SEP] {
identifier[exchange] operator[SEP] identifier[endExchange] operator[SEP] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP]
}
|
public static UpdateDescription fromBsonDocument(final BsonDocument document) {
keyPresent(Fields.UPDATED_FIELDS_FIELD, document);
keyPresent(Fields.REMOVED_FIELDS_FIELD, document);
final BsonArray removedFieldsArr =
document.getArray(Fields.REMOVED_FIELDS_FIELD);
final Set<String> removedFields = new HashSet<>(removedFieldsArr.size());
for (final BsonValue field : removedFieldsArr) {
removedFields.add(field.asString().getValue());
}
return new UpdateDescription(document.getDocument(Fields.UPDATED_FIELDS_FIELD), removedFields);
}
|
class class_name[name] begin[{]
method[fromBsonDocument, return_type[type[UpdateDescription]], modifier[public static], parameter[document]] begin[{]
call[.keyPresent, parameter[member[Fields.UPDATED_FIELDS_FIELD], member[.document]]]
call[.keyPresent, parameter[member[Fields.REMOVED_FIELDS_FIELD], member[.document]]]
local_variable[type[BsonArray], removedFieldsArr]
local_variable[type[Set], removedFields]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asString, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=removedFields, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=removedFieldsArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BsonValue, sub_type=None))), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=UPDATED_FIELDS_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Fields, selectors=[])], member=getDocument, postfix_operators=[], prefix_operators=[], qualifier=document, selectors=[], type_arguments=None), MemberReference(member=removedFields, 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=UpdateDescription, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[UpdateDescription] identifier[fromBsonDocument] operator[SEP] Keyword[final] identifier[BsonDocument] identifier[document] operator[SEP] {
identifier[keyPresent] operator[SEP] identifier[Fields] operator[SEP] identifier[UPDATED_FIELDS_FIELD] , identifier[document] operator[SEP] operator[SEP] identifier[keyPresent] operator[SEP] identifier[Fields] operator[SEP] identifier[REMOVED_FIELDS_FIELD] , identifier[document] operator[SEP] operator[SEP] Keyword[final] identifier[BsonArray] identifier[removedFieldsArr] operator[=] identifier[document] operator[SEP] identifier[getArray] operator[SEP] identifier[Fields] operator[SEP] identifier[REMOVED_FIELDS_FIELD] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[removedFields] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[removedFieldsArr] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[BsonValue] identifier[field] operator[:] identifier[removedFieldsArr] operator[SEP] {
identifier[removedFields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[UpdateDescription] operator[SEP] identifier[document] operator[SEP] identifier[getDocument] operator[SEP] identifier[Fields] operator[SEP] identifier[UPDATED_FIELDS_FIELD] operator[SEP] , identifier[removedFields] operator[SEP] operator[SEP]
}
|
public static void append(File file, Object text) throws IOException {
append(file, text, false);
}
|
class class_name[name] begin[{]
method[append, return_type[void], modifier[public static], parameter[file, text]] begin[{]
call[.append, parameter[member[.file], member[.text], literal[false]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[append] operator[SEP] identifier[File] identifier[file] , identifier[Object] identifier[text] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[append] operator[SEP] identifier[file] , identifier[text] , literal[boolean] operator[SEP] operator[SEP]
}
|
private Connection getConnection(PooledConnection pconn, WSConnectionRequestInfoImpl cri, String userName) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnection", AdapterUtil.toString(pconn));
Connection conn = null;
boolean isConnectionSetupComplete = false;
try {
conn = pconn.getConnection();
postGetConnectionHandling(conn);
isConnectionSetupComplete = true;
} catch (SQLException se) {
FFDCFilter.processException(se, getClass().getName(), "260", this);
ResourceException x = AdapterUtil.translateSQLException(se, this, false, getClass());
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", se);
throw x;
} finally {
// Destroy the connection if we weren't able to successfully complete the setup.
if (!isConnectionSetupComplete) {
if (conn != null)
try {
conn.close();
} catch (Throwable x) {
}
if (pconn != null)
try {
pconn.close();
} catch (Throwable x) {
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "getConnection", AdapterUtil.toString(conn));
return conn;
}
|
class class_name[name] begin[{]
method[getConnection, return_type[type[Connection]], modifier[private], parameter[pconn, cri, userName]] begin[{]
local_variable[type[boolean], isTraceOn]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["getConnection"], call[AdapterUtil.toString, parameter[member[.pconn]]]]]
else begin[{]
None
end[}]
local_variable[type[Connection], conn]
local_variable[type[boolean], isConnectionSetupComplete]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=pconn, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=postGetConnectionHandling, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isConnectionSetupComplete, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=se, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="260"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=se, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=translateSQLException, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None), name=x)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResourceException, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=isTraceOn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getConnection"), MemberReference(member=se, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=se, types=['SQLException']))], finally_block=[IfStatement(condition=MemberReference(member=isConnectionSetupComplete, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=conn, 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=TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Throwable']))], finally_block=None, label=None, resources=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pconn, 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=TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=pconn, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Throwable']))], finally_block=None, label=None, resources=None))]))], label=None, resources=None)
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["getConnection"], call[AdapterUtil.toString, parameter[member[.conn]]]]]
else begin[{]
None
end[}]
return[member[.conn]]
end[}]
END[}]
|
Keyword[private] identifier[Connection] identifier[getConnection] operator[SEP] identifier[PooledConnection] identifier[pconn] , identifier[WSConnectionRequestInfoImpl] identifier[cri] , identifier[String] identifier[userName] operator[SEP] Keyword[throws] identifier[ResourceException] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] 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] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[pconn] operator[SEP] operator[SEP] operator[SEP] identifier[Connection] identifier[conn] operator[=] Other[null] operator[SEP] Keyword[boolean] identifier[isConnectionSetupComplete] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[conn] operator[=] identifier[pconn] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[postGetConnectionHandling] operator[SEP] identifier[conn] operator[SEP] operator[SEP] identifier[isConnectionSetupComplete] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[se] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[se] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[ResourceException] identifier[x] operator[=] identifier[AdapterUtil] operator[SEP] identifier[translateSQLException] operator[SEP] identifier[se] , Keyword[this] , literal[boolean] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] 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] , identifier[se] operator[SEP] operator[SEP] Keyword[throw] identifier[x] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] operator[!] identifier[isConnectionSetupComplete] operator[SEP] {
Keyword[if] operator[SEP] identifier[conn] operator[!=] Other[null] operator[SEP] Keyword[try] {
identifier[conn] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[x] operator[SEP] {
}
Keyword[if] operator[SEP] identifier[pconn] operator[!=] Other[null] operator[SEP] Keyword[try] {
identifier[pconn] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[x] operator[SEP] {
}
}
}
Keyword[if] operator[SEP] identifier[isTraceOn] 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] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[conn] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[conn] operator[SEP]
}
|
final void clearSmokeAndMirrorsProperties() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearSmokeAndMirrorsProperties");
/* JMSXAppId */
getHdr2().setChoiceField(JsHdr2Access.XAPPID, JsHdr2Access.IS_XAPPID_EMPTY);
/* JMSXUserID */
setUserid(null);
/* JMSXDeliveryCount is not clearable */
/* JMS_IBM_ExceptionXxxxx are not clearable */
/* JMS_IBM_Feedback */
getApi().setChoiceField(JsApiAccess.REPORTFEEDBACK, JsApiAccess.IS_REPORTFEEDBACK_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTFEEDBACKINT, JsApiAccess.IS_REPORTFEEDBACKINT_UNSET);
/* JMS_IBM_ReportXxxxxx */
getHdr2().setChoiceField(JsHdr2Access.REPORTEXPIRY, JsHdr2Access.IS_REPORTEXPIRY_UNSET);
getHdr2().setChoiceField(JsHdr2Access.REPORTCOA, JsHdr2Access.IS_REPORTCOA_UNSET);
getHdr2().setChoiceField(JsHdr2Access.REPORTCOD, JsHdr2Access.IS_REPORTCOD_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTEXCEPTION, JsApiAccess.IS_REPORTEXCEPTION_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTPAN, JsApiAccess.IS_REPORTPAN_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTNAN, JsApiAccess.IS_REPORTNAN_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTPASSMSGID, JsApiAccess.IS_REPORTPASSMSGID_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTPASSCORRELID, JsApiAccess.IS_REPORTPASSCORRELID_UNSET);
getApi().setChoiceField(JsApiAccess.REPORTDISCARDMSG, JsApiAccess.IS_REPORTDISCARDMSG_UNSET);
/* JMS_IBM_ArmCorrelator & JMS_TOG_ARM_Correlator */
setARMCorrelator(null);
/* transportVersion */
getHdr2().setChoiceField(JsHdr2Access.TRANSPORTVERSION, JsHdr2Access.IS_TRANSPORTVERSION_EMPTY);
// JMS_IBM_Character_Set and JMS_IBM_Encoding are not really smoke-and-mirrors
// properties, but they do need to be cleared in the message itself too. d395685
setCcsid(null);
setEncoding(null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearSmokeAndMirrorsProperties");
}
|
class class_name[name] begin[{]
method[clearSmokeAndMirrorsProperties, return_type[void], modifier[final], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["clearSmokeAndMirrorsProperties"]]]
else begin[{]
None
end[}]
call[.getHdr2, parameter[]]
call[.setUserid, parameter[literal[null]]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.getHdr2, parameter[]]
call[.getHdr2, parameter[]]
call[.getHdr2, parameter[]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.getApi, parameter[]]
call[.setARMCorrelator, parameter[literal[null]]]
call[.getHdr2, parameter[]]
call[.setCcsid, parameter[literal[null]]]
call[.setEncoding, parameter[literal[null]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["clearSmokeAndMirrorsProperties"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[final] Keyword[void] identifier[clearSmokeAndMirrorsProperties] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[XAPPID] , identifier[JsHdr2Access] operator[SEP] identifier[IS_XAPPID_EMPTY] operator[SEP] operator[SEP] identifier[setUserid] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTFEEDBACK] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTFEEDBACK_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTFEEDBACKINT] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTFEEDBACKINT_UNSET] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[REPORTEXPIRY] , identifier[JsHdr2Access] operator[SEP] identifier[IS_REPORTEXPIRY_UNSET] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[REPORTCOA] , identifier[JsHdr2Access] operator[SEP] identifier[IS_REPORTCOA_UNSET] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[REPORTCOD] , identifier[JsHdr2Access] operator[SEP] identifier[IS_REPORTCOD_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTEXCEPTION] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTEXCEPTION_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTPAN] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTPAN_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTNAN] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTNAN_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTPASSMSGID] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTPASSMSGID_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTPASSCORRELID] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTPASSCORRELID_UNSET] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTDISCARDMSG] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTDISCARDMSG_UNSET] operator[SEP] operator[SEP] identifier[setARMCorrelator] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[TRANSPORTVERSION] , identifier[JsHdr2Access] operator[SEP] identifier[IS_TRANSPORTVERSION_EMPTY] operator[SEP] operator[SEP] identifier[setCcsid] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setEncoding] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public boolean hasSubModule() {
if (!hasSubModInit) {
hasSubModInit = true;
if (perfData != null) {
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getSubmoduleName() != null) {
hasSubMod = true;
break;
}
}
}
}
return hasSubMod;
}
|
class class_name[name] begin[{]
method[hasSubModule, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[member[.hasSubModInit]] begin[{]
assign[member[.hasSubModInit], literal[true]]
if[binary_operation[member[.perfData], !=, literal[null]]] begin[{]
local_variable[type[Iterator], allData]
while[call[allData.hasNext, parameter[]]] begin[{]
local_variable[type[PmiDataInfo], dataInfo]
if[binary_operation[call[dataInfo.getSubmoduleName, parameter[]], !=, literal[null]]] begin[{]
assign[member[.hasSubMod], literal[true]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.hasSubMod]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[hasSubModule] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[hasSubModInit] operator[SEP] {
identifier[hasSubModInit] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[perfData] operator[!=] Other[null] operator[SEP] {
identifier[Iterator] identifier[allData] operator[=] identifier[perfData] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[allData] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[PmiDataInfo] identifier[dataInfo] operator[=] operator[SEP] identifier[PmiDataInfo] operator[SEP] identifier[allData] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataInfo] operator[SEP] identifier[getSubmoduleName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[hasSubMod] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
Keyword[return] identifier[hasSubMod] operator[SEP]
}
|
protected double getSqrdNorm(int i, int j, List<? extends Vec> vecs, List<Double> cache)
{
if(cache == null)
return Math.pow(vecs.get(i).pNormDist(2.0, vecs.get(j)), 2);
return cache.get(i)+cache.get(j)-2*vecs.get(i).dot(vecs.get(j));
}
|
class class_name[name] begin[{]
method[getSqrdNorm, return_type[type[double]], modifier[protected], parameter[i, j, vecs, cache]] begin[{]
if[binary_operation[member[.cache], ==, literal[null]]] begin[{]
return[call[Math.pow, parameter[call[vecs.get, parameter[member[.i]]], literal[2]]]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[call[cache.get, parameter[member[.i]]], +, call[cache.get, parameter[member[.j]]]], -, binary_operation[literal[2], *, call[vecs.get, parameter[member[.i]]]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[double] identifier[getSqrdNorm] operator[SEP] Keyword[int] identifier[i] , Keyword[int] identifier[j] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[Vec] operator[>] identifier[vecs] , identifier[List] operator[<] identifier[Double] operator[>] identifier[cache] operator[SEP] {
Keyword[if] operator[SEP] identifier[cache] operator[==] Other[null] operator[SEP] Keyword[return] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[vecs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[pNormDist] operator[SEP] literal[Float] , identifier[vecs] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] , Other[2] operator[SEP] operator[SEP] Keyword[return] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[+] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[-] Other[2] operator[*] identifier[vecs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dot] operator[SEP] identifier[vecs] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Expression string(int opPos) throws TransformerException
{
return compileUnary(new org.apache.xpath.operations.String(), opPos);
}
|
class class_name[name] begin[{]
method[string, return_type[type[Expression]], modifier[protected], parameter[opPos]] begin[{]
return[call[.compileUnary, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=apache, sub_type=ReferenceType(arguments=None, dimensions=None, name=xpath, sub_type=ReferenceType(arguments=None, dimensions=None, name=operations, sub_type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)))))), member[.opPos]]]]
end[}]
END[}]
|
Keyword[protected] identifier[Expression] identifier[string] operator[SEP] Keyword[int] identifier[opPos] operator[SEP] Keyword[throws] identifier[TransformerException] {
Keyword[return] identifier[compileUnary] operator[SEP] Keyword[new] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[xpath] operator[SEP] identifier[operations] operator[SEP] identifier[String] operator[SEP] operator[SEP] , identifier[opPos] operator[SEP] operator[SEP]
}
|
@Beta
public static Injector bootstrap(final Class<?> main, final Module externalBindings, final BootstrapModule... externalBootstrapModules) {
final LifecycleInjectorBuilder builder = LifecycleInjector.builder();
// Create a temporary Guice injector for the purpose of constructing the list of
// BootstrapModules which can inject any of the bootstrap annotations as well as
// the externally provided bindings.
// Creation order,
// 1. Construct all BootstrapModule classes
// 2. Inject external bindings into BootstrapModule instances
// 3. Create the bootstrap injector with these modules
Injector injector = Guice.createInjector(new AbstractModule() {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void configure() {
if (externalBindings != null)
install(externalBindings);
Multibinder<BootstrapModule> bootstrapModules = Multibinder.newSetBinder(binder(), BootstrapModule.class);
Multibinder<LifecycleInjectorBuilderSuite> suites = Multibinder.newSetBinder(binder(), LifecycleInjectorBuilderSuite.class);
if (externalBootstrapModules != null) {
for (final BootstrapModule bootstrapModule : externalBootstrapModules) {
bootstrapModules
.addBinding()
.toProvider(new MemberInjectingInstanceProvider<BootstrapModule>(bootstrapModule));
}
}
// Iterate through all annotations of the main class and convert them into
// their BootstrapModules
for (final Annotation annot : main.getDeclaredAnnotations()) {
final Class<? extends Annotation> type = annot.annotationType();
LOG.info("Found bootstrap annotation {}", type.getName());
Bootstrap bootstrap = type.getAnnotation(Bootstrap.class);
if (bootstrap != null) {
boolean added = false;
// This is a suite
if (!bootstrap.value().equals(Bootstrap.NullLifecycleInjectorBuilderSuite.class)) {
LOG.info("Adding Suite {}", bootstrap.bootstrap());
suites
.addBinding()
.to(bootstrap.value())
.asEagerSingleton();
added = true;
}
// This is a bootstrap module
if (!bootstrap.bootstrap().equals(Bootstrap.NullBootstrapModule.class)) {
Preconditions.checkState(added==false, "%s already added as a LifecycleInjectorBuilderSuite", bootstrap.annotationType().getName());
added = true;
LOG.info("Adding BootstrapModule {}", bootstrap.bootstrap());
bootstrapModules
.addBinding()
.to(bootstrap.bootstrap())
.asEagerSingleton();
// Make this annotation injectable into any plain Module
builder.withAdditionalBootstrapModules(forAnnotation(annot));
}
// This is a plain guice module
if (!bootstrap.module().equals(Bootstrap.NullModule.class)) {
Preconditions.checkState(added==false, "%s already added as a BootstrapModule", bootstrap.annotationType().getName());
added = true;
LOG.info("Adding Module {}", bootstrap.bootstrap());
builder.withAdditionalModuleClasses(bootstrap.module());
// Make the annotation injectable into the module
builder.withAdditionalBootstrapModules(forAnnotation(annot));
}
// Makes the annotation injectable into LifecycleInjectorBuilderSuite
bind(Key.get(type))
.toProvider(new Provider() {
@Override
public Object get() {
return annot;
}
})
.in(Scopes.SINGLETON);
}
}
}
});
// First, give all LifecycleInjectorBuilderSuite's priority
Set<LifecycleInjectorBuilderSuite> suites = injector.getInstance(Key.get(new TypeLiteral<Set<LifecycleInjectorBuilderSuite>>() {}));
for (LifecycleInjectorBuilderSuite suite : suites) {
suite.configure(builder);
}
// Next, install BootstrapModule's
builder.withAdditionalBootstrapModules(injector.getInstance(Key.get(new TypeLiteral<Set<BootstrapModule>>() {})));
// The main class is added last so it can override any bindings from the BootstrapModule's and LifecycleInjectorBuilderSuite's
if (Module.class.isAssignableFrom(main)) {
try {
builder.withAdditionalModuleClasses(main);
} catch (Exception e) {
throw new ProvisionException(String.format("Failed to create module for main class '%s'", main.getName()), e);
}
}
// Finally, create and return the injector
return builder.build().createInjector();
}
|
class class_name[name] begin[{]
method[bootstrap, return_type[type[Injector]], modifier[public static], parameter[main, externalBindings, externalBootstrapModules]] begin[{]
local_variable[type[LifecycleInjectorBuilder], builder]
local_variable[type[Injector], injector]
local_variable[type[Set], suites]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=configure, postfix_operators=[], prefix_operators=[], qualifier=suite, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=suites, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=suite)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LifecycleInjectorBuilderSuite, sub_type=None))), label=None)
call[builder.withAdditionalBootstrapModules, parameter[call[injector.getInstance, parameter[call[Key.get, parameter[ClassCreator(arguments=[], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BootstrapModule, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=None, name=TypeLiteral, sub_type=None))]]]]]]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=main, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Module, sub_type=None))] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=main, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withAdditionalModuleClasses, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to create module for main class '%s'"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=main, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), 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=ProvisionException, sub_type=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[}]
return[call[builder.build, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Beta] Keyword[public] Keyword[static] identifier[Injector] identifier[bootstrap] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[main] , Keyword[final] identifier[Module] identifier[externalBindings] , Keyword[final] identifier[BootstrapModule] operator[...] identifier[externalBootstrapModules] operator[SEP] {
Keyword[final] identifier[LifecycleInjectorBuilder] identifier[builder] operator[=] identifier[LifecycleInjector] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[Injector] identifier[injector] operator[=] identifier[Guice] operator[SEP] identifier[createInjector] operator[SEP] Keyword[new] identifier[AbstractModule] operator[SEP] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[configure] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[externalBindings] operator[!=] Other[null] operator[SEP] identifier[install] operator[SEP] identifier[externalBindings] operator[SEP] operator[SEP] identifier[Multibinder] operator[<] identifier[BootstrapModule] operator[>] identifier[bootstrapModules] operator[=] identifier[Multibinder] operator[SEP] identifier[newSetBinder] operator[SEP] identifier[binder] operator[SEP] operator[SEP] , identifier[BootstrapModule] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Multibinder] operator[<] identifier[LifecycleInjectorBuilderSuite] operator[>] identifier[suites] operator[=] identifier[Multibinder] operator[SEP] identifier[newSetBinder] operator[SEP] identifier[binder] operator[SEP] operator[SEP] , identifier[LifecycleInjectorBuilderSuite] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[externalBootstrapModules] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[BootstrapModule] identifier[bootstrapModule] operator[:] identifier[externalBootstrapModules] operator[SEP] {
identifier[bootstrapModules] operator[SEP] identifier[addBinding] operator[SEP] operator[SEP] operator[SEP] identifier[toProvider] operator[SEP] Keyword[new] identifier[MemberInjectingInstanceProvider] operator[<] identifier[BootstrapModule] operator[>] operator[SEP] identifier[bootstrapModule] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[final] identifier[Annotation] identifier[annot] operator[:] identifier[main] operator[SEP] identifier[getDeclaredAnnotations] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[type] operator[=] identifier[annot] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Bootstrap] identifier[bootstrap] operator[=] identifier[type] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Bootstrap] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bootstrap] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] identifier[added] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[bootstrap] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Bootstrap] operator[SEP] identifier[NullLifecycleInjectorBuilderSuite] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[bootstrap] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[suites] operator[SEP] identifier[addBinding] operator[SEP] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[bootstrap] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[asEagerSingleton] operator[SEP] operator[SEP] operator[SEP] identifier[added] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[bootstrap] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Bootstrap] operator[SEP] identifier[NullBootstrapModule] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[added] operator[==] literal[boolean] , literal[String] , identifier[bootstrap] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[added] operator[=] literal[boolean] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[bootstrap] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bootstrapModules] operator[SEP] identifier[addBinding] operator[SEP] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[bootstrap] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[asEagerSingleton] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[withAdditionalBootstrapModules] operator[SEP] identifier[forAnnotation] operator[SEP] identifier[annot] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[bootstrap] operator[SEP] identifier[module] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Bootstrap] operator[SEP] identifier[NullModule] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[added] operator[==] literal[boolean] , literal[String] , identifier[bootstrap] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[added] operator[=] literal[boolean] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[bootstrap] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[withAdditionalModuleClasses] operator[SEP] identifier[bootstrap] operator[SEP] identifier[module] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[withAdditionalBootstrapModules] operator[SEP] identifier[forAnnotation] operator[SEP] identifier[annot] operator[SEP] operator[SEP] operator[SEP]
}
identifier[bind] operator[SEP] identifier[Key] operator[SEP] identifier[get] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[toProvider] operator[SEP] Keyword[new] identifier[Provider] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[get] operator[SEP] operator[SEP] {
Keyword[return] identifier[annot] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[Scopes] operator[SEP] identifier[SINGLETON] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[LifecycleInjectorBuilderSuite] operator[>] identifier[suites] operator[=] identifier[injector] operator[SEP] identifier[getInstance] operator[SEP] identifier[Key] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[TypeLiteral] operator[<] identifier[Set] operator[<] identifier[LifecycleInjectorBuilderSuite] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[LifecycleInjectorBuilderSuite] identifier[suite] operator[:] identifier[suites] operator[SEP] {
identifier[suite] operator[SEP] identifier[configure] operator[SEP] identifier[builder] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[withAdditionalBootstrapModules] operator[SEP] identifier[injector] operator[SEP] identifier[getInstance] operator[SEP] identifier[Key] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[TypeLiteral] operator[<] identifier[Set] operator[<] identifier[BootstrapModule] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Module] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[main] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[builder] operator[SEP] identifier[withAdditionalModuleClasses] operator[SEP] identifier[main] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ProvisionException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[main] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[createInjector] operator[SEP] operator[SEP] operator[SEP]
}
|
public void moveNextPosition(boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, smooth);
}
|
class class_name[name] begin[{]
method[moveNextPosition, return_type[void], modifier[public], parameter[smooth]] begin[{]
if[binary_operation[call[.getRealAdapter, parameter[]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You did not set a slider adapter")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[mViewPager.setCurrentItem, parameter[binary_operation[call[mViewPager.getCurrentItem, parameter[]], +, literal[1]], member[.smooth]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[moveNextPosition] operator[SEP] Keyword[boolean] identifier[smooth] operator[SEP] {
Keyword[if] operator[SEP] identifier[getRealAdapter] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[mViewPager] operator[SEP] identifier[setCurrentItem] operator[SEP] identifier[mViewPager] operator[SEP] identifier[getCurrentItem] operator[SEP] operator[SEP] operator[+] Other[1] , identifier[smooth] operator[SEP] operator[SEP]
}
|
private TypeArgSignature getTypeArgSignature(Type type) {
if (type instanceof WildcardType) {
WildcardType wildcardType = (WildcardType) type;
Type lowerBound = wildcardType.getLowerBounds().length == 0 ? null
: wildcardType.getLowerBounds()[0];
Type upperBound = wildcardType.getUpperBounds().length == 0 ? null
: wildcardType.getUpperBounds()[0];
if (lowerBound == null && Object.class.equals(upperBound)) {
return new TypeArgSignature(
TypeArgSignature.UNBOUNDED_WILDCARD,
(FieldTypeSignature) getFullTypeSignature(upperBound));
} else if (lowerBound == null && upperBound != null) {
return new TypeArgSignature(
TypeArgSignature.UPPERBOUND_WILDCARD,
(FieldTypeSignature) getFullTypeSignature(upperBound));
} else if (lowerBound != null) {
return new TypeArgSignature(
TypeArgSignature.LOWERBOUND_WILDCARD,
(FieldTypeSignature) getFullTypeSignature(lowerBound));
} else {
throw new RuntimeException("Invalid type");
}
} else {
return new TypeArgSignature(TypeArgSignature.NO_WILDCARD,
(FieldTypeSignature) getFullTypeSignature(type));
}
}
|
class class_name[name] begin[{]
method[getTypeArgSignature, return_type[type[TypeArgSignature]], modifier[private], parameter[type]] begin[{]
if[binary_operation[member[.type], instanceof, type[WildcardType]]] begin[{]
local_variable[type[WildcardType], wildcardType]
local_variable[type[Type], lowerBound]
local_variable[type[Type], upperBound]
if[binary_operation[binary_operation[member[.lowerBound], ==, literal[null]], &&, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=upperBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=UNBOUNDED_WILDCARD, postfix_operators=[], prefix_operators=[], qualifier=TypeArgSignature, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=upperBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFullTypeSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FieldTypeSignature, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeArgSignature, sub_type=None))]
else begin[{]
if[binary_operation[binary_operation[member[.lowerBound], ==, literal[null]], &&, binary_operation[member[.upperBound], !=, literal[null]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=UPPERBOUND_WILDCARD, postfix_operators=[], prefix_operators=[], qualifier=TypeArgSignature, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=upperBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFullTypeSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FieldTypeSignature, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeArgSignature, sub_type=None))]
else begin[{]
if[binary_operation[member[.lowerBound], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=LOWERBOUND_WILDCARD, postfix_operators=[], prefix_operators=[], qualifier=TypeArgSignature, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=lowerBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFullTypeSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FieldTypeSignature, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeArgSignature, sub_type=None))]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid type")], 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)
end[}]
end[}]
end[}]
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=NO_WILDCARD, postfix_operators=[], prefix_operators=[], qualifier=TypeArgSignature, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFullTypeSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FieldTypeSignature, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeArgSignature, sub_type=None))]
end[}]
end[}]
END[}]
|
Keyword[private] identifier[TypeArgSignature] identifier[getTypeArgSignature] operator[SEP] identifier[Type] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] Keyword[instanceof] identifier[WildcardType] operator[SEP] {
identifier[WildcardType] identifier[wildcardType] operator[=] operator[SEP] identifier[WildcardType] operator[SEP] identifier[type] operator[SEP] identifier[Type] identifier[lowerBound] operator[=] identifier[wildcardType] operator[SEP] identifier[getLowerBounds] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[==] Other[0] operator[?] Other[null] operator[:] identifier[wildcardType] operator[SEP] identifier[getLowerBounds] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Type] identifier[upperBound] operator[=] identifier[wildcardType] operator[SEP] identifier[getUpperBounds] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[==] Other[0] operator[?] Other[null] operator[:] identifier[wildcardType] operator[SEP] identifier[getUpperBounds] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lowerBound] operator[==] Other[null] operator[&&] identifier[Object] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[upperBound] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[TypeArgSignature] operator[SEP] identifier[TypeArgSignature] operator[SEP] identifier[UNBOUNDED_WILDCARD] , operator[SEP] identifier[FieldTypeSignature] operator[SEP] identifier[getFullTypeSignature] operator[SEP] identifier[upperBound] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lowerBound] operator[==] Other[null] operator[&&] identifier[upperBound] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[TypeArgSignature] operator[SEP] identifier[TypeArgSignature] operator[SEP] identifier[UPPERBOUND_WILDCARD] , operator[SEP] identifier[FieldTypeSignature] operator[SEP] identifier[getFullTypeSignature] operator[SEP] identifier[upperBound] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lowerBound] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[TypeArgSignature] operator[SEP] identifier[TypeArgSignature] operator[SEP] identifier[LOWERBOUND_WILDCARD] , operator[SEP] identifier[FieldTypeSignature] operator[SEP] identifier[getFullTypeSignature] operator[SEP] identifier[lowerBound] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[TypeArgSignature] operator[SEP] identifier[TypeArgSignature] operator[SEP] identifier[NO_WILDCARD] , operator[SEP] identifier[FieldTypeSignature] operator[SEP] identifier[getFullTypeSignature] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static void doTransform(Tree t) {
if (t.value().startsWith("QP")) {
//look at the children
List<Tree> children = t.getChildrenAsList();
if (children.size() >= 3 && children.get(0).isPreTerminal()) {
//go through the children and check if they match the structure we want
String child1 = children.get(0).value();
String child2 = children.get(1).value();
String child3 = children.get(2).value();
if((child3.startsWith("CD") || child3.startsWith("DT")) &&
(child1.startsWith("RB") || child1.startsWith("JJ") || child1.startsWith("IN")) &&
(child2.startsWith("IN") || child2.startsWith("JJ"))) {
transformQP(t);
}
}
/* --- to be written or deleted
} else if (t.value().startsWith("NP")) {
//look at the children
List<Tree> children = t.getChildrenAsList();
if (children.size() >= 3) {
}
---- */
} else if (t.isPhrasal()) {
for (Tree child : t.getChildrenAsList()) {
doTransform(child);
}
}
}
|
class class_name[name] begin[{]
method[doTransform, return_type[void], modifier[private static], parameter[t]] begin[{]
if[call[t.value, parameter[]]] begin[{]
local_variable[type[List], children]
if[binary_operation[binary_operation[call[children.size, parameter[]], >=, literal[3]], &&, call[children.get, parameter[literal[0]]]]] begin[{]
local_variable[type[String], child1]
local_variable[type[String], child2]
local_variable[type[String], child3]
if[binary_operation[binary_operation[binary_operation[call[child3.startsWith, parameter[literal["CD"]]], ||, call[child3.startsWith, parameter[literal["DT"]]]], &&, binary_operation[binary_operation[call[child1.startsWith, parameter[literal["RB"]]], ||, call[child1.startsWith, parameter[literal["JJ"]]]], ||, call[child1.startsWith, parameter[literal["IN"]]]]], &&, binary_operation[call[child2.startsWith, parameter[literal["IN"]]], ||, call[child2.startsWith, parameter[literal["JJ"]]]]]] begin[{]
call[.transformQP, parameter[member[.t]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
if[call[t.isPhrasal, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doTransform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildrenAsList, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Tree, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[doTransform] operator[SEP] identifier[Tree] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Tree] operator[>] identifier[children] operator[=] identifier[t] operator[SEP] identifier[getChildrenAsList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[children] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[3] operator[&&] identifier[children] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[isPreTerminal] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[child1] operator[=] identifier[children] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[child2] operator[=] identifier[children] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[child3] operator[=] identifier[children] operator[SEP] identifier[get] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[child3] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[child3] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[child1] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[child1] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[child1] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[child2] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[child2] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[transformQP] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[isPhrasal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Tree] identifier[child] operator[:] identifier[t] operator[SEP] identifier[getChildrenAsList] operator[SEP] operator[SEP] operator[SEP] {
identifier[doTransform] operator[SEP] identifier[child] operator[SEP] operator[SEP]
}
}
}
|
private int findRank(SemanticSpace sspace,
String target, String other) {
Vector v1 = sspace.getVector(target);
Vector v2 = sspace.getVector(other);
// Compute the base similarity between the two words
double baseSim = Similarity.cosineSimilarity(v1, v2);
int rank = 0;
// Next, count how many words are more similar to the target than the
// other word is
for (String word : sspace.getWords()) {
Vector v = sspace.getVector(word);
double sim = Similarity.cosineSimilarity(v1, v);
if (sim > baseSim)
rank++;
}
return rank;
}
|
class class_name[name] begin[{]
method[findRank, return_type[type[int]], modifier[private], parameter[sspace, target, other]] begin[{]
local_variable[type[Vector], v1]
local_variable[type[Vector], v2]
local_variable[type[double], baseSim]
local_variable[type[int], rank]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVector, postfix_operators=[], prefix_operators=[], qualifier=sspace, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Vector, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cosineSimilarity, postfix_operators=[], prefix_operators=[], qualifier=Similarity, selectors=[], type_arguments=None), name=sim)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=sim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=baseSim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MemberReference(member=rank, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getWords, postfix_operators=[], prefix_operators=[], qualifier=sspace, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.rank]]
end[}]
END[}]
|
Keyword[private] Keyword[int] identifier[findRank] operator[SEP] identifier[SemanticSpace] identifier[sspace] , identifier[String] identifier[target] , identifier[String] identifier[other] operator[SEP] {
identifier[Vector] identifier[v1] operator[=] identifier[sspace] operator[SEP] identifier[getVector] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[Vector] identifier[v2] operator[=] identifier[sspace] operator[SEP] identifier[getVector] operator[SEP] identifier[other] operator[SEP] operator[SEP] Keyword[double] identifier[baseSim] operator[=] identifier[Similarity] operator[SEP] identifier[cosineSimilarity] operator[SEP] identifier[v1] , identifier[v2] operator[SEP] operator[SEP] Keyword[int] identifier[rank] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[word] operator[:] identifier[sspace] operator[SEP] identifier[getWords] operator[SEP] operator[SEP] operator[SEP] {
identifier[Vector] identifier[v] operator[=] identifier[sspace] operator[SEP] identifier[getVector] operator[SEP] identifier[word] operator[SEP] operator[SEP] Keyword[double] identifier[sim] operator[=] identifier[Similarity] operator[SEP] identifier[cosineSimilarity] operator[SEP] identifier[v1] , identifier[v] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sim] operator[>] identifier[baseSim] operator[SEP] identifier[rank] operator[++] operator[SEP]
}
Keyword[return] identifier[rank] operator[SEP]
}
|
@Override
public GetAppliedSchemaVersionResult getAppliedSchemaVersion(GetAppliedSchemaVersionRequest request) {
request = beforeClientExecution(request);
return executeGetAppliedSchemaVersion(request);
}
|
class class_name[name] begin[{]
method[getAppliedSchemaVersion, return_type[type[GetAppliedSchemaVersionResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetAppliedSchemaVersion, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GetAppliedSchemaVersionResult] identifier[getAppliedSchemaVersion] operator[SEP] identifier[GetAppliedSchemaVersionRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetAppliedSchemaVersion] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected IFeatureLinkingCandidate getKnownFeature(XAbstractFeatureCall featureCall, AbstractTypeComputationState state, ResolvedTypes resolvedTypes) {
IFeatureLinkingCandidate result = resolvedTypes.getFeature(featureCall);
if (result != null) {
return new AppliedFeatureLinkingCandidate(result);
}
EObject proxyOrResolved = (EObject) featureCall.eGet(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false);
if (proxyOrResolved == null) {
return new NullFeatureLinkingCandidate(featureCall, state);
}
if (!proxyOrResolved.eIsProxy()) {
return state.createResolvedLink(featureCall, (JvmIdentifiableElement) proxyOrResolved);
}
if (!encoder.isCrossLinkFragment(featureCall.eResource(), EcoreUtil.getURI(proxyOrResolved).fragment())) {
JvmIdentifiableElement feature = featureCall.getFeature();
if (!feature.eIsProxy()) {
return state.createResolvedLink(featureCall, feature);
}
}
return null;
}
|
class class_name[name] begin[{]
method[getKnownFeature, return_type[type[IFeatureLinkingCandidate]], modifier[protected], parameter[featureCall, state, resolvedTypes]] begin[{]
local_variable[type[IFeatureLinkingCandidate], result]
if[binary_operation[member[.result], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=result, 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=AppliedFeatureLinkingCandidate, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[EObject], proxyOrResolved]
if[binary_operation[member[.proxyOrResolved], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=featureCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=state, 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=NullFeatureLinkingCandidate, sub_type=None))]
else begin[{]
None
end[}]
if[call[proxyOrResolved.eIsProxy, parameter[]]] begin[{]
return[call[state.createResolvedLink, parameter[member[.featureCall], Cast(expression=MemberReference(member=proxyOrResolved, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JvmIdentifiableElement, sub_type=None))]]]
else begin[{]
None
end[}]
if[call[encoder.isCrossLinkFragment, parameter[call[featureCall.eResource, parameter[]], call[EcoreUtil.getURI, parameter[member[.proxyOrResolved]]]]]] begin[{]
local_variable[type[JvmIdentifiableElement], feature]
if[call[feature.eIsProxy, parameter[]]] begin[{]
return[call[state.createResolvedLink, parameter[member[.featureCall], member[.feature]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[protected] identifier[IFeatureLinkingCandidate] identifier[getKnownFeature] operator[SEP] identifier[XAbstractFeatureCall] identifier[featureCall] , identifier[AbstractTypeComputationState] identifier[state] , identifier[ResolvedTypes] identifier[resolvedTypes] operator[SEP] {
identifier[IFeatureLinkingCandidate] identifier[result] operator[=] identifier[resolvedTypes] operator[SEP] identifier[getFeature] operator[SEP] identifier[featureCall] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[AppliedFeatureLinkingCandidate] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
identifier[EObject] identifier[proxyOrResolved] operator[=] operator[SEP] identifier[EObject] operator[SEP] identifier[featureCall] operator[SEP] identifier[eGet] operator[SEP] identifier[XbasePackage] operator[SEP] identifier[Literals] operator[SEP] identifier[XABSTRACT_FEATURE_CALL__FEATURE] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proxyOrResolved] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[NullFeatureLinkingCandidate] operator[SEP] identifier[featureCall] , identifier[state] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[proxyOrResolved] operator[SEP] identifier[eIsProxy] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[state] operator[SEP] identifier[createResolvedLink] operator[SEP] identifier[featureCall] , operator[SEP] identifier[JvmIdentifiableElement] operator[SEP] identifier[proxyOrResolved] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[encoder] operator[SEP] identifier[isCrossLinkFragment] operator[SEP] identifier[featureCall] operator[SEP] identifier[eResource] operator[SEP] operator[SEP] , identifier[EcoreUtil] operator[SEP] identifier[getURI] operator[SEP] identifier[proxyOrResolved] operator[SEP] operator[SEP] identifier[fragment] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[JvmIdentifiableElement] identifier[feature] operator[=] identifier[featureCall] operator[SEP] identifier[getFeature] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[feature] operator[SEP] identifier[eIsProxy] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[state] operator[SEP] identifier[createResolvedLink] operator[SEP] identifier[featureCall] , identifier[feature] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void setShortRunningThreadPool(BlockingExecutor executor)
{
if (trace)
log.trace("short running executor:" + (executor != null ? executor.getClass() : "null"));
if (executor != null)
{
if (executor instanceof StatisticsExecutor)
{
this.shortRunningExecutor = (StatisticsExecutor) executor;
}
else
{
this.shortRunningExecutor = new StatisticsExecutorImpl(executor);
}
}
}
|
class class_name[name] begin[{]
method[setShortRunningThreadPool, return_type[void], modifier[public], parameter[executor]] begin[{]
if[member[.trace]] begin[{]
call[log.trace, parameter[binary_operation[literal["short running executor:"], +, TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=executor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null"), if_true=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=executor, selectors=[], type_arguments=None))]]]
else begin[{]
None
end[}]
if[binary_operation[member[.executor], !=, literal[null]]] begin[{]
if[binary_operation[member[.executor], instanceof, type[StatisticsExecutor]]] begin[{]
assign[THIS[member[None.shortRunningExecutor]], Cast(expression=MemberReference(member=executor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=StatisticsExecutor, sub_type=None))]
else begin[{]
assign[THIS[member[None.shortRunningExecutor]], ClassCreator(arguments=[MemberReference(member=executor, 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=StatisticsExecutorImpl, sub_type=None))]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setShortRunningThreadPool] operator[SEP] identifier[BlockingExecutor] identifier[executor] operator[SEP] {
Keyword[if] operator[SEP] identifier[trace] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] operator[SEP] identifier[executor] operator[!=] Other[null] operator[?] identifier[executor] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[executor] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[executor] Keyword[instanceof] identifier[StatisticsExecutor] operator[SEP] {
Keyword[this] operator[SEP] identifier[shortRunningExecutor] operator[=] operator[SEP] identifier[StatisticsExecutor] operator[SEP] identifier[executor] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[shortRunningExecutor] operator[=] Keyword[new] identifier[StatisticsExecutorImpl] operator[SEP] identifier[executor] operator[SEP] operator[SEP]
}
}
}
|
protected void customizeTitle(TextTitle title, Font font)
{
title.setFont(font);
title.setTextAlignment(HorizontalAlignment.LEFT);
title.setPaint(Color.BLACK);
title.setBackgroundPaint(TRANSPARENT_COLOR);
}
|
class class_name[name] begin[{]
method[customizeTitle, return_type[void], modifier[protected], parameter[title, font]] begin[{]
call[title.setFont, parameter[member[.font]]]
call[title.setTextAlignment, parameter[member[HorizontalAlignment.LEFT]]]
call[title.setPaint, parameter[member[Color.BLACK]]]
call[title.setBackgroundPaint, parameter[member[.TRANSPARENT_COLOR]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[customizeTitle] operator[SEP] identifier[TextTitle] identifier[title] , identifier[Font] identifier[font] operator[SEP] {
identifier[title] operator[SEP] identifier[setFont] operator[SEP] identifier[font] operator[SEP] operator[SEP] identifier[title] operator[SEP] identifier[setTextAlignment] operator[SEP] identifier[HorizontalAlignment] operator[SEP] identifier[LEFT] operator[SEP] operator[SEP] identifier[title] operator[SEP] identifier[setPaint] operator[SEP] identifier[Color] operator[SEP] identifier[BLACK] operator[SEP] operator[SEP] identifier[title] operator[SEP] identifier[setBackgroundPaint] operator[SEP] identifier[TRANSPARENT_COLOR] operator[SEP] operator[SEP]
}
|
@Override
public void characters(char ch[], int start, int length) {
content.append(new String(ch, start, length));
}
|
class class_name[name] begin[{]
method[characters, return_type[void], modifier[public], parameter[ch, start, length]] begin[{]
call[content.append, parameter[ClassCreator(arguments=[MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[characters] operator[SEP] Keyword[char] identifier[ch] operator[SEP] operator[SEP] , Keyword[int] identifier[start] , Keyword[int] identifier[length] operator[SEP] {
identifier[content] operator[SEP] identifier[append] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[ch] , identifier[start] , identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int cudaMemcpy2DFromArrayAsync(Pointer dst, long dpitch, cudaArray src, long wOffset, long hOffset, long width, long height, int cudaMemcpyKind_kind, cudaStream_t stream)
{
return checkResult(cudaMemcpy2DFromArrayAsyncNative(dst, dpitch, src, wOffset, hOffset, width, height, cudaMemcpyKind_kind, stream));
}
|
class class_name[name] begin[{]
method[cudaMemcpy2DFromArrayAsync, return_type[type[int]], modifier[public static], parameter[dst, dpitch, src, wOffset, hOffset, width, height, cudaMemcpyKind_kind, stream]] begin[{]
return[call[.checkResult, parameter[call[.cudaMemcpy2DFromArrayAsyncNative, parameter[member[.dst], member[.dpitch], member[.src], member[.wOffset], member[.hOffset], member[.width], member[.height], member[.cudaMemcpyKind_kind], member[.stream]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[cudaMemcpy2DFromArrayAsync] operator[SEP] identifier[Pointer] identifier[dst] , Keyword[long] identifier[dpitch] , identifier[cudaArray] identifier[src] , Keyword[long] identifier[wOffset] , Keyword[long] identifier[hOffset] , Keyword[long] identifier[width] , Keyword[long] identifier[height] , Keyword[int] identifier[cudaMemcpyKind_kind] , identifier[cudaStream_t] identifier[stream] operator[SEP] {
Keyword[return] identifier[checkResult] operator[SEP] identifier[cudaMemcpy2DFromArrayAsyncNative] operator[SEP] identifier[dst] , identifier[dpitch] , identifier[src] , identifier[wOffset] , identifier[hOffset] , identifier[width] , identifier[height] , identifier[cudaMemcpyKind_kind] , identifier[stream] operator[SEP] operator[SEP] operator[SEP]
}
|
public long runFor(final long duration, final TimeUnit unit) {
final long deadline = System.currentTimeMillis() + unit.toMillis(duration);
final ExecutorService es = Executors.newSingleThreadExecutor();
final Future<Long> future = es.submit(this);
try {
while (System.currentTimeMillis() < deadline && !future.isDone()) {
Thread.sleep(unit.toMillis(1));
}
} catch (final InterruptedException ignored) {
} finally {
stop();
}
final long result;
try {
result = future.get();
} catch (final InterruptedException | ExecutionException ex) {
throw new IllegalStateException(ex);
} finally {
es.shutdown();
}
return result;
}
|
class class_name[name] begin[{]
method[runFor, return_type[type[long]], modifier[public], parameter[duration, unit]] begin[{]
local_variable[type[long], deadline]
local_variable[type[ExecutorService], es]
local_variable[type[Future], future]
TryStatement(block=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=toMillis, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[], type_arguments=None)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=deadline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=MethodInvocation(arguments=[], member=isDone, postfix_operators=[], prefix_operators=['!'], qualifier=future, selectors=[], type_arguments=None), operator=&&), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignored, types=['InterruptedException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=stop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
local_variable[type[long], result]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['InterruptedException', 'ExecutionException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdown, postfix_operators=[], prefix_operators=[], qualifier=es, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[long] identifier[runFor] operator[SEP] Keyword[final] Keyword[long] identifier[duration] , Keyword[final] identifier[TimeUnit] identifier[unit] operator[SEP] {
Keyword[final] Keyword[long] identifier[deadline] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[+] identifier[unit] operator[SEP] identifier[toMillis] operator[SEP] identifier[duration] operator[SEP] operator[SEP] Keyword[final] identifier[ExecutorService] identifier[es] operator[=] identifier[Executors] operator[SEP] identifier[newSingleThreadExecutor] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Future] operator[<] identifier[Long] operator[>] identifier[future] operator[=] identifier[es] operator[SEP] identifier[submit] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[try] {
Keyword[while] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[<] identifier[deadline] operator[&&] operator[!] identifier[future] operator[SEP] identifier[isDone] operator[SEP] operator[SEP] operator[SEP] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[unit] operator[SEP] identifier[toMillis] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[InterruptedException] identifier[ignored] operator[SEP] {
}
Keyword[finally] {
identifier[stop] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[long] identifier[result] operator[SEP] Keyword[try] {
identifier[result] operator[=] identifier[future] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[InterruptedException] operator[|] identifier[ExecutionException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[es] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public UpdateScalingPlanResult updateScalingPlan(UpdateScalingPlanRequest request) {
request = beforeClientExecution(request);
return executeUpdateScalingPlan(request);
}
|
class class_name[name] begin[{]
method[updateScalingPlan, return_type[type[UpdateScalingPlanResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeUpdateScalingPlan, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[UpdateScalingPlanResult] identifier[updateScalingPlan] operator[SEP] identifier[UpdateScalingPlanRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeUpdateScalingPlan] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public VpnSiteInner getByResourceGroup(String resourceGroupName, String vpnSiteName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnSiteName).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[getByResourceGroup, return_type[type[VpnSiteInner]], modifier[public], parameter[resourceGroupName, vpnSiteName]] begin[{]
return[call[.getByResourceGroupWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.vpnSiteName]]]]
end[}]
END[}]
|
Keyword[public] identifier[VpnSiteInner] identifier[getByResourceGroup] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[vpnSiteName] operator[SEP] {
Keyword[return] identifier[getByResourceGroupWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[vpnSiteName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean cs_print(Dcs A, boolean brief) {
int p, j, m, n, nzmax, nz, Ap[], Ai[];
double Ax[];
if (A == null) {
System.out.print("(null)\n");
return (false);
}
m = A.m;
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
nzmax = A.nzmax;
nz = A.nz;
System.out.print(String.format("CSparseJ Version %d.%d.%d, %s. %s\n", Dcs_common.CS_VER, Dcs_common.CS_SUBVER,
Dcs_common.CS_SUBSUB, Dcs_common.CS_DATE, Dcs_common.CS_COPYRIGHT));
if (nz < 0) {
System.out.print(String.format("%d-by-%d, nzmax: %d nnz: %d, 1-norm: %g\n", m, n, nzmax, Ap[n], Dcs_norm
.cs_norm(A)));
for (j = 0; j < n; j++) {
System.out.print(String.format(" col %d : locations %d to %d\n", j, Ap[j], Ap[j + 1] - 1));
for (p = Ap[j]; p < Ap[j + 1]; p++) {
System.out.print(String.format(" %d : %g\n", Ai[p], Ax != null ? Ax[p] : 1));
if (brief && p > 20) {
System.out.print(" ...\n");
return (true);
}
}
}
} else {
System.out.print(String.format("triplet: %d-by-%d, nzmax: %d nnz: %d\n", m, n, nzmax, nz));
for (p = 0; p < nz; p++) {
System.out.print(String.format(" %d %d : %g\n", Ai[p], Ap[p], Ax != null ? Ax[p] : 1));
if (brief && p > 20) {
System.out.print(" ...\n");
return (true);
}
}
}
return (true);
}
|
class class_name[name] begin[{]
method[cs_print, return_type[type[boolean]], modifier[public static], parameter[A, brief]] begin[{]
local_variable[type[int], p]
local_variable[type[double], Ax]
if[binary_operation[member[.A], ==, literal[null]]] begin[{]
call[System.out.print, parameter[literal["(null)\n"]]]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.m], member[A.m]]
assign[member[.n], member[A.n]]
assign[member[.Ap], member[A.p]]
assign[member[.Ai], member[A.i]]
assign[member[.Ax], member[A.x]]
assign[member[.nzmax], member[A.nzmax]]
assign[member[.nz], member[A.nz]]
call[System.out.print, parameter[call[String.format, parameter[literal["CSparseJ Version %d.%d.%d, %s. %s\n"], member[Dcs_common.CS_VER], member[Dcs_common.CS_SUBVER], member[Dcs_common.CS_SUBSUB], member[Dcs_common.CS_DATE], member[Dcs_common.CS_COPYRIGHT]]]]]
if[binary_operation[member[.nz], <, literal[0]]] begin[{]
call[System.out.print, parameter[call[String.format, parameter[literal["%d-by-%d, nzmax: %d nnz: %d, 1-norm: %g\n"], member[.m], member[.n], member[.nzmax], member[.Ap], call[Dcs_norm.cs_norm, parameter[member[.A]]]]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" col %d : locations %d to %d\n"), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=Ap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), BinaryOperation(operandl=MemberReference(member=Ap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" %d : %g\n"), MemberReference(member=Ai, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=Ax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=MemberReference(member=Ax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=brief, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ...\n")], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=Ap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=<), init=[Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=Ap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))], update=[MemberReference(member=p, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
call[System.out.print, parameter[call[String.format, parameter[literal["triplet: %d-by-%d, nzmax: %d nnz: %d\n"], member[.m], member[.n], member[.nzmax], member[.nz]]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" %d %d : %g\n"), MemberReference(member=Ai, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=Ap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=Ax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=MemberReference(member=Ax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=brief, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ...\n")], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=p, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[cs_print] operator[SEP] identifier[Dcs] identifier[A] , Keyword[boolean] identifier[brief] operator[SEP] {
Keyword[int] identifier[p] , identifier[j] , identifier[m] , identifier[n] , identifier[nzmax] , identifier[nz] , identifier[Ap] operator[SEP] operator[SEP] , identifier[Ai] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[Ax] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[A] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[m] operator[=] identifier[A] operator[SEP] identifier[m] operator[SEP] identifier[n] operator[=] identifier[A] operator[SEP] identifier[n] operator[SEP] identifier[Ap] operator[=] identifier[A] operator[SEP] identifier[p] operator[SEP] identifier[Ai] operator[=] identifier[A] operator[SEP] identifier[i] operator[SEP] identifier[Ax] operator[=] identifier[A] operator[SEP] identifier[x] operator[SEP] identifier[nzmax] operator[=] identifier[A] operator[SEP] identifier[nzmax] operator[SEP] identifier[nz] operator[=] identifier[A] operator[SEP] identifier[nz] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[Dcs_common] operator[SEP] identifier[CS_VER] , identifier[Dcs_common] operator[SEP] identifier[CS_SUBVER] , identifier[Dcs_common] operator[SEP] identifier[CS_SUBSUB] , identifier[Dcs_common] operator[SEP] identifier[CS_DATE] , identifier[Dcs_common] operator[SEP] identifier[CS_COPYRIGHT] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nz] operator[<] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[m] , identifier[n] , identifier[nzmax] , identifier[Ap] operator[SEP] identifier[n] operator[SEP] , identifier[Dcs_norm] operator[SEP] identifier[cs_norm] operator[SEP] identifier[A] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[n] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[j] , identifier[Ap] operator[SEP] identifier[j] operator[SEP] , identifier[Ap] operator[SEP] identifier[j] operator[+] Other[1] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[p] operator[=] identifier[Ap] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[p] operator[<] identifier[Ap] operator[SEP] identifier[j] operator[+] Other[1] operator[SEP] operator[SEP] identifier[p] operator[++] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[Ai] operator[SEP] identifier[p] operator[SEP] , identifier[Ax] operator[!=] Other[null] operator[?] identifier[Ax] operator[SEP] identifier[p] operator[SEP] operator[:] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[brief] operator[&&] identifier[p] operator[>] Other[20] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[m] , identifier[n] , identifier[nzmax] , identifier[nz] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[p] operator[=] Other[0] operator[SEP] identifier[p] operator[<] identifier[nz] operator[SEP] identifier[p] operator[++] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[Ai] operator[SEP] identifier[p] operator[SEP] , identifier[Ap] operator[SEP] identifier[p] operator[SEP] , identifier[Ax] operator[!=] Other[null] operator[?] identifier[Ax] operator[SEP] identifier[p] operator[SEP] operator[:] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[brief] operator[&&] identifier[p] operator[>] Other[20] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public static String getDefaultValueForType( JType type ) {
JPrimitiveType primitiveType = type.isPrimitive();
if ( null != primitiveType ) {
return primitiveType.getUninitializedFieldExpression();
}
return "null";
}
|
class class_name[name] begin[{]
method[getDefaultValueForType, return_type[type[String]], modifier[public static], parameter[type]] begin[{]
local_variable[type[JPrimitiveType], primitiveType]
if[binary_operation[literal[null], !=, member[.primitiveType]]] begin[{]
return[call[primitiveType.getUninitializedFieldExpression, parameter[]]]
else begin[{]
None
end[}]
return[literal["null"]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getDefaultValueForType] operator[SEP] identifier[JType] identifier[type] operator[SEP] {
identifier[JPrimitiveType] identifier[primitiveType] operator[=] identifier[type] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[primitiveType] operator[SEP] {
Keyword[return] identifier[primitiveType] operator[SEP] identifier[getUninitializedFieldExpression] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
private static char encodeChar(char c, int offset, boolean isDecodeNumber) {
if (isDecodeNumber) {
if (c >= CHAR0 && c <= CHAR9) {
c -= CHAR0;
c = (char) ((c + offset) % 10);
c += CHAR0;
}
}
// A == 65, Z == 90
if (c >= ACHAR && c <= ZCHAR) {
c -= ACHAR;
c = (char) ((c + offset) % 26);
c += ACHAR;
}
// a == 97, z == 122.
else if (c >= aCHAR && c <= zCHAR) {
c -= aCHAR;
c = (char) ((c + offset) % 26);
c += aCHAR;
}
return c;
}
|
class class_name[name] begin[{]
method[encodeChar, return_type[type[char]], modifier[private static], parameter[c, offset, isDecodeNumber]] begin[{]
if[member[.isDecodeNumber]] begin[{]
if[binary_operation[binary_operation[member[.c], >=, member[.CHAR0]], &&, binary_operation[member[.c], <=, member[.CHAR9]]]] begin[{]
assign[member[.c], member[.CHAR0]]
assign[member[.c], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=%), type=BasicType(dimensions=[], name=char))]
assign[member[.c], member[.CHAR0]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.c], >=, member[.ACHAR]], &&, binary_operation[member[.c], <=, member[.ZCHAR]]]] begin[{]
assign[member[.c], member[.ACHAR]]
assign[member[.c], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=26), operator=%), type=BasicType(dimensions=[], name=char))]
assign[member[.c], member[.ACHAR]]
else begin[{]
if[binary_operation[binary_operation[member[.c], >=, member[.aCHAR]], &&, binary_operation[member[.c], <=, member[.zCHAR]]]] begin[{]
assign[member[.c], member[.aCHAR]]
assign[member[.c], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=26), operator=%), type=BasicType(dimensions=[], name=char))]
assign[member[.c], member[.aCHAR]]
else begin[{]
None
end[}]
end[}]
return[member[.c]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[char] identifier[encodeChar] operator[SEP] Keyword[char] identifier[c] , Keyword[int] identifier[offset] , Keyword[boolean] identifier[isDecodeNumber] operator[SEP] {
Keyword[if] operator[SEP] identifier[isDecodeNumber] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[>=] identifier[CHAR0] operator[&&] identifier[c] operator[<=] identifier[CHAR9] operator[SEP] {
identifier[c] operator[-=] identifier[CHAR0] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[+] identifier[offset] operator[SEP] operator[%] Other[10] operator[SEP] operator[SEP] identifier[c] operator[+=] identifier[CHAR0] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[c] operator[>=] identifier[ACHAR] operator[&&] identifier[c] operator[<=] identifier[ZCHAR] operator[SEP] {
identifier[c] operator[-=] identifier[ACHAR] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[+] identifier[offset] operator[SEP] operator[%] Other[26] operator[SEP] operator[SEP] identifier[c] operator[+=] identifier[ACHAR] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] identifier[aCHAR] operator[&&] identifier[c] operator[<=] identifier[zCHAR] operator[SEP] {
identifier[c] operator[-=] identifier[aCHAR] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[+] identifier[offset] operator[SEP] operator[%] Other[26] operator[SEP] operator[SEP] identifier[c] operator[+=] identifier[aCHAR] operator[SEP]
}
Keyword[return] identifier[c] operator[SEP]
}
|
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (LOG_ATTACH_DETACH) {
Log.d(TAG, "onAttachedToWindow reattach =" + mDetached);
}
if (mDetached && (mRenderer != null)) {
int renderMode = RENDERMODE_CONTINUOUSLY;
if (mGLThread != null) {
renderMode = mGLThread.getRenderMode();
}
mGLThread = new GLThread(mThisWeakRef);
if (renderMode != RENDERMODE_CONTINUOUSLY) {
mGLThread.setRenderMode(renderMode);
}
mGLThread.start();
}
mDetached = false;
}
|
class class_name[name] begin[{]
method[onAttachedToWindow, return_type[void], modifier[protected], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=onAttachedToWindow, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[member[.LOG_ATTACH_DETACH]] begin[{]
call[Log.d, parameter[member[.TAG], binary_operation[literal["onAttachedToWindow reattach ="], +, member[.mDetached]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.mDetached], &&, binary_operation[member[.mRenderer], !=, literal[null]]]] begin[{]
local_variable[type[int], renderMode]
if[binary_operation[member[.mGLThread], !=, literal[null]]] begin[{]
assign[member[.renderMode], call[mGLThread.getRenderMode, parameter[]]]
else begin[{]
None
end[}]
assign[member[.mGLThread], ClassCreator(arguments=[MemberReference(member=mThisWeakRef, 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=GLThread, sub_type=None))]
if[binary_operation[member[.renderMode], !=, member[.RENDERMODE_CONTINUOUSLY]]] begin[{]
call[mGLThread.setRenderMode, parameter[member[.renderMode]]]
else begin[{]
None
end[}]
call[mGLThread.start, parameter[]]
else begin[{]
None
end[}]
assign[member[.mDetached], literal[false]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[onAttachedToWindow] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[onAttachedToWindow] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG_ATTACH_DETACH] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[mDetached] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mDetached] operator[&&] operator[SEP] identifier[mRenderer] operator[!=] Other[null] operator[SEP] operator[SEP] {
Keyword[int] identifier[renderMode] operator[=] identifier[RENDERMODE_CONTINUOUSLY] operator[SEP] Keyword[if] operator[SEP] identifier[mGLThread] operator[!=] Other[null] operator[SEP] {
identifier[renderMode] operator[=] identifier[mGLThread] operator[SEP] identifier[getRenderMode] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mGLThread] operator[=] Keyword[new] identifier[GLThread] operator[SEP] identifier[mThisWeakRef] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[renderMode] operator[!=] identifier[RENDERMODE_CONTINUOUSLY] operator[SEP] {
identifier[mGLThread] operator[SEP] identifier[setRenderMode] operator[SEP] identifier[renderMode] operator[SEP] operator[SEP]
}
identifier[mGLThread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mDetached] operator[=] literal[boolean] operator[SEP]
}
|
final void appendSnippet(StringBuilder builder,
Token from,
Token to,
Token offending)
{
if (!areTokensValid(from, to, offending))
return;
String[] lines = query.split("\n");
boolean includeQueryStart = (from.getLine() == 1) && (from.getCharPositionInLine() == 0);
boolean includeQueryEnd = (to.getLine() == lines.length)
&& (getLastCharPositionInLine(to) == lines[lines.length - 1].length());
builder.append(" (");
if (!includeQueryStart)
builder.append("...");
lines[lineIndex(to)] = lines[lineIndex(to)].substring(0, getLastCharPositionInLine(to));
lines[lineIndex(offending)] = highlightToken(lines[lineIndex(offending)], offending);
lines[lineIndex(from)] = lines[lineIndex(from)].substring(from.getCharPositionInLine());
for (int i = lineIndex(from), m = lineIndex(to); i <= m; i++)
builder.append(lines[i]);
if (!includeQueryEnd)
builder.append("...");
builder.append(")");
}
|
class class_name[name] begin[{]
method[appendSnippet, return_type[void], modifier[final], parameter[builder, from, to, offending]] begin[{]
if[call[.areTokensValid, parameter[member[.from], member[.to], member[.offending]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], lines]
local_variable[type[boolean], includeQueryStart]
local_variable[type[boolean], includeQueryEnd]
call[builder.append, parameter[literal[" ("]]]
if[member[.includeQueryStart]] begin[{]
call[builder.append, parameter[literal["..."]]]
else begin[{]
None
end[}]
assign[member[.lines], member[.lines]]
assign[member[.lines], call[.highlightToken, parameter[member[.lines], member[.offending]]]]
assign[member[.lines], member[.lines]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lines, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lineIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lineIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[member[.includeQueryEnd]] begin[{]
call[builder.append, parameter[literal["..."]]]
else begin[{]
None
end[}]
call[builder.append, parameter[literal[")"]]]
end[}]
END[}]
|
Keyword[final] Keyword[void] identifier[appendSnippet] operator[SEP] identifier[StringBuilder] identifier[builder] , identifier[Token] identifier[from] , identifier[Token] identifier[to] , identifier[Token] identifier[offending] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[areTokensValid] operator[SEP] identifier[from] , identifier[to] , identifier[offending] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[lines] operator[=] identifier[query] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[includeQueryStart] operator[=] operator[SEP] identifier[from] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] operator[&&] operator[SEP] identifier[from] operator[SEP] identifier[getCharPositionInLine] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] Keyword[boolean] identifier[includeQueryEnd] operator[=] operator[SEP] identifier[to] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[==] identifier[lines] operator[SEP] identifier[length] operator[SEP] operator[&&] operator[SEP] identifier[getLastCharPositionInLine] operator[SEP] identifier[to] operator[SEP] operator[==] identifier[lines] operator[SEP] identifier[lines] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[includeQueryStart] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[to] operator[SEP] operator[SEP] operator[=] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[to] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[getLastCharPositionInLine] operator[SEP] identifier[to] operator[SEP] operator[SEP] operator[SEP] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[offending] operator[SEP] operator[SEP] operator[=] identifier[highlightToken] operator[SEP] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[offending] operator[SEP] operator[SEP] , identifier[offending] operator[SEP] operator[SEP] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[from] operator[SEP] operator[SEP] operator[=] identifier[lines] operator[SEP] identifier[lineIndex] operator[SEP] identifier[from] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[from] operator[SEP] identifier[getCharPositionInLine] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[lineIndex] operator[SEP] identifier[from] operator[SEP] , identifier[m] operator[=] identifier[lineIndex] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[i] operator[<=] identifier[m] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[lines] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[includeQueryEnd] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public ServiceFuture<EnvironmentSettingInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting, final ServiceCallback<EnvironmentSettingInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting), serviceCallback);
}
|
class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.labAccountName], member[.labName], member[.environmentSettingName], member[.environmentSetting]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[EnvironmentSettingInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[labAccountName] , identifier[String] identifier[labName] , identifier[String] identifier[environmentSettingName] , identifier[EnvironmentSettingInner] identifier[environmentSetting] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[EnvironmentSettingInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[labAccountName] , identifier[labName] , identifier[environmentSettingName] , identifier[environmentSetting] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({ "rawtypes", "unchecked" })
protected String getCommonSuperClass(final String type1, final String type2)
{
Class c, d;
try {
c = Class.forName(type1.replace('/', '.'));
d = Class.forName(type2.replace('/', '.'));
} catch (Exception e) {
throw new RuntimeException(e.toString());
}
if (c.isAssignableFrom(d)) {
return type1;
}
if (d.isAssignableFrom(c)) {
return type2;
}
if (c.isInterface() || d.isInterface()) {
return "java/lang/Object";
} else {
do {
c = c.getSuperclass();
} while (!c.isAssignableFrom(d));
return c.getName().replace('.', '/');
}
}
|
class class_name[name] begin[{]
method[getCommonSuperClass, return_type[type[String]], modifier[protected], parameter[type1, type2]] begin[{]
local_variable[type[Class], c]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[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=type1, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[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=type2, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[call[c.isAssignableFrom, parameter[member[.d]]]] begin[{]
return[member[.type1]]
else begin[{]
None
end[}]
if[call[d.isAssignableFrom, parameter[member[.c]]]] begin[{]
return[member[.type2]]
else begin[{]
None
end[}]
if[binary_operation[call[c.isInterface, parameter[]], ||, call[d.isInterface, parameter[]]]] begin[{]
return[literal["java/lang/Object"]]
else begin[{]
do[call[c.isAssignableFrom, parameter[member[.d]]]] begin[{]
assign[member[.c], call[c.getSuperclass, parameter[]]]
end[}]
return[call[c.getName, parameter[]]]
end[}]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[protected] identifier[String] identifier[getCommonSuperClass] operator[SEP] Keyword[final] identifier[String] identifier[type1] , Keyword[final] identifier[String] identifier[type2] operator[SEP] {
identifier[Class] identifier[c] , identifier[d] operator[SEP] Keyword[try] {
identifier[c] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[type1] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[d] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[type2] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[d] operator[SEP] operator[SEP] {
Keyword[return] identifier[type1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[d] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
Keyword[return] identifier[type2] operator[SEP]
}
Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[||] identifier[d] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[do] {
identifier[c] operator[=] identifier[c] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[!] identifier[c] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[c] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
}
|
public void marshall(CreateDataSourceFromS3Request createDataSourceFromS3Request, ProtocolMarshaller protocolMarshaller) {
if (createDataSourceFromS3Request == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDataSourceFromS3Request.getDataSourceId(), DATASOURCEID_BINDING);
protocolMarshaller.marshall(createDataSourceFromS3Request.getDataSourceName(), DATASOURCENAME_BINDING);
protocolMarshaller.marshall(createDataSourceFromS3Request.getDataSpec(), DATASPEC_BINDING);
protocolMarshaller.marshall(createDataSourceFromS3Request.getComputeStatistics(), COMPUTESTATISTICS_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[createDataSourceFromS3Request, protocolMarshaller]] begin[{]
if[binary_operation[member[.createDataSourceFromS3Request], ==, 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=getDataSourceId, postfix_operators=[], prefix_operators=[], qualifier=createDataSourceFromS3Request, selectors=[], type_arguments=None), MemberReference(member=DATASOURCEID_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=getDataSourceName, postfix_operators=[], prefix_operators=[], qualifier=createDataSourceFromS3Request, selectors=[], type_arguments=None), MemberReference(member=DATASOURCENAME_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=getDataSpec, postfix_operators=[], prefix_operators=[], qualifier=createDataSourceFromS3Request, selectors=[], type_arguments=None), MemberReference(member=DATASPEC_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=getComputeStatistics, postfix_operators=[], prefix_operators=[], qualifier=createDataSourceFromS3Request, selectors=[], type_arguments=None), MemberReference(member=COMPUTESTATISTICS_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[CreateDataSourceFromS3Request] identifier[createDataSourceFromS3Request] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createDataSourceFromS3Request] 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[createDataSourceFromS3Request] operator[SEP] identifier[getDataSourceId] operator[SEP] operator[SEP] , identifier[DATASOURCEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createDataSourceFromS3Request] operator[SEP] identifier[getDataSourceName] operator[SEP] operator[SEP] , identifier[DATASOURCENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createDataSourceFromS3Request] operator[SEP] identifier[getDataSpec] operator[SEP] operator[SEP] , identifier[DATASPEC_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createDataSourceFromS3Request] operator[SEP] identifier[getComputeStatistics] operator[SEP] operator[SEP] , identifier[COMPUTESTATISTICS_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 List<JAXBElement<Object>> get_GenericApplicationPropertyOfIntBridgeInstallation() {
if (_GenericApplicationPropertyOfIntBridgeInstallation == null) {
_GenericApplicationPropertyOfIntBridgeInstallation = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfIntBridgeInstallation;
}
|
class class_name[name] begin[{]
method[get_GenericApplicationPropertyOfIntBridgeInstallation, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[._GenericApplicationPropertyOfIntBridgeInstallation], ==, literal[null]]] begin[{]
assign[member[._GenericApplicationPropertyOfIntBridgeInstallation], 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=JAXBElement, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
return[THIS[member[None._GenericApplicationPropertyOfIntBridgeInstallation]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[JAXBElement] operator[<] identifier[Object] operator[>] operator[>] identifier[get_GenericApplicationPropertyOfIntBridgeInstallation] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_GenericApplicationPropertyOfIntBridgeInstallation] operator[==] Other[null] operator[SEP] {
identifier[_GenericApplicationPropertyOfIntBridgeInstallation] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[JAXBElement] operator[<] identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[_GenericApplicationPropertyOfIntBridgeInstallation] operator[SEP]
}
|
@Override
public EClass getIfcFurnishingElement() {
if (ifcFurnishingElementEClass == null) {
ifcFurnishingElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(296);
}
return ifcFurnishingElementEClass;
}
|
class class_name[name] begin[{]
method[getIfcFurnishingElement, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcFurnishingElementEClass], ==, literal[null]]] begin[{]
assign[member[.ifcFurnishingElementEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, 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=296)], 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[.ifcFurnishingElementEClass]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcFurnishingElement] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcFurnishingElementEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcFurnishingElementEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[296] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcFurnishingElementEClass] operator[SEP]
}
|
List getOrderby()
{
List result = _getOrderby();
Iterator iter = getCriteria().iterator();
Object crit;
while (iter.hasNext())
{
crit = iter.next();
if (crit instanceof Criteria)
{
result.addAll(((Criteria) crit).getOrderby());
}
}
return result;
}
|
class class_name[name] begin[{]
method[getOrderby, return_type[type[List]], modifier[default], parameter[]] begin[{]
local_variable[type[List], result]
local_variable[type[Iterator], iter]
local_variable[type[Object], crit]
while[call[iter.hasNext, parameter[]]] begin[{]
assign[member[.crit], call[iter.next, parameter[]]]
if[binary_operation[member[.crit], instanceof, type[Criteria]]] begin[{]
call[result.addAll, parameter[Cast(expression=MemberReference(member=crit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Criteria, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
return[member[.result]]
end[}]
END[}]
|
identifier[List] identifier[getOrderby] operator[SEP] operator[SEP] {
identifier[List] identifier[result] operator[=] identifier[_getOrderby] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] identifier[iter] operator[=] identifier[getCriteria] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[crit] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[crit] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[crit] Keyword[instanceof] identifier[Criteria] operator[SEP] {
identifier[result] operator[SEP] identifier[addAll] operator[SEP] operator[SEP] operator[SEP] identifier[Criteria] operator[SEP] identifier[crit] operator[SEP] operator[SEP] identifier[getOrderby] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public SSLConfig keystoreType(String keystoreType) {
return new SSLConfig(pathToKeyStore, pathToTrustStore, keyStorePassword, trustStorePassword, keystoreType, trustStoreType, port, keyStore, trustStore, x509HostnameVerifier, sslSocketFactory, true);
}
|
class class_name[name] begin[{]
method[keystoreType, return_type[type[SSLConfig]], modifier[public], parameter[keystoreType]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=pathToKeyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathToTrustStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyStorePassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trustStorePassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keystoreType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trustStoreType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trustStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=x509HostnameVerifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sslSocketFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SSLConfig, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[SSLConfig] identifier[keystoreType] operator[SEP] identifier[String] identifier[keystoreType] operator[SEP] {
Keyword[return] Keyword[new] identifier[SSLConfig] operator[SEP] identifier[pathToKeyStore] , identifier[pathToTrustStore] , identifier[keyStorePassword] , identifier[trustStorePassword] , identifier[keystoreType] , identifier[trustStoreType] , identifier[port] , identifier[keyStore] , identifier[trustStore] , identifier[x509HostnameVerifier] , identifier[sslSocketFactory] , literal[boolean] operator[SEP] operator[SEP]
}
|
public ApiSuccessResponse unsubscribeToWorkbinsNotifications(UnsubscribeToWorkbinsNotificationsData unsubscribeToWorkbinsNotificationsData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = unsubscribeToWorkbinsNotificationsWithHttpInfo(unsubscribeToWorkbinsNotificationsData);
return resp.getData();
}
|
class class_name[name] begin[{]
method[unsubscribeToWorkbinsNotifications, return_type[type[ApiSuccessResponse]], modifier[public], parameter[unsubscribeToWorkbinsNotificationsData]] begin[{]
local_variable[type[ApiResponse], resp]
return[call[resp.getData, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[ApiSuccessResponse] identifier[unsubscribeToWorkbinsNotifications] operator[SEP] identifier[UnsubscribeToWorkbinsNotificationsData] identifier[unsubscribeToWorkbinsNotificationsData] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[ApiResponse] operator[<] identifier[ApiSuccessResponse] operator[>] identifier[resp] operator[=] identifier[unsubscribeToWorkbinsNotificationsWithHttpInfo] operator[SEP] identifier[unsubscribeToWorkbinsNotificationsData] operator[SEP] operator[SEP] Keyword[return] identifier[resp] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <B> Class<? extends Builder<B>> builderFor(B built) throws CacheConfigurationException {
BuiltBy builtBy = built.getClass().getAnnotation(BuiltBy.class);
if (builtBy == null) {
throw new CacheConfigurationException("Missing BuiltBy annotation for configuration bean " + built.getClass().getName());
}
return (Class<? extends Builder<B>>) builtBy.value();
}
|
class class_name[name] begin[{]
method[builderFor, return_type[type[Class]], modifier[public static], parameter[built]] begin[{]
local_variable[type[BuiltBy], builtBy]
if[binary_operation[member[.builtBy], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing BuiltBy annotation for configuration bean "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=built, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheConfigurationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[], member=value, postfix_operators=[], prefix_operators=[], qualifier=builtBy, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=B, sub_type=None))], dimensions=[], name=Builder, sub_type=None))], dimensions=[], name=Class, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[B] operator[>] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Builder] operator[<] identifier[B] operator[>] operator[>] identifier[builderFor] operator[SEP] identifier[B] identifier[built] operator[SEP] Keyword[throws] identifier[CacheConfigurationException] {
identifier[BuiltBy] identifier[builtBy] operator[=] identifier[built] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[BuiltBy] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[builtBy] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CacheConfigurationException] operator[SEP] literal[String] operator[+] identifier[built] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Builder] operator[<] identifier[B] operator[>] operator[>] operator[SEP] identifier[builtBy] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
private Fix addDeltaArgument(
MethodInvocationTree methodInvocationTree, VisitorState state, List<Type> argumentTypes) {
int insertionIndex = getDeltaInsertionIndex(methodInvocationTree, state);
String deltaArgument = getDeltaArgument(state, argumentTypes);
return SuggestedFix.replace(insertionIndex, insertionIndex, deltaArgument);
}
|
class class_name[name] begin[{]
method[addDeltaArgument, return_type[type[Fix]], modifier[private], parameter[methodInvocationTree, state, argumentTypes]] begin[{]
local_variable[type[int], insertionIndex]
local_variable[type[String], deltaArgument]
return[call[SuggestedFix.replace, parameter[member[.insertionIndex], member[.insertionIndex], member[.deltaArgument]]]]
end[}]
END[}]
|
Keyword[private] identifier[Fix] identifier[addDeltaArgument] operator[SEP] identifier[MethodInvocationTree] identifier[methodInvocationTree] , identifier[VisitorState] identifier[state] , identifier[List] operator[<] identifier[Type] operator[>] identifier[argumentTypes] operator[SEP] {
Keyword[int] identifier[insertionIndex] operator[=] identifier[getDeltaInsertionIndex] operator[SEP] identifier[methodInvocationTree] , identifier[state] operator[SEP] operator[SEP] identifier[String] identifier[deltaArgument] operator[=] identifier[getDeltaArgument] operator[SEP] identifier[state] , identifier[argumentTypes] operator[SEP] operator[SEP] Keyword[return] identifier[SuggestedFix] operator[SEP] identifier[replace] operator[SEP] identifier[insertionIndex] , identifier[insertionIndex] , identifier[deltaArgument] operator[SEP] operator[SEP]
}
|
public void setSmartHomeAppliances(java.util.Collection<SmartHomeAppliance> smartHomeAppliances) {
if (smartHomeAppliances == null) {
this.smartHomeAppliances = null;
return;
}
this.smartHomeAppliances = new java.util.ArrayList<SmartHomeAppliance>(smartHomeAppliances);
}
|
class class_name[name] begin[{]
method[setSmartHomeAppliances, return_type[void], modifier[public], parameter[smartHomeAppliances]] begin[{]
if[binary_operation[member[.smartHomeAppliances], ==, literal[null]]] begin[{]
assign[THIS[member[None.smartHomeAppliances]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.smartHomeAppliances]], ClassCreator(arguments=[MemberReference(member=smartHomeAppliances, 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=SmartHomeAppliance, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setSmartHomeAppliances] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[SmartHomeAppliance] operator[>] identifier[smartHomeAppliances] operator[SEP] {
Keyword[if] operator[SEP] identifier[smartHomeAppliances] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[smartHomeAppliances] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[smartHomeAppliances] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[SmartHomeAppliance] operator[>] operator[SEP] identifier[smartHomeAppliances] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) throws Exception {
if (args[0].equals("-readDoc")) {
Document doc = readDocumentFromFile(args[1]);
System.out.println(doc);
} else {
String s = IOUtils.slurpFile(args[0]);
Reader r = new StringReader(s);
String tag = readTag(r);
while (tag.length() > 0) {
readUntilTag(r);
tag = readTag(r);
if (tag.length() == 0) {
break;
}
System.out.println("got tag=" + new XMLTag(tag));
}
}
}
|
class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[member[.args]] begin[{]
local_variable[type[Document], doc]
call[System.out.println, parameter[member[.doc]]]
else begin[{]
local_variable[type[String], s]
local_variable[type[Reader], r]
local_variable[type[String], tag]
while[binary_operation[call[tag.length, parameter[]], >, literal[0]]] begin[{]
call[.readUntilTag, parameter[member[.r]]]
assign[member[.tag], call[.readTag, parameter[member[.r]]]]
if[binary_operation[call[tag.length, parameter[]], ==, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[System.out.println, parameter[binary_operation[literal["got tag="], +, ClassCreator(arguments=[MemberReference(member=tag, 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=XMLTag, sub_type=None))]]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Document] identifier[doc] operator[=] identifier[readDocumentFromFile] operator[SEP] identifier[args] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[doc] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[s] operator[=] identifier[IOUtils] operator[SEP] identifier[slurpFile] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[Reader] identifier[r] operator[=] Keyword[new] identifier[StringReader] operator[SEP] identifier[s] operator[SEP] operator[SEP] identifier[String] identifier[tag] operator[=] identifier[readTag] operator[SEP] identifier[r] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[tag] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[readUntilTag] operator[SEP] identifier[r] operator[SEP] operator[SEP] identifier[tag] operator[=] identifier[readTag] operator[SEP] identifier[r] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] Keyword[new] identifier[XMLTag] operator[SEP] identifier[tag] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected void onEditTitleTextBox(TextBox box) {
if (m_titleEditHandler != null) {
m_titleEditHandler.handleEdit(m_title, box);
return;
}
String text = box.getText();
box.removeFromParent();
m_title.setText(text);
m_title.setVisible(true);
}
|
class class_name[name] begin[{]
method[onEditTitleTextBox, return_type[void], modifier[protected], parameter[box]] begin[{]
if[binary_operation[member[.m_titleEditHandler], !=, literal[null]]] begin[{]
call[m_titleEditHandler.handleEdit, parameter[member[.m_title], member[.box]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], text]
call[box.removeFromParent, parameter[]]
call[m_title.setText, parameter[member[.text]]]
call[m_title.setVisible, parameter[literal[true]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[onEditTitleTextBox] operator[SEP] identifier[TextBox] identifier[box] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_titleEditHandler] operator[!=] Other[null] operator[SEP] {
identifier[m_titleEditHandler] operator[SEP] identifier[handleEdit] operator[SEP] identifier[m_title] , identifier[box] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[String] identifier[text] operator[=] identifier[box] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[box] operator[SEP] identifier[removeFromParent] operator[SEP] operator[SEP] operator[SEP] identifier[m_title] operator[SEP] identifier[setText] operator[SEP] identifier[text] operator[SEP] operator[SEP] identifier[m_title] operator[SEP] identifier[setVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public void release() throws CpoException {
try {
if (clob_ != null) {
clob_.freeTemporary();
clob_ = null;
}
} catch (Exception e) {
throw new CpoException("Error releasing Oracle Temporary Blob", e);
}
}
|
class class_name[name] begin[{]
method[release, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=clob_, 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=freeTemporary, postfix_operators=[], prefix_operators=[], qualifier=clob_, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=clob_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error releasing Oracle Temporary Blob"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CpoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[release] operator[SEP] operator[SEP] Keyword[throws] identifier[CpoException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[clob_] operator[!=] Other[null] operator[SEP] {
identifier[clob_] operator[SEP] identifier[freeTemporary] operator[SEP] operator[SEP] operator[SEP] identifier[clob_] operator[=] Other[null] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CpoException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void setThumbnail(Image image, int page) throws PdfException, DocumentException {
stamper.setThumbnail(image, page);
}
|
class class_name[name] begin[{]
method[setThumbnail, return_type[void], modifier[public], parameter[image, page]] begin[{]
call[stamper.setThumbnail, parameter[member[.image], member[.page]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setThumbnail] operator[SEP] identifier[Image] identifier[image] , Keyword[int] identifier[page] operator[SEP] Keyword[throws] identifier[PdfException] , identifier[DocumentException] {
identifier[stamper] operator[SEP] identifier[setThumbnail] operator[SEP] identifier[image] , identifier[page] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.