code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public synchronized void initialiseFromAPIToken(final String token)
{
final String responseStr = authService.getToken(UserManagerOAuthService.GRANT_TYPE_TOKEN_EXCHANGE,
null,
getOwnCallbackUri().toString(),
clientId,
clientSecret,
null,
null,
null,
token);
loadAuthResponse(responseStr);
} | class class_name[name] begin[{]
method[initialiseFromAPIToken, return_type[void], modifier[synchronized public], parameter[token]] begin[{]
local_variable[type[String], responseStr]
call[.loadAuthResponse, parameter[member[.responseStr]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[initialiseFromAPIToken] operator[SEP] Keyword[final] identifier[String] identifier[token] operator[SEP] {
Keyword[final] identifier[String] identifier[responseStr] operator[=] identifier[authService] operator[SEP] identifier[getToken] operator[SEP] identifier[UserManagerOAuthService] operator[SEP] identifier[GRANT_TYPE_TOKEN_EXCHANGE] , Other[null] , identifier[getOwnCallbackUri] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[clientId] , identifier[clientSecret] , Other[null] , Other[null] , Other[null] , identifier[token] operator[SEP] operator[SEP] identifier[loadAuthResponse] operator[SEP] identifier[responseStr] operator[SEP] operator[SEP]
}
|
@Override
public void copyObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
jcrSession.getWorkspace().copy(source, destination);
touchLdpMembershipResource(getJcrNode(find(session, destination)));
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | class class_name[name] begin[{]
method[copyObject, return_type[void], modifier[public], parameter[session, source, destination]] begin[{]
local_variable[type[Session], jcrSession]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getWorkspace, postfix_operators=[], prefix_operators=[], qualifier=jcrSession, selectors=[MethodInvocation(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=find, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getJcrNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=touchLdpMembershipResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RepositoryRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RepositoryException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[copyObject] operator[SEP] Keyword[final] identifier[FedoraSession] identifier[session] , Keyword[final] identifier[String] identifier[source] , Keyword[final] identifier[String] identifier[destination] operator[SEP] {
Keyword[final] identifier[Session] identifier[jcrSession] operator[=] identifier[getJcrSession] operator[SEP] identifier[session] operator[SEP] operator[SEP] Keyword[try] {
identifier[jcrSession] operator[SEP] identifier[getWorkspace] operator[SEP] operator[SEP] operator[SEP] identifier[copy] operator[SEP] identifier[source] , identifier[destination] operator[SEP] operator[SEP] identifier[touchLdpMembershipResource] operator[SEP] identifier[getJcrNode] operator[SEP] identifier[find] operator[SEP] identifier[session] , identifier[destination] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[RepositoryException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
static Map<String, List<Method>> getBusinessMethodsByName(BeanMetaData bmd) {
Map<String, List<Method>> methodsByName = new HashMap<String, List<Method>>();
collectBusinessMethodsByName(methodsByName, bmd.methodInfos);
collectBusinessMethodsByName(methodsByName, bmd.localMethodInfos);
return methodsByName;
} | class class_name[name] begin[{]
method[getBusinessMethodsByName, return_type[type[Map]], modifier[static], parameter[bmd]] begin[{]
local_variable[type[Map], methodsByName]
call[.collectBusinessMethodsByName, parameter[member[.methodsByName], member[bmd.methodInfos]]]
call[.collectBusinessMethodsByName, parameter[member[.methodsByName], member[bmd.localMethodInfos]]]
return[member[.methodsByName]]
end[}]
END[}] | Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[Method] operator[>] operator[>] identifier[getBusinessMethodsByName] operator[SEP] identifier[BeanMetaData] identifier[bmd] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[Method] operator[>] operator[>] identifier[methodsByName] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[List] operator[<] identifier[Method] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[collectBusinessMethodsByName] operator[SEP] identifier[methodsByName] , identifier[bmd] operator[SEP] identifier[methodInfos] operator[SEP] operator[SEP] identifier[collectBusinessMethodsByName] operator[SEP] identifier[methodsByName] , identifier[bmd] operator[SEP] identifier[localMethodInfos] operator[SEP] operator[SEP] Keyword[return] identifier[methodsByName] operator[SEP]
}
|
public boolean isOrthonormal(double tol) {
Transformation2D r = new Transformation2D();
r.xx = xx * xx + xy * xy;
r.xy = xx * yx + xy * yy;
r.yx = yx * xx + yy * xy;
r.yy = yx * yx + yy * yy;
r.xd = 0;
r.yd = 0;
return r.isIdentity(tol);
} | class class_name[name] begin[{]
method[isOrthonormal, return_type[type[boolean]], modifier[public], parameter[tol]] begin[{]
local_variable[type[Transformation2D], r]
assign[member[r.xx], binary_operation[binary_operation[member[.xx], *, member[.xx]], +, binary_operation[member[.xy], *, member[.xy]]]]
assign[member[r.xy], binary_operation[binary_operation[member[.xx], *, member[.yx]], +, binary_operation[member[.xy], *, member[.yy]]]]
assign[member[r.yx], binary_operation[binary_operation[member[.yx], *, member[.xx]], +, binary_operation[member[.yy], *, member[.xy]]]]
assign[member[r.yy], binary_operation[binary_operation[member[.yx], *, member[.yx]], +, binary_operation[member[.yy], *, member[.yy]]]]
assign[member[r.xd], literal[0]]
assign[member[r.yd], literal[0]]
return[call[r.isIdentity, parameter[member[.tol]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isOrthonormal] operator[SEP] Keyword[double] identifier[tol] operator[SEP] {
identifier[Transformation2D] identifier[r] operator[=] Keyword[new] identifier[Transformation2D] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[xx] operator[=] identifier[xx] operator[*] identifier[xx] operator[+] identifier[xy] operator[*] identifier[xy] operator[SEP] identifier[r] operator[SEP] identifier[xy] operator[=] identifier[xx] operator[*] identifier[yx] operator[+] identifier[xy] operator[*] identifier[yy] operator[SEP] identifier[r] operator[SEP] identifier[yx] operator[=] identifier[yx] operator[*] identifier[xx] operator[+] identifier[yy] operator[*] identifier[xy] operator[SEP] identifier[r] operator[SEP] identifier[yy] operator[=] identifier[yx] operator[*] identifier[yx] operator[+] identifier[yy] operator[*] identifier[yy] operator[SEP] identifier[r] operator[SEP] identifier[xd] operator[=] Other[0] operator[SEP] identifier[r] operator[SEP] identifier[yd] operator[=] Other[0] operator[SEP] Keyword[return] identifier[r] operator[SEP] identifier[isIdentity] operator[SEP] identifier[tol] operator[SEP] operator[SEP]
}
|
private void collectEjb10Properties(String jndiName, Object injectionObject)
throws InjectionException
{
// For EJB 1.0 compatibility only
// According to spec remove the first element
// of the name (ejb10-properties)
final String prefix = "ejb10-properties/";
if (jndiName.startsWith(prefix)) // d710771.1
{
Properties envProperties = ivNameSpaceConfig.getEnvProperties();
if (envProperties != null)
{
envProperties.put(jndiName.substring(prefix.length()), injectionObject);
}
}
} | class class_name[name] begin[{]
method[collectEjb10Properties, return_type[void], modifier[private], parameter[jndiName, injectionObject]] begin[{]
local_variable[type[String], prefix]
if[call[jndiName.startsWith, parameter[member[.prefix]]]] begin[{]
local_variable[type[Properties], envProperties]
if[binary_operation[member[.envProperties], !=, literal[null]]] begin[{]
call[envProperties.put, parameter[call[jndiName.substring, parameter[call[prefix.length, parameter[]]]], member[.injectionObject]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[collectEjb10Properties] operator[SEP] identifier[String] identifier[jndiName] , identifier[Object] identifier[injectionObject] operator[SEP] Keyword[throws] identifier[InjectionException] {
Keyword[final] identifier[String] identifier[prefix] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[jndiName] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] {
identifier[Properties] identifier[envProperties] operator[=] identifier[ivNameSpaceConfig] operator[SEP] identifier[getEnvProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[envProperties] operator[!=] Other[null] operator[SEP] {
identifier[envProperties] operator[SEP] identifier[put] operator[SEP] identifier[jndiName] operator[SEP] identifier[substring] operator[SEP] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] , identifier[injectionObject] operator[SEP] operator[SEP]
}
}
}
|
public static AtlasElementPropertyConfig excludeProperties(final Set<String> vertexPropertyKeys,
final Set<String> edgePropertyKeys) {
return new AtlasElementPropertyConfig(vertexPropertyKeys, edgePropertyKeys, ElementPropertiesRule.EXCLUDE,
ElementPropertiesRule.EXCLUDE);
} | class class_name[name] begin[{]
method[excludeProperties, return_type[type[AtlasElementPropertyConfig]], modifier[public static], parameter[vertexPropertyKeys, edgePropertyKeys]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=vertexPropertyKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=edgePropertyKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EXCLUDE, postfix_operators=[], prefix_operators=[], qualifier=ElementPropertiesRule, selectors=[]), MemberReference(member=EXCLUDE, postfix_operators=[], prefix_operators=[], qualifier=ElementPropertiesRule, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtlasElementPropertyConfig, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AtlasElementPropertyConfig] identifier[excludeProperties] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[vertexPropertyKeys] , Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[edgePropertyKeys] operator[SEP] {
Keyword[return] Keyword[new] identifier[AtlasElementPropertyConfig] operator[SEP] identifier[vertexPropertyKeys] , identifier[edgePropertyKeys] , identifier[ElementPropertiesRule] operator[SEP] identifier[EXCLUDE] , identifier[ElementPropertiesRule] operator[SEP] identifier[EXCLUDE] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"rawtypes", "unchecked"})
public static String join(final Collection<?> col, final String separator, final ElementConverter elementConverter) {
if(col == null) {
return "";
}
final int size = col.size();
if(size == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
for(Iterator<?> itr = col.iterator(); itr.hasNext();) {
final Object element = itr.next();
String text = elementConverter.convertToString(element);
sb.append(text);
if(separator != null && itr.hasNext()) {
sb.append(separator);
}
}
return sb.toString();
} | class class_name[name] begin[{]
method[join, return_type[type[String]], modifier[public static], parameter[col, separator, elementConverter]] begin[{]
if[binary_operation[member[.col], ==, literal[null]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[int], size]
if[binary_operation[member[.size], ==, literal[0]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=itr, selectors=[], type_arguments=None), name=element)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertToString, postfix_operators=[], prefix_operators=[], qualifier=elementConverter, selectors=[], type_arguments=None), name=text)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=itr, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=itr, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=col, selectors=[], type_arguments=None), name=itr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[static] identifier[String] identifier[join] operator[SEP] Keyword[final] identifier[Collection] operator[<] operator[?] operator[>] identifier[col] , Keyword[final] identifier[String] identifier[separator] , Keyword[final] identifier[ElementConverter] identifier[elementConverter] operator[SEP] {
Keyword[if] operator[SEP] identifier[col] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[final] Keyword[int] identifier[size] operator[=] identifier[col] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] operator[?] operator[>] identifier[itr] operator[=] identifier[col] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Object] identifier[element] operator[=] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[text] operator[=] identifier[elementConverter] operator[SEP] identifier[convertToString] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[text] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[separator] operator[!=] Other[null] operator[&&] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[separator] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private static ImmutableSet<RelationID> attributeOccurrencesUnion(QuotedID id,
RAExpressionAttributes re1,
RAExpressionAttributes re2) {
ImmutableSet<RelationID> s1 = re1.attributeOccurrences.get(id);
ImmutableSet<RelationID> s2 = re2.attributeOccurrences.get(id);
if (s1 == null)
return s2;
if (s2 == null)
return s1;
return ImmutableSet.<RelationID>builder().addAll(s1).addAll(s2).build();
} | class class_name[name] begin[{]
method[attributeOccurrencesUnion, return_type[type[ImmutableSet]], modifier[private static], parameter[id, re1, re2]] begin[{]
local_variable[type[ImmutableSet], s1]
local_variable[type[ImmutableSet], s2]
if[binary_operation[member[.s1], ==, literal[null]]] begin[{]
return[member[.s2]]
else begin[{]
None
end[}]
if[binary_operation[member[.s2], ==, literal[null]]] begin[{]
return[member[.s1]]
else begin[{]
None
end[}]
return[call[.ImmutableSet, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[ImmutableSet] operator[<] identifier[RelationID] operator[>] identifier[attributeOccurrencesUnion] operator[SEP] identifier[QuotedID] identifier[id] , identifier[RAExpressionAttributes] identifier[re1] , identifier[RAExpressionAttributes] identifier[re2] operator[SEP] {
identifier[ImmutableSet] operator[<] identifier[RelationID] operator[>] identifier[s1] operator[=] identifier[re1] operator[SEP] identifier[attributeOccurrences] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[ImmutableSet] operator[<] identifier[RelationID] operator[>] identifier[s2] operator[=] identifier[re2] operator[SEP] identifier[attributeOccurrences] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s1] operator[==] Other[null] operator[SEP] Keyword[return] identifier[s2] operator[SEP] Keyword[if] operator[SEP] identifier[s2] operator[==] Other[null] operator[SEP] Keyword[return] identifier[s1] operator[SEP] Keyword[return] identifier[ImmutableSet] operator[SEP] operator[<] identifier[RelationID] operator[>] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[s1] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[s2] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setInstanceMonitorings(java.util.Collection<InstanceMonitoring> instanceMonitorings) {
if (instanceMonitorings == null) {
this.instanceMonitorings = null;
return;
}
this.instanceMonitorings = new com.amazonaws.internal.SdkInternalList<InstanceMonitoring>(instanceMonitorings);
} | class class_name[name] begin[{]
method[setInstanceMonitorings, return_type[void], modifier[public], parameter[instanceMonitorings]] begin[{]
if[binary_operation[member[.instanceMonitorings], ==, literal[null]]] begin[{]
assign[THIS[member[None.instanceMonitorings]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.instanceMonitorings]], ClassCreator(arguments=[MemberReference(member=instanceMonitorings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InstanceMonitoring, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setInstanceMonitorings] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[InstanceMonitoring] operator[>] identifier[instanceMonitorings] operator[SEP] {
Keyword[if] operator[SEP] identifier[instanceMonitorings] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[instanceMonitorings] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[instanceMonitorings] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[InstanceMonitoring] operator[>] operator[SEP] identifier[instanceMonitorings] operator[SEP] operator[SEP]
}
|
public void setSize(int width, int height) {
rootElement.getStyle().setWidth(width, Unit.PX);
rootElement.getStyle().setHeight(height, Unit.PX);
} | class class_name[name] begin[{]
method[setSize, return_type[void], modifier[public], parameter[width, height]] begin[{]
call[rootElement.getStyle, parameter[]]
call[rootElement.getStyle, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setSize] operator[SEP] Keyword[int] identifier[width] , Keyword[int] identifier[height] operator[SEP] {
identifier[rootElement] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setWidth] operator[SEP] identifier[width] , identifier[Unit] operator[SEP] identifier[PX] operator[SEP] operator[SEP] identifier[rootElement] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setHeight] operator[SEP] identifier[height] , identifier[Unit] operator[SEP] identifier[PX] operator[SEP] operator[SEP]
}
|
public ProxyQueueConversationGroup getProxyQueueConversationGroup()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getProxyQueueConversationGroup");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getProxyQueueConversationGroup", proxyGroup);
return proxyGroup;
} | class class_name[name] begin[{]
method[getProxyQueueConversationGroup, return_type[type[ProxyQueueConversationGroup]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["getProxyQueueConversationGroup"]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["getProxyQueueConversationGroup"], member[.proxyGroup]]]
else begin[{]
None
end[}]
return[member[.proxyGroup]]
end[}]
END[}] | Keyword[public] identifier[ProxyQueueConversationGroup] identifier[getProxyQueueConversationGroup] 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] 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] , identifier[proxyGroup] operator[SEP] operator[SEP] Keyword[return] identifier[proxyGroup] operator[SEP]
}
|
public static auditsyslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{
auditsyslogpolicy_tmglobal_binding obj = new auditsyslogpolicy_tmglobal_binding();
obj.set_name(name);
auditsyslogpolicy_tmglobal_binding response[] = (auditsyslogpolicy_tmglobal_binding[]) obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[auditsyslogpolicy_tmglobal_binding]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[auditsyslogpolicy_tmglobal_binding], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[auditsyslogpolicy_tmglobal_binding], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[auditsyslogpolicy_tmglobal_binding] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[auditsyslogpolicy_tmglobal_binding] identifier[obj] operator[=] Keyword[new] identifier[auditsyslogpolicy_tmglobal_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[auditsyslogpolicy_tmglobal_binding] identifier[response] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[auditsyslogpolicy_tmglobal_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
@RequestMapping(value = "{entityType}/{id}", method = RequestMethod.GET)
public Resources<Resource<Property<?>>> getProperties(@PathVariable ProjectEntityType entityType, @PathVariable ID id) {
ProjectEntity entity = getEntity(entityType, id);
List<Property<?>> properties = propertyService.getProperties(entity);
List<Resource<Property<?>>> resources = new ArrayList<>();
for (Property<?> property : properties) {
Resource<Property<?>> resource = Resource.of(
property,
uri(on(getClass()).getPropertyValue(entity.getProjectEntityType(), entity.getId(), property.getType().getClass().getName()))
);
// Update
resource = resource.with(
Link.UPDATE,
uri(on(getClass()).getPropertyEditionForm(entity.getProjectEntityType(), entity.getId(), property.getType().getClass().getName())));
// OK
resources.add(resource);
}
return Resources.of(
resources,
uri(on(getClass()).getProperties(entityType, id))
);
} | class class_name[name] begin[{]
method[getProperties, return_type[type[Resources]], modifier[public], parameter[entityType, id]] begin[{]
local_variable[type[ProjectEntity], entity]
local_variable[type[List], properties]
local_variable[type[List], resources]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=on, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProjectEntityType, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getPropertyValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=Resource, selectors=[], type_arguments=None), name=resource)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Property, sub_type=None))], dimensions=[], name=Resource, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=UPDATE, postfix_operators=[], prefix_operators=[], qualifier=Link, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=on, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProjectEntityType, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getPropertyEditionForm, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=with, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=resources, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=property)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Property, sub_type=None))), label=None)
return[call[Resources.of, parameter[member[.resources], call[.uri, parameter[call[.on, parameter[call[.getClass, parameter[]]]]]]]]]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[GET] operator[SEP] Keyword[public] identifier[Resources] operator[<] identifier[Resource] operator[<] identifier[Property] operator[<] operator[?] operator[>] operator[>] operator[>] identifier[getProperties] operator[SEP] annotation[@] identifier[PathVariable] identifier[ProjectEntityType] identifier[entityType] , annotation[@] identifier[PathVariable] identifier[ID] identifier[id] operator[SEP] {
identifier[ProjectEntity] identifier[entity] operator[=] identifier[getEntity] operator[SEP] identifier[entityType] , identifier[id] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Property] operator[<] operator[?] operator[>] operator[>] identifier[properties] operator[=] identifier[propertyService] operator[SEP] identifier[getProperties] operator[SEP] identifier[entity] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Resource] operator[<] identifier[Property] operator[<] operator[?] operator[>] operator[>] operator[>] identifier[resources] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Property] operator[<] operator[?] operator[>] identifier[property] operator[:] identifier[properties] operator[SEP] {
identifier[Resource] operator[<] identifier[Property] operator[<] operator[?] operator[>] operator[>] identifier[resource] operator[=] identifier[Resource] operator[SEP] identifier[of] operator[SEP] identifier[property] , identifier[uri] operator[SEP] identifier[on] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getPropertyValue] operator[SEP] identifier[entity] operator[SEP] identifier[getProjectEntityType] operator[SEP] operator[SEP] , identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[resource] operator[=] identifier[resource] operator[SEP] identifier[with] operator[SEP] identifier[Link] operator[SEP] identifier[UPDATE] , identifier[uri] operator[SEP] identifier[on] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getPropertyEditionForm] operator[SEP] identifier[entity] operator[SEP] identifier[getProjectEntityType] operator[SEP] operator[SEP] , identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[resources] operator[SEP] identifier[add] operator[SEP] identifier[resource] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Resources] operator[SEP] identifier[of] operator[SEP] identifier[resources] , identifier[uri] operator[SEP] identifier[on] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getProperties] operator[SEP] identifier[entityType] , identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static String getEnumName(XsdAttribute attribute) {
String enumPrefix = "Enum";
if (attribute.getType() != null){
String attributeName = getCleanName(attribute);
String attributeTypeName = firstToUpper(attribute.getType().replaceAll("[^a-zA-Z0-9]", ""));
if (attributeTypeName.startsWith(attributeName)){
return enumPrefix + attributeTypeName;
}
return enumPrefix + attributeName + attributeTypeName;
}
XsdAbstractElement elem = attribute;
while (elem != null){
if (elem instanceof XsdElement){
return enumPrefix + getCleanName(attribute) + firstToUpper(((XsdElement) elem).getName());
}
elem = elem.getParent();
}
return enumPrefix + getCleanName(attribute);
} | class class_name[name] begin[{]
method[getEnumName, return_type[type[String]], modifier[static], parameter[attribute]] begin[{]
local_variable[type[String], enumPrefix]
if[binary_operation[call[attribute.getType, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], attributeName]
local_variable[type[String], attributeTypeName]
if[call[attributeTypeName.startsWith, parameter[member[.attributeName]]]] begin[{]
return[binary_operation[member[.enumPrefix], +, member[.attributeTypeName]]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[member[.enumPrefix], +, member[.attributeName]], +, member[.attributeTypeName]]]
else begin[{]
None
end[}]
local_variable[type[XsdAbstractElement], elem]
while[binary_operation[member[.elem], !=, literal[null]]] begin[{]
if[binary_operation[member[.elem], instanceof, type[XsdElement]]] begin[{]
return[binary_operation[binary_operation[member[.enumPrefix], +, call[.getCleanName, parameter[member[.attribute]]]], +, call[.firstToUpper, parameter[Cast(expression=MemberReference(member=elem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=XsdElement, sub_type=None))]]]]
else begin[{]
None
end[}]
assign[member[.elem], call[elem.getParent, parameter[]]]
end[}]
return[binary_operation[member[.enumPrefix], +, call[.getCleanName, parameter[member[.attribute]]]]]
end[}]
END[}] | Keyword[static] identifier[String] identifier[getEnumName] operator[SEP] identifier[XsdAttribute] identifier[attribute] operator[SEP] {
identifier[String] identifier[enumPrefix] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[attribute] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[attributeName] operator[=] identifier[getCleanName] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] identifier[String] identifier[attributeTypeName] operator[=] identifier[firstToUpper] operator[SEP] identifier[attribute] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributeTypeName] operator[SEP] identifier[startsWith] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] {
Keyword[return] identifier[enumPrefix] operator[+] identifier[attributeTypeName] operator[SEP]
}
Keyword[return] identifier[enumPrefix] operator[+] identifier[attributeName] operator[+] identifier[attributeTypeName] operator[SEP]
}
identifier[XsdAbstractElement] identifier[elem] operator[=] identifier[attribute] operator[SEP] Keyword[while] operator[SEP] identifier[elem] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[elem] Keyword[instanceof] identifier[XsdElement] operator[SEP] {
Keyword[return] identifier[enumPrefix] operator[+] identifier[getCleanName] operator[SEP] identifier[attribute] operator[SEP] operator[+] identifier[firstToUpper] operator[SEP] operator[SEP] operator[SEP] identifier[XsdElement] operator[SEP] identifier[elem] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[elem] operator[=] identifier[elem] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[enumPrefix] operator[+] identifier[getCleanName] operator[SEP] identifier[attribute] operator[SEP] operator[SEP]
}
|
private static <T> T process(AnnotatedElement element, String annotationType, boolean traverseClassHierarchy,
Processor<T> processor) {
try {
return doProcess(element, annotationType, traverseClassHierarchy, processor,
new HashSet<AnnotatedElement>(), 0);
}
catch (Throwable ex) {
throw new IllegalStateException("Failed to introspect annotations: " + element, ex);
}
} | class class_name[name] begin[{]
method[process, return_type[type[T]], modifier[private static], parameter[element, annotationType, traverseClassHierarchy, processor]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=annotationType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=traverseClassHierarchy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AnnotatedElement, sub_type=None))], dimensions=None, name=HashSet, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=doProcess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to introspect annotations: "), operandr=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[process] operator[SEP] identifier[AnnotatedElement] identifier[element] , identifier[String] identifier[annotationType] , Keyword[boolean] identifier[traverseClassHierarchy] , identifier[Processor] operator[<] identifier[T] operator[>] identifier[processor] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[doProcess] operator[SEP] identifier[element] , identifier[annotationType] , identifier[traverseClassHierarchy] , identifier[processor] , Keyword[new] identifier[HashSet] operator[<] identifier[AnnotatedElement] operator[>] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[element] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
public static Object evaluate( IType type, Object lhsValue, Object rhsValue, IType lhsType, IType rhsType, boolean bAdditive, boolean bNullSafe, boolean bNumericType, Object ctx, int startLhs, int endLhs, int startRhs, int endRhs )
{
return evaluate( type, lhsValue, rhsValue, lhsType, rhsType, bAdditive, bNullSafe, bNumericType );
} | class class_name[name] begin[{]
method[evaluate, return_type[type[Object]], modifier[public static], parameter[type, lhsValue, rhsValue, lhsType, rhsType, bAdditive, bNullSafe, bNumericType, ctx, startLhs, endLhs, startRhs, endRhs]] begin[{]
return[call[.evaluate, parameter[member[.type], member[.lhsValue], member[.rhsValue], member[.lhsType], member[.rhsType], member[.bAdditive], member[.bNullSafe], member[.bNumericType]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[evaluate] operator[SEP] identifier[IType] identifier[type] , identifier[Object] identifier[lhsValue] , identifier[Object] identifier[rhsValue] , identifier[IType] identifier[lhsType] , identifier[IType] identifier[rhsType] , Keyword[boolean] identifier[bAdditive] , Keyword[boolean] identifier[bNullSafe] , Keyword[boolean] identifier[bNumericType] , identifier[Object] identifier[ctx] , Keyword[int] identifier[startLhs] , Keyword[int] identifier[endLhs] , Keyword[int] identifier[startRhs] , Keyword[int] identifier[endRhs] operator[SEP] {
Keyword[return] identifier[evaluate] operator[SEP] identifier[type] , identifier[lhsValue] , identifier[rhsValue] , identifier[lhsType] , identifier[rhsType] , identifier[bAdditive] , identifier[bNullSafe] , identifier[bNumericType] operator[SEP] operator[SEP]
}
|
@Override
public void open(String device, int baud, int dataBits, int parity, int stopBits, int flowControl)
throws IOException{
// open serial port
fileDescriptor = com.pi4j.jni.Serial.open(device, baud, dataBits, parity, stopBits, flowControl);
// read in initial buffered data (if any) into the receive buffer
int available = com.pi4j.jni.Serial.available(fileDescriptor);
if(available > 0) {
byte[] initial_data = com.pi4j.jni.Serial.read(fileDescriptor, available);
if (initial_data.length > 0) {
try {
// write data to the receive buffer
receiveBuffer.write(initial_data);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
// create a serial data listener event for data receive events from the serial device
SerialInterrupt.addListener(fileDescriptor, new SerialInterruptListener() {
@Override
public void onDataReceive(SerialInterruptEvent event) {
// ignore any event triggers that are missing data
if(event.getLength() <= 0) return;
try {
SerialDataEvent sde = null;
if(isBufferingDataReceived()) {
// stuff event data payload into the receive buffer
receiveBuffer.write(event.getData());
//System.out.println("BUFFER SIZE : " + receiveBuffer.capacity());
//System.out.println("BUFFER LEFT : " + receiveBuffer.remaining());
//System.out.println("BUFFER AVAIL: " + receiveBuffer.available());
// create the serial data event; since we are buffering data
// it will be located in the receive buffer
sde = new SerialDataEvent(SerialImpl.this);
}
else{
// create the serial data event; since we are NOT buffering data
// we will pass the specific data payload directly into the event
sde = new SerialDataEvent(SerialImpl.this, event.getData());
}
// add a new serial data event notification to the thread pool for *immediate* execution
// we notify the event listeners on a separate thread to prevent blocking the native monitoring thread
executor.execute(new SerialDataEventDispatchTaskImpl(sde, listeners));
}
catch (IOException e) {
e.printStackTrace();
}
}
});
// ensure file descriptor is valid
if (fileDescriptor == -1) {
throw new IOException("Cannot open serial port");
}
} | class class_name[name] begin[{]
method[open, return_type[void], modifier[public], parameter[device, baud, dataBits, parity, stopBits, flowControl]] begin[{]
assign[member[.fileDescriptor], call[com.pi4j.jni.Serial.open, parameter[member[.device], member[.baud], member[.dataBits], member[.parity], member[.stopBits], member[.flowControl]]]]
local_variable[type[int], available]
if[binary_operation[member[.available], >, literal[0]]] begin[{]
local_variable[type[byte], initial_data]
if[binary_operation[member[initial_data.length], >, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=initial_data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=receiveBuffer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[SerialInterrupt.addListener, parameter[member[.fileDescriptor], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<=), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=sde)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SerialDataEvent, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isBufferingDataReceived, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=SerialImpl, selectors=[]), MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SerialDataEvent, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=receiveBuffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=SerialImpl, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SerialDataEvent, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=sde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=listeners, 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=SerialDataEventDispatchTaskImpl, sub_type=None))], member=execute, postfix_operators=[], prefix_operators=[], qualifier=executor, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=onDataReceive, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=SerialInterruptEvent, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SerialInterruptListener, sub_type=None))]]
if[binary_operation[member[.fileDescriptor], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot open serial port")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[open] operator[SEP] identifier[String] identifier[device] , Keyword[int] identifier[baud] , Keyword[int] identifier[dataBits] , Keyword[int] identifier[parity] , Keyword[int] identifier[stopBits] , Keyword[int] identifier[flowControl] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[fileDescriptor] operator[=] identifier[com] operator[SEP] identifier[pi4j] operator[SEP] identifier[jni] operator[SEP] identifier[Serial] operator[SEP] identifier[open] operator[SEP] identifier[device] , identifier[baud] , identifier[dataBits] , identifier[parity] , identifier[stopBits] , identifier[flowControl] operator[SEP] operator[SEP] Keyword[int] identifier[available] operator[=] identifier[com] operator[SEP] identifier[pi4j] operator[SEP] identifier[jni] operator[SEP] identifier[Serial] operator[SEP] identifier[available] operator[SEP] identifier[fileDescriptor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[available] operator[>] Other[0] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[initial_data] operator[=] identifier[com] operator[SEP] identifier[pi4j] operator[SEP] identifier[jni] operator[SEP] identifier[Serial] operator[SEP] identifier[read] operator[SEP] identifier[fileDescriptor] , identifier[available] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[initial_data] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[try] {
identifier[receiveBuffer] operator[SEP] identifier[write] operator[SEP] identifier[initial_data] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[SerialInterrupt] operator[SEP] identifier[addListener] operator[SEP] identifier[fileDescriptor] , Keyword[new] identifier[SerialInterruptListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onDataReceive] operator[SEP] identifier[SerialInterruptEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] Keyword[return] operator[SEP] Keyword[try] {
identifier[SerialDataEvent] identifier[sde] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isBufferingDataReceived] operator[SEP] operator[SEP] operator[SEP] {
identifier[receiveBuffer] operator[SEP] identifier[write] operator[SEP] identifier[event] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sde] operator[=] Keyword[new] identifier[SerialDataEvent] operator[SEP] identifier[SerialImpl] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sde] operator[=] Keyword[new] identifier[SerialDataEvent] operator[SEP] identifier[SerialImpl] operator[SEP] Keyword[this] , identifier[event] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[executor] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[SerialDataEventDispatchTaskImpl] operator[SEP] identifier[sde] , identifier[listeners] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fileDescriptor] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public String getLongString()
{
String value = Wire.getLongString(needle, needle.position());
forward(value.length() + 4);
return value;
} | class class_name[name] begin[{]
method[getLongString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], value]
call[.forward, parameter[binary_operation[call[value.length, parameter[]], +, literal[4]]]]
return[member[.value]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getLongString] operator[SEP] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[Wire] operator[SEP] identifier[getLongString] operator[SEP] identifier[needle] , identifier[needle] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[forward] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[4] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public String next() {
if (maxLen <= 0 || minLen <= 0 || minLen > maxLen)
return null;
char[] buf = new char[R.random(minLen, maxLen)];
for (int i = 0; i < buf.length; i++)
buf[i] = CharGenerator.next();
return new String(buf);
} | class class_name[name] begin[{]
method[next, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.maxLen], <=, literal[0]], ||, binary_operation[member[.minLen], <=, literal[0]]], ||, binary_operation[member[.minLen], >, member[.maxLen]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[char], buf]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=CharGenerator, selectors=[], type_arguments=None)), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buf, 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[ClassCreator(arguments=[MemberReference(member=buf, 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[}] | Keyword[public] identifier[String] identifier[next] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[maxLen] operator[<=] Other[0] operator[||] identifier[minLen] operator[<=] Other[0] operator[||] identifier[minLen] operator[>] identifier[maxLen] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[buf] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[R] operator[SEP] identifier[random] operator[SEP] identifier[minLen] , identifier[maxLen] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[buf] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[buf] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[CharGenerator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[buf] operator[SEP] operator[SEP]
}
|
private void grow(int minCapacity) {
int oldCapacity = queue.length;
// Double size if small; else grow by 50%
int newCapacity = oldCapacity + ((oldCapacity < 64) ?
(oldCapacity + 2) :
(oldCapacity >> 1));
// overflow-conscious code
if (newCapacity - MAX_ARRAY_SIZE > 0)
newCapacity = hugeCapacity(minCapacity);
queue = Arrays.copyOf(queue, newCapacity);
} | class class_name[name] begin[{]
method[grow, return_type[void], modifier[private], parameter[minCapacity]] begin[{]
local_variable[type[int], oldCapacity]
local_variable[type[int], newCapacity]
if[binary_operation[binary_operation[member[.newCapacity], -, member[.MAX_ARRAY_SIZE]], >, literal[0]]] begin[{]
assign[member[.newCapacity], call[.hugeCapacity, parameter[member[.minCapacity]]]]
else begin[{]
None
end[}]
assign[member[.queue], call[Arrays.copyOf, parameter[member[.queue], member[.newCapacity]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[grow] operator[SEP] Keyword[int] identifier[minCapacity] operator[SEP] {
Keyword[int] identifier[oldCapacity] operator[=] identifier[queue] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[newCapacity] operator[=] identifier[oldCapacity] operator[+] operator[SEP] operator[SEP] identifier[oldCapacity] operator[<] Other[64] operator[SEP] operator[?] operator[SEP] identifier[oldCapacity] operator[+] Other[2] operator[SEP] operator[:] operator[SEP] identifier[oldCapacity] operator[>] operator[>] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newCapacity] operator[-] identifier[MAX_ARRAY_SIZE] operator[>] Other[0] operator[SEP] identifier[newCapacity] operator[=] identifier[hugeCapacity] operator[SEP] identifier[minCapacity] operator[SEP] operator[SEP] identifier[queue] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[queue] , identifier[newCapacity] operator[SEP] operator[SEP]
}
|
@Nullable
static <S, I, O> ReplacementResult<S, I, O> computeParentExtension(final MealyMachine<S, I, ?, O> hypothesis,
final Alphabet<I> inputs,
final ADTNode<S, I, O> node,
final Set<S> targetStates,
final ADSCalculator adsCalculator) {
final ADTNode<S, I, O> parentReset = node.getParent();
assert ADTUtil.isResetNode(parentReset) : "should not happen";
final Word<I> incomingTraceInput = ADTUtil.buildTraceForNode(parentReset).getFirst();
Map<S, S> currentToInitialMapping =
targetStates.stream().collect(Collectors.toMap(Function.identity(), Function.identity()));
for (final I i : incomingTraceInput) {
final Map<S, S> nextMapping = new HashMap<>();
for (final Map.Entry<S, S> entry : currentToInitialMapping.entrySet()) {
final S successor = hypothesis.getSuccessor(entry.getKey(), i);
// converging states
if (nextMapping.containsKey(successor)) {
return null;
}
nextMapping.put(successor, entry.getValue());
}
currentToInitialMapping = nextMapping;
}
final Optional<ADTNode<S, I, O>> potentialExtension =
adsCalculator.compute(hypothesis, inputs, currentToInitialMapping.keySet());
if (potentialExtension.isPresent()) {
final ADTNode<S, I, O> extension = potentialExtension.get();
for (final ADTNode<S, I, O> finalNode : ADTUtil.collectLeaves(extension)) {
finalNode.setHypothesisState(currentToInitialMapping.get(finalNode.getHypothesisState()));
}
return new ReplacementResult<>(parentReset, potentialExtension.get());
}
return null;
} | class class_name[name] begin[{]
method[computeParentExtension, return_type[type[ReplacementResult]], modifier[static], parameter[hypothesis, inputs, node, targetStates, adsCalculator]] begin[{]
local_variable[type[ADTNode], parentReset]
AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=parentReset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isResetNode, postfix_operators=[], prefix_operators=[], qualifier=ADTUtil, selectors=[], type_arguments=None), label=None, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="should not happen"))
local_variable[type[Word], incomingTraceInput]
local_variable[type[Map], currentToInitialMapping]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None)), name=nextMapping)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSuccessor, postfix_operators=[], prefix_operators=[], qualifier=hypothesis, selectors=[], type_arguments=None), name=successor)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=successor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=nextMapping, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=successor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=nextMapping, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=currentToInitialMapping, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentToInitialMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=nextMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=incomingTraceInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=I, sub_type=None))), label=None)
local_variable[type[Optional], potentialExtension]
if[call[potentialExtension.isPresent, parameter[]]] begin[{]
local_variable[type[ADTNode], extension]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHypothesisState, postfix_operators=[], prefix_operators=[], qualifier=finalNode, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=currentToInitialMapping, selectors=[], type_arguments=None)], member=setHypothesisState, postfix_operators=[], prefix_operators=[], qualifier=finalNode, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=collectLeaves, postfix_operators=[], prefix_operators=[], qualifier=ADTUtil, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=finalNode)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=I, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=O, sub_type=None))], dimensions=[], name=ADTNode, sub_type=None))), label=None)
return[ClassCreator(arguments=[MemberReference(member=parentReset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=potentialExtension, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ReplacementResult, sub_type=None))]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[static] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[ReplacementResult] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[computeParentExtension] operator[SEP] Keyword[final] identifier[MealyMachine] operator[<] identifier[S] , identifier[I] , operator[?] , identifier[O] operator[>] identifier[hypothesis] , Keyword[final] identifier[Alphabet] operator[<] identifier[I] operator[>] identifier[inputs] , Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[node] , Keyword[final] identifier[Set] operator[<] identifier[S] operator[>] identifier[targetStates] , Keyword[final] identifier[ADSCalculator] identifier[adsCalculator] operator[SEP] {
Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[parentReset] operator[=] identifier[node] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[ADTUtil] operator[SEP] identifier[isResetNode] operator[SEP] identifier[parentReset] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[I] operator[>] identifier[incomingTraceInput] operator[=] identifier[ADTUtil] operator[SEP] identifier[buildTraceForNode] operator[SEP] identifier[parentReset] operator[SEP] operator[SEP] identifier[getFirst] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[S] , identifier[S] operator[>] identifier[currentToInitialMapping] operator[=] identifier[targetStates] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toMap] operator[SEP] identifier[Function] operator[SEP] identifier[identity] operator[SEP] operator[SEP] , identifier[Function] operator[SEP] identifier[identity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[I] identifier[i] operator[:] identifier[incomingTraceInput] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[S] , identifier[S] operator[>] identifier[nextMapping] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[S] , identifier[S] operator[>] identifier[entry] operator[:] identifier[currentToInitialMapping] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[S] identifier[successor] operator[=] identifier[hypothesis] operator[SEP] identifier[getSuccessor] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nextMapping] operator[SEP] identifier[containsKey] operator[SEP] identifier[successor] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[nextMapping] operator[SEP] identifier[put] operator[SEP] identifier[successor] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[currentToInitialMapping] operator[=] identifier[nextMapping] operator[SEP]
}
Keyword[final] identifier[Optional] operator[<] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] operator[>] identifier[potentialExtension] operator[=] identifier[adsCalculator] operator[SEP] identifier[compute] operator[SEP] identifier[hypothesis] , identifier[inputs] , identifier[currentToInitialMapping] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[potentialExtension] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[extension] operator[=] identifier[potentialExtension] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[finalNode] operator[:] identifier[ADTUtil] operator[SEP] identifier[collectLeaves] operator[SEP] identifier[extension] operator[SEP] operator[SEP] {
identifier[finalNode] operator[SEP] identifier[setHypothesisState] operator[SEP] identifier[currentToInitialMapping] operator[SEP] identifier[get] operator[SEP] identifier[finalNode] operator[SEP] identifier[getHypothesisState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ReplacementResult] operator[<] operator[>] operator[SEP] identifier[parentReset] , identifier[potentialExtension] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public <T extends Normalizer> T restore(@NonNull String path) throws Exception {
try (InputStream in = new BufferedInputStream(new FileInputStream(path))) {
return restore(in);
}
} | class class_name[name] begin[{]
method[restore, return_type[type[T]], modifier[public], parameter[path]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=restore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=in, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None)))])
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Normalizer] operator[>] identifier[T] identifier[restore] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[in] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[restore] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
}
|
public void inited() {
if (preload) {
try {
int count = 0;
if (templateSuffix == null) {
templateSuffix = new String[]{".httl"};
}
for (String suffix : templateSuffix) {
List<String> list = loader.list(suffix);
if (list == null) {
continue;
}
count += list.size();
for (String name : list) {
try {
if (logger != null && logger.isDebugEnabled()) {
logger.debug("Preload the template: " + name);
}
getTemplate(name, getDefaultEncoding());
} catch (Exception e) {
if (logger != null && logger.isErrorEnabled()) {
logger.error(e.getMessage(), e);
}
}
}
}
if (logger != null && logger.isInfoEnabled()) {
logger.info("Preload " + count + " templates from directory " + (templateDirectory == null ? "/" : templateDirectory) + " with suffix " + Arrays.toString(templateSuffix));
}
} catch (Exception e) {
if (logger != null && logger.isErrorEnabled()) {
logger.error(e.getMessage(), e);
}
}
}
} | class class_name[name] begin[{]
method[inited, return_type[void], modifier[public], parameter[]] begin[{]
if[member[.preload]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=count)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=templateSuffix, 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=templateSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".httl")]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=list, postfix_operators=[], prefix_operators=[], qualifier=loader, selectors=[], type_arguments=None), name=list)], 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)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=list, 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=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None)), label=None), ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Preload the template: "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDefaultEncoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getTemplate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=templateSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=suffix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Preload "), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" templates from directory "), operator=+), operandr=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=templateDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=templateDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" with suffix "), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=templateSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[inited] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[preload] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[templateSuffix] operator[==] Other[null] operator[SEP] {
identifier[templateSuffix] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String]
} operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[suffix] operator[:] identifier[templateSuffix] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[list] operator[=] identifier[loader] operator[SEP] identifier[list] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[count] operator[+=] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[list] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[logger] operator[!=] Other[null] operator[&&] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP]
}
identifier[getTemplate] operator[SEP] identifier[name] , identifier[getDefaultEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[!=] Other[null] operator[&&] identifier[logger] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[logger] operator[!=] Other[null] operator[&&] identifier[logger] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[count] operator[+] literal[String] operator[+] operator[SEP] identifier[templateDirectory] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[templateDirectory] operator[SEP] operator[+] literal[String] operator[+] identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] identifier[templateSuffix] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[!=] Other[null] operator[&&] identifier[logger] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
|
public CharTrie rewrite(BiFunction<TrieNode, Map<Character, TrieNode>, TreeMap<Character, Long>> fn) {
CharTrie result = new CharTrieIndex();
rewriteSubtree(root(), result.root(), fn);
return result.recomputeCursorDetails();
} | class class_name[name] begin[{]
method[rewrite, return_type[type[CharTrie]], modifier[public], parameter[fn]] begin[{]
local_variable[type[CharTrie], result]
call[.rewriteSubtree, parameter[call[.root, parameter[]], call[result.root, parameter[]], member[.fn]]]
return[call[result.recomputeCursorDetails, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[CharTrie] identifier[rewrite] operator[SEP] identifier[BiFunction] operator[<] identifier[TrieNode] , identifier[Map] operator[<] identifier[Character] , identifier[TrieNode] operator[>] , identifier[TreeMap] operator[<] identifier[Character] , identifier[Long] operator[>] operator[>] identifier[fn] operator[SEP] {
identifier[CharTrie] identifier[result] operator[=] Keyword[new] identifier[CharTrieIndex] operator[SEP] operator[SEP] operator[SEP] identifier[rewriteSubtree] operator[SEP] identifier[root] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[root] operator[SEP] operator[SEP] , identifier[fn] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[recomputeCursorDetails] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setFixedCost(Parameter newFixedCost) {
if (newFixedCost != fixedCost) {
NotificationChain msgs = null;
if (fixedCost != null)
msgs = ((InternalEObject)fixedCost).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.COST_PARAMETERS__FIXED_COST, null, msgs);
if (newFixedCost != null)
msgs = ((InternalEObject)newFixedCost).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.COST_PARAMETERS__FIXED_COST, null, msgs);
msgs = basicSetFixedCost(newFixedCost, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BpsimPackage.COST_PARAMETERS__FIXED_COST, newFixedCost, newFixedCost));
} | class class_name[name] begin[{]
method[setFixedCost, return_type[void], modifier[public], parameter[newFixedCost]] begin[{]
if[binary_operation[member[.newFixedCost], !=, member[.fixedCost]]] begin[{]
local_variable[type[NotificationChain], msgs]
if[binary_operation[member[.fixedCost], !=, literal[null]]] begin[{]
assign[member[.msgs], Cast(expression=MemberReference(member=fixedCost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InternalEObject, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.newFixedCost], !=, literal[null]]] begin[{]
assign[member[.msgs], Cast(expression=MemberReference(member=newFixedCost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InternalEObject, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.msgs], call[.basicSetFixedCost, parameter[member[.newFixedCost], member[.msgs]]]]
if[binary_operation[member[.msgs], !=, literal[null]]] begin[{]
call[msgs.dispatch, parameter[]]
else begin[{]
None
end[}]
else begin[{]
if[call[.eNotificationRequired, parameter[]]] begin[{]
call[.eNotify, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=Notification, selectors=[]), MemberReference(member=COST_PARAMETERS__FIXED_COST, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[]), MemberReference(member=newFixedCost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newFixedCost, 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=ENotificationImpl, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setFixedCost] operator[SEP] identifier[Parameter] identifier[newFixedCost] operator[SEP] {
Keyword[if] operator[SEP] identifier[newFixedCost] operator[!=] identifier[fixedCost] operator[SEP] {
identifier[NotificationChain] identifier[msgs] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[fixedCost] operator[!=] Other[null] operator[SEP] identifier[msgs] operator[=] operator[SEP] operator[SEP] identifier[InternalEObject] operator[SEP] identifier[fixedCost] operator[SEP] operator[SEP] identifier[eInverseRemove] operator[SEP] Keyword[this] , identifier[EOPPOSITE_FEATURE_BASE] operator[-] identifier[BpsimPackage] operator[SEP] identifier[COST_PARAMETERS__FIXED_COST] , Other[null] , identifier[msgs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newFixedCost] operator[!=] Other[null] operator[SEP] identifier[msgs] operator[=] operator[SEP] operator[SEP] identifier[InternalEObject] operator[SEP] identifier[newFixedCost] operator[SEP] operator[SEP] identifier[eInverseAdd] operator[SEP] Keyword[this] , identifier[EOPPOSITE_FEATURE_BASE] operator[-] identifier[BpsimPackage] operator[SEP] identifier[COST_PARAMETERS__FIXED_COST] , Other[null] , identifier[msgs] operator[SEP] operator[SEP] identifier[msgs] operator[=] identifier[basicSetFixedCost] operator[SEP] identifier[newFixedCost] , identifier[msgs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msgs] operator[!=] Other[null] operator[SEP] identifier[msgs] operator[SEP] identifier[dispatch] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[eNotificationRequired] operator[SEP] operator[SEP] operator[SEP] identifier[eNotify] operator[SEP] Keyword[new] identifier[ENotificationImpl] operator[SEP] Keyword[this] , identifier[Notification] operator[SEP] identifier[SET] , identifier[BpsimPackage] operator[SEP] identifier[COST_PARAMETERS__FIXED_COST] , identifier[newFixedCost] , identifier[newFixedCost] operator[SEP] operator[SEP] operator[SEP]
}
|
public void putByteArray(byte[] b, int boff, int len) {
putInt(len);
putBytes(b, boff, len);
} | class class_name[name] begin[{]
method[putByteArray, return_type[void], modifier[public], parameter[b, boff, len]] begin[{]
call[.putInt, parameter[member[.len]]]
call[.putBytes, parameter[member[.b], member[.boff], member[.len]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[putByteArray] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] , Keyword[int] identifier[boff] , Keyword[int] identifier[len] operator[SEP] {
identifier[putInt] operator[SEP] identifier[len] operator[SEP] operator[SEP] identifier[putBytes] operator[SEP] identifier[b] , identifier[boff] , identifier[len] operator[SEP] operator[SEP]
}
|
protected void setCompactionAddress(int index, long value, long scn) throws Exception {
_addressArray.setCompactionAddress(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | class class_name[name] begin[{]
method[setCompactionAddress, return_type[void], modifier[protected], parameter[index, value, scn]] begin[{]
call[_addressArray.setCompactionAddress, parameter[member[.index], member[.value], member[.scn]]]
assign[member[._hwmSet], call[Math.max, parameter[member[._hwmSet], member[.scn]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[setCompactionAddress] operator[SEP] Keyword[int] identifier[index] , Keyword[long] identifier[value] , Keyword[long] identifier[scn] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[_addressArray] operator[SEP] identifier[setCompactionAddress] operator[SEP] identifier[index] , identifier[value] , identifier[scn] operator[SEP] operator[SEP] identifier[_hwmSet] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[_hwmSet] , identifier[scn] operator[SEP] operator[SEP]
}
|
public void setResult(Result result) throws IllegalArgumentException
{
if(null == result)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null");
m_result = result;
} | class class_name[name] begin[{]
method[setResult, return_type[void], modifier[public], parameter[result]] begin[{]
if[binary_operation[literal[null], ==, member[.result]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ER_RESULT_NULL, postfix_operators=[], prefix_operators=[], qualifier=XSLTErrorResources, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=createMessage, postfix_operators=[], prefix_operators=[], qualifier=XSLMessages, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.m_result], member[.result]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setResult] operator[SEP] identifier[Result] identifier[result] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[result] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[XSLMessages] operator[SEP] identifier[createMessage] operator[SEP] identifier[XSLTErrorResources] operator[SEP] identifier[ER_RESULT_NULL] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[m_result] operator[=] identifier[result] operator[SEP]
}
|
public static <T extends ItemInfo> Predicate<T> registrationScope(final Class<?> scope) {
return input -> scope.equals(input.getRegistrationScope());
} | class class_name[name] begin[{]
method[registrationScope, return_type[type[Predicate]], modifier[public static], parameter[scope]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRegistrationScope, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=scope, selectors=[], type_arguments=None), parameters=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[ItemInfo] operator[>] identifier[Predicate] operator[<] identifier[T] operator[>] identifier[registrationScope] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[scope] operator[SEP] {
Keyword[return] identifier[input] operator[->] identifier[scope] operator[SEP] identifier[equals] operator[SEP] identifier[input] operator[SEP] identifier[getRegistrationScope] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
void updatePair(ParameterPair p, double cost) {
costMatrix[p.formal().index()][p.actual().index()] = cost;
} | class class_name[name] begin[{]
method[updatePair, return_type[void], modifier[default], parameter[p, cost]] begin[{]
assign[member[.costMatrix], member[.cost]]
end[}]
END[}] | Keyword[void] identifier[updatePair] operator[SEP] identifier[ParameterPair] identifier[p] , Keyword[double] identifier[cost] operator[SEP] {
identifier[costMatrix] operator[SEP] identifier[p] operator[SEP] identifier[formal] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[SEP] identifier[actual] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] operator[=] identifier[cost] operator[SEP]
}
|
private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
_worker.stop();
startButton.setEnabled(true);
stopButton.setEnabled(false);
pauseButton.setEnabled(false);
pauseButton.setText("Pause");
openButton.setEnabled(true);
engineParamPanel.setEnabled(true);
} | class class_name[name] begin[{]
method[stopButtonActionPerformed, return_type[void], modifier[private], parameter[evt]] begin[{]
call[_worker.stop, parameter[]]
call[startButton.setEnabled, parameter[literal[true]]]
call[stopButton.setEnabled, parameter[literal[false]]]
call[pauseButton.setEnabled, parameter[literal[false]]]
call[pauseButton.setText, parameter[literal["Pause"]]]
call[openButton.setEnabled, parameter[literal[true]]]
call[engineParamPanel.setEnabled, parameter[literal[true]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[stopButtonActionPerformed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
identifier[_worker] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] identifier[startButton] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[stopButton] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[pauseButton] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[pauseButton] operator[SEP] identifier[setText] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[openButton] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[engineParamPanel] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) throws Exception {
final String configFile = args.length > 0 ? args[0] : null;
final String propertiesFile = args.length > 1 ? args[1] : null;
start(configFile, propertiesFile);
Thread.sleep(Long.MAX_VALUE);
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[String], configFile]
local_variable[type[String], propertiesFile]
call[.start, parameter[member[.configFile], member[.propertiesFile]]]
call[Thread.sleep, parameter[member[Long.MAX_VALUE]]]
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[final] identifier[String] identifier[configFile] operator[=] identifier[args] operator[SEP] identifier[length] operator[>] Other[0] operator[?] identifier[args] operator[SEP] Other[0] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[final] identifier[String] identifier[propertiesFile] operator[=] identifier[args] operator[SEP] identifier[length] operator[>] Other[1] operator[?] identifier[args] operator[SEP] Other[1] operator[SEP] operator[:] Other[null] operator[SEP] identifier[start] operator[SEP] identifier[configFile] , identifier[propertiesFile] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP]
}
|
public static void trustAllHosts () {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager () {
public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }
public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
}
};
// Install the all-trusting trust manager
try {
SSLContext sslContext = SSLContext.getInstance ("TLS");
sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
return true;
});
} catch (Exception exception) {
log.error (exception);
}
} | class class_name[name] begin[{]
method[trustAllHosts, return_type[void], modifier[public static], parameter[]] begin[{]
local_variable[type[TrustManager], trustAllCerts]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TLS")], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=SSLContext, selectors=[], type_arguments=None), name=sslContext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SSLContext, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=trustAllCerts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], 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=security, sub_type=ReferenceType(arguments=None, dimensions=None, name=SecureRandom, sub_type=None))))], member=init, postfix_operators=[], prefix_operators=[], qualifier=sslContext, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSocketFactory, postfix_operators=[], prefix_operators=[], qualifier=sslContext, selectors=[], type_arguments=None)], member=setDefaultSSLSocketFactory, postfix_operators=[], prefix_operators=[], qualifier=HttpsURLConnection, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[LambdaExpression(body=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], parameters=[FormalParameter(annotations=[], modifiers=set(), name=var1, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=var2, type=ReferenceType(arguments=None, dimensions=[], name=SSLSession, sub_type=None), varargs=False)])], member=setDefaultHostnameVerifier, postfix_operators=[], prefix_operators=[], qualifier=HttpsURLConnection, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[trustAllHosts] operator[SEP] operator[SEP] {
identifier[TrustManager] operator[SEP] operator[SEP] identifier[trustAllCerts] operator[=] Keyword[new] identifier[TrustManager] operator[SEP] operator[SEP] {
Keyword[new] identifier[X509TrustManager] operator[SEP] operator[SEP] {
Keyword[public] identifier[X509Certificate] operator[SEP] operator[SEP] identifier[getAcceptedIssuers] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[X509Certificate] operator[SEP] operator[SEP] {
} operator[SEP]
}
Keyword[public] Keyword[void] identifier[checkClientTrusted] operator[SEP] identifier[X509Certificate] operator[SEP] operator[SEP] identifier[chain] , identifier[String] identifier[authType] operator[SEP] Keyword[throws] identifier[CertificateException] {
}
Keyword[public] Keyword[void] identifier[checkServerTrusted] operator[SEP] identifier[X509Certificate] operator[SEP] operator[SEP] identifier[chain] , identifier[String] identifier[authType] operator[SEP] Keyword[throws] identifier[CertificateException] {
}
}
} operator[SEP] Keyword[try] {
identifier[SSLContext] identifier[sslContext] operator[=] identifier[SSLContext] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sslContext] operator[SEP] identifier[init] operator[SEP] Other[null] , identifier[trustAllCerts] , Keyword[new] identifier[java] operator[SEP] identifier[security] operator[SEP] identifier[SecureRandom] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[HttpsURLConnection] operator[SEP] identifier[setDefaultSSLSocketFactory] operator[SEP] identifier[sslContext] operator[SEP] identifier[getSocketFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[HttpsURLConnection] operator[SEP] identifier[setDefaultHostnameVerifier] operator[SEP] operator[SEP] identifier[String] identifier[var1] , identifier[SSLSession] identifier[var2] operator[SEP] operator[->] {
Keyword[return] literal[boolean] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[exception] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[exception] operator[SEP] operator[SEP]
}
}
|
public String format(String key, Object... arguments) {
return MessageFormat.format(resourceBundle.getString(key), arguments);
} | class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[public], parameter[key, arguments]] begin[{]
return[call[MessageFormat.format, parameter[call[resourceBundle.getString, parameter[member[.key]]], member[.arguments]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[format] operator[SEP] identifier[String] identifier[key] , identifier[Object] operator[...] identifier[arguments] operator[SEP] {
Keyword[return] identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[resourceBundle] operator[SEP] identifier[getString] operator[SEP] identifier[key] operator[SEP] , identifier[arguments] operator[SEP] operator[SEP]
}
|
private static boolean containsMethod(Method method, List<Method> methods) {
if(methods != null) {
for(Method aMethod : methods){
if(method.getName().equals(aMethod.getName())) {
return true;
}
}
}
return false;
} | class class_name[name] begin[{]
method[containsMethod, return_type[type[boolean]], modifier[private static], parameter[method, methods]] begin[{]
if[binary_operation[member[.methods], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=aMethod, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=aMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[containsMethod] operator[SEP] identifier[Method] identifier[method] , identifier[List] operator[<] identifier[Method] operator[>] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] identifier[methods] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Method] identifier[aMethod] operator[:] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[aMethod] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static TwoDimTable createScoringHistoryTableDR(LinkedHashMap<String, ArrayList> scoreTable, String tableName,
long startTime) {
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
ArrayList<String> otherTableEntries = new ArrayList<String>();
for (String fieldName:scoreTable.keySet()) {
if (fieldName.equals("Timestamp")) {
colHeaders.add("Timestamp"); colTypes.add("string"); colFormat.add("%s");
colHeaders.add("Duration"); colTypes.add("string"); colFormat.add("%s");
colHeaders.add("Iterations"); colTypes.add("long"); colFormat.add("%d");
} else {
otherTableEntries.add(fieldName); colHeaders.add(fieldName); colTypes.add("double"); colFormat.add("%.5f");
}
}
int rows = scoreTable.get("Timestamp").size(); // number of entries of training history
TwoDimTable table = new TwoDimTable(
tableName, null,
new String[rows],
colHeaders.toArray(new String[0]),
colTypes.toArray(new String[0]),
colFormat.toArray(new String[0]),
"");
assert (rows <= table.getRowDim());
for (int row = 0; row < rows; row++) {
int col = 0;
// take care of Timestamp, Duration, Iteration.
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
table.set(row, col++, fmt.print((long) scoreTable.get("Timestamp").get(row)));
table.set(row, col++, PrettyPrint.msecs((long) scoreTable.get("Timestamp").get(row) - startTime, true));
table.set(row, col++, row);
// take care of the extra field
for (int remaining_cols = 0; remaining_cols < otherTableEntries.size(); remaining_cols++) {
table.set(row, col++, (double) scoreTable.get(otherTableEntries.get(remaining_cols)).get(row));
}
}
return table;
} | class class_name[name] begin[{]
method[createScoringHistoryTableDR, return_type[type[TwoDimTable]], modifier[public static], parameter[scoreTable, tableName, startTime]] begin[{]
local_variable[type[List], colHeaders]
local_variable[type[List], colTypes]
local_variable[type[List], colFormat]
local_variable[type[ArrayList], otherTableEntries]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timestamp")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=fieldName, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=otherTableEntries, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=colHeaders, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="double")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%.5f")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colFormat, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timestamp")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colHeaders, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="string")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colFormat, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Duration")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colHeaders, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="string")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colFormat, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Iterations")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colHeaders, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="long")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d")], member=add, postfix_operators=[], prefix_operators=[], qualifier=colFormat, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=scoreTable, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[int], rows]
local_variable[type[TwoDimTable], table]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=rows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getRowDim, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), operator=<=), label=None, value=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=col)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="yyyy-MM-dd HH:mm:ss")], member=forPattern, postfix_operators=[], prefix_operators=[], qualifier=DateTimeFormat, selectors=[], type_arguments=None), name=fmt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateTimeFormatter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timestamp")], member=get, postfix_operators=[], prefix_operators=[], qualifier=scoreTable, selectors=[MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=BasicType(dimensions=[], name=long))], member=print, postfix_operators=[], prefix_operators=[], qualifier=fmt, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timestamp")], member=get, postfix_operators=[], prefix_operators=[], qualifier=scoreTable, selectors=[MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=BasicType(dimensions=[], name=long)), operandr=MemberReference(member=startTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=msecs, postfix_operators=[], prefix_operators=[], qualifier=PrettyPrint, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=remaining_cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=otherTableEntries, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=scoreTable, selectors=[MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=BasicType(dimensions=[], name=double))], member=set, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=remaining_cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=otherTableEntries, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=remaining_cols)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=remaining_cols, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), 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)
return[member[.table]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TwoDimTable] identifier[createScoringHistoryTableDR] operator[SEP] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[ArrayList] operator[>] identifier[scoreTable] , identifier[String] identifier[tableName] , Keyword[long] identifier[startTime] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[colHeaders] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[colTypes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[colFormat] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[otherTableEntries] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[fieldName] operator[:] identifier[scoreTable] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fieldName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[colHeaders] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colTypes] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colFormat] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colHeaders] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colTypes] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colFormat] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colHeaders] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colTypes] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colFormat] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[otherTableEntries] operator[SEP] identifier[add] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[colHeaders] operator[SEP] identifier[add] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[colTypes] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[colFormat] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[int] identifier[rows] operator[=] identifier[scoreTable] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[TwoDimTable] identifier[table] operator[=] Keyword[new] identifier[TwoDimTable] operator[SEP] identifier[tableName] , Other[null] , Keyword[new] identifier[String] operator[SEP] identifier[rows] operator[SEP] , identifier[colHeaders] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP] , identifier[colTypes] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP] , identifier[colFormat] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[rows] operator[<=] identifier[table] operator[SEP] identifier[getRowDim] operator[SEP] 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[int] identifier[col] operator[=] Other[0] operator[SEP] identifier[DateTimeFormatter] identifier[fmt] operator[=] identifier[DateTimeFormat] operator[SEP] identifier[forPattern] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[set] operator[SEP] identifier[row] , identifier[col] operator[++] , identifier[fmt] operator[SEP] identifier[print] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[scoreTable] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[row] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[set] operator[SEP] identifier[row] , identifier[col] operator[++] , identifier[PrettyPrint] operator[SEP] identifier[msecs] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[scoreTable] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[row] operator[SEP] operator[-] identifier[startTime] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[set] operator[SEP] identifier[row] , identifier[col] operator[++] , identifier[row] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[remaining_cols] operator[=] Other[0] operator[SEP] identifier[remaining_cols] operator[<] identifier[otherTableEntries] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[remaining_cols] operator[++] operator[SEP] {
identifier[table] operator[SEP] identifier[set] operator[SEP] identifier[row] , identifier[col] operator[++] , operator[SEP] Keyword[double] operator[SEP] identifier[scoreTable] operator[SEP] identifier[get] operator[SEP] identifier[otherTableEntries] operator[SEP] identifier[get] operator[SEP] identifier[remaining_cols] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[row] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[table] operator[SEP]
}
|
private void writeRecord( OutputStream out,
HttpHeaders headers,
byte[] contents) throws IOException
{
if ( contents == null )
{
headers.add(CONTENT_LENGTH, "0");
}
else
{
headers.add(CONTENT_LENGTH,String.valueOf(contents.length));
}
out.write(WARC_ID.getBytes(DEFAULT_ENCODING));
out.write(CR);
out.write(LF);
// NOTE: HttpHeaders.write() method includes the trailing CRLF.
// So we don't need to write it out here.
headers.write(out);
if ( contents != null )
{
out.write( contents );
}
// Emit the 2 trailing CRLF sequences.
out.write(CR);
out.write(LF);
out.write(CR);
out.write(LF);
} | class class_name[name] begin[{]
method[writeRecord, return_type[void], modifier[private], parameter[out, headers, contents]] begin[{]
if[binary_operation[member[.contents], ==, literal[null]]] begin[{]
call[headers.add, parameter[member[.CONTENT_LENGTH], literal["0"]]]
else begin[{]
call[headers.add, parameter[member[.CONTENT_LENGTH], call[String.valueOf, parameter[member[contents.length]]]]]
end[}]
call[out.write, parameter[call[WARC_ID.getBytes, parameter[member[.DEFAULT_ENCODING]]]]]
call[out.write, parameter[member[.CR]]]
call[out.write, parameter[member[.LF]]]
call[headers.write, parameter[member[.out]]]
if[binary_operation[member[.contents], !=, literal[null]]] begin[{]
call[out.write, parameter[member[.contents]]]
else begin[{]
None
end[}]
call[out.write, parameter[member[.CR]]]
call[out.write, parameter[member[.LF]]]
call[out.write, parameter[member[.CR]]]
call[out.write, parameter[member[.LF]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeRecord] operator[SEP] identifier[OutputStream] identifier[out] , identifier[HttpHeaders] identifier[headers] , Keyword[byte] operator[SEP] operator[SEP] identifier[contents] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[contents] operator[==] Other[null] operator[SEP] {
identifier[headers] operator[SEP] identifier[add] operator[SEP] identifier[CONTENT_LENGTH] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[headers] operator[SEP] identifier[add] operator[SEP] identifier[CONTENT_LENGTH] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[WARC_ID] operator[SEP] identifier[getBytes] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[CR] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[LF] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[write] operator[SEP] identifier[out] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[contents] operator[!=] Other[null] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[contents] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[CR] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[LF] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[CR] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[LF] operator[SEP] operator[SEP]
}
|
@Override
public final void setDeliveryDelay(long value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setDeliveryDelay", Long.valueOf(value));
if ((value >= MfpConstants.MIN_DELIVERY_DELAY) && (value <= MfpConstants.MAX_DELIVERY_DELAY)) {
super.setDeliveryDelay(value);
}
else {
IllegalArgumentException e = new IllegalArgumentException(Long.toString(value));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setDeliveryDelay", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setDeliveryDelay");
} | class class_name[name] begin[{]
method[setDeliveryDelay, return_type[void], modifier[final public], parameter[value]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setDeliveryDelay"], call[Long.valueOf, parameter[member[.value]]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.value], >=, member[MfpConstants.MIN_DELIVERY_DELAY]], &&, binary_operation[member[.value], <=, member[MfpConstants.MAX_DELIVERY_DELAY]]]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDeliveryDelay, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
else begin[{]
local_variable[type[IllegalArgumentException], e]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setDeliveryDelay"], member[.e]]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setDeliveryDelay"]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setDeliveryDelay] operator[SEP] Keyword[long] identifier[value] 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] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[value] operator[>=] identifier[MfpConstants] operator[SEP] identifier[MIN_DELIVERY_DELAY] operator[SEP] operator[&&] operator[SEP] identifier[value] operator[<=] identifier[MfpConstants] operator[SEP] identifier[MAX_DELIVERY_DELAY] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[setDeliveryDelay] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[IllegalArgumentException] identifier[e] operator[=] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[Long] operator[SEP] identifier[toString] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] 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 void printDataStartForm(PrintWriter out, int iPrintOptions)
{
if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) != 0)
out.println("<tr>\n<td colspan=\"20\">");
out.println("<table border=\"0\" cellspacing=\"10\">\n<tr>");
} | class class_name[name] begin[{]
method[printDataStartForm, return_type[void], modifier[public], parameter[out, iPrintOptions]] begin[{]
if[binary_operation[binary_operation[member[.iPrintOptions], &, member[HtmlConstants.DETAIL_SCREEN]], !=, literal[0]]] begin[{]
call[out.println, parameter[literal["<tr>\n<td colspan=\"20\">"]]]
else begin[{]
None
end[}]
call[out.println, parameter[literal["<table border=\"0\" cellspacing=\"10\">\n<tr>"]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printDataStartForm] operator[SEP] identifier[PrintWriter] identifier[out] , Keyword[int] identifier[iPrintOptions] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[iPrintOptions] operator[&] identifier[HtmlConstants] operator[SEP] identifier[DETAIL_SCREEN] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
protected Statement genParamTypeChecks(TemplateNode node, String alias) {
ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
for (TemplateParam param : node.getAllParams()) {
String paramName = param.name();
SoyType paramType = param.type();
CodeChunk.Generator generator = templateTranslationContext.codeGenerator();
Expression paramChunk = genCodeForParamAccess(paramName, param);
JsType jsType = getJsTypeForParamTypeCheck(paramType);
// The opt_param.name value that will be type-tested.
String paramAlias = genParamAlias(paramName);
Expression coerced = jsType.getValueCoercion(paramChunk, generator);
if (coerced != null) {
// since we have coercion logic, dump into a temporary
paramChunk = generator.declarationBuilder().setRhs(coerced).build().ref();
}
if (param.hasDefault()) {
if (coerced == null) {
paramChunk = generator.declarationBuilder().setRhs(paramChunk).build().ref();
}
declarations.add(
genParamDefault(param, paramChunk, alias, jsType, /* declareStatic= */ true));
}
// The param value to assign
Expression value;
Optional<Expression> soyTypeAssertion =
jsType.getSoyTypeAssertion(paramChunk, paramName, generator);
// The type-cast expression.
if (soyTypeAssertion.isPresent()) {
value = soyTypeAssertion.get();
} else {
value = paramChunk;
}
VariableDeclaration.Builder declarationBuilder =
VariableDeclaration.builder(paramAlias)
.setRhs(value)
.setGoogRequires(jsType.getGoogRequires());
declarationBuilder.setJsDoc(
JsDoc.builder()
.addParameterizedAnnotation(
"type", getJsTypeForParamForDeclaration(paramType).typeExpr())
.build());
VariableDeclaration declaration = declarationBuilder.build();
declarations.add(declaration);
templateTranslationContext
.soyToJsVariableMappings()
// TODO(lukes): this should really be declartion.ref() but we cannot do that until
// everything is on the code chunk api.
.put(paramName, id(paramAlias));
}
return Statement.of(declarations.build());
} | class class_name[name] begin[{]
method[genParamTypeChecks, return_type[type[Statement]], modifier[protected], parameter[node, alias]] begin[{]
local_variable[type[ImmutableList], declarations]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), name=paramName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), name=paramType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SoyType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=codeGenerator, postfix_operators=[], prefix_operators=[], qualifier=templateTranslationContext, selectors=[], type_arguments=None), name=generator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CodeChunk, sub_type=ReferenceType(arguments=None, dimensions=None, name=Generator, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=genCodeForParamAccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=paramChunk)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expression, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJsTypeForParamTypeCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=jsType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=genParamAlias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=paramAlias)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=generator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValueCoercion, postfix_operators=[], prefix_operators=[], qualifier=jsType, selectors=[], type_arguments=None), name=coerced)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expression, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=coerced, 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=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=declarationBuilder, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[MethodInvocation(arguments=[MemberReference(member=coerced, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRhs, 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), MethodInvocation(arguments=[], member=ref, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=hasDefault, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=coerced, 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=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=declarationBuilder, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[MethodInvocation(arguments=[MemberReference(member=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRhs, 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), MethodInvocation(arguments=[], member=ref, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=alias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=genParamDefault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=declarations, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expression, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=generator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSoyTypeAssertion, postfix_operators=[], prefix_operators=[], qualifier=jsType, selectors=[], type_arguments=None), name=soyTypeAssertion)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Expression, sub_type=None))], dimensions=[], name=Optional, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isPresent, postfix_operators=[], prefix_operators=[], qualifier=soyTypeAssertion, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=paramChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=soyTypeAssertion, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramAlias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=builder, postfix_operators=[], prefix_operators=[], qualifier=VariableDeclaration, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRhs, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGoogRequires, postfix_operators=[], prefix_operators=[], qualifier=jsType, selectors=[], type_arguments=None)], member=setGoogRequires, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=declarationBuilder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableDeclaration, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=builder, postfix_operators=[], prefix_operators=[], qualifier=JsDoc, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type"), MethodInvocation(arguments=[MemberReference(member=paramType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJsTypeForParamForDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=typeExpr, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addParameterizedAnnotation, 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)], member=setJsDoc, postfix_operators=[], prefix_operators=[], qualifier=declarationBuilder, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=declarationBuilder, selectors=[], type_arguments=None), name=declaration)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableDeclaration, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=declarations, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=soyToJsVariableMappings, postfix_operators=[], prefix_operators=[], qualifier=templateTranslationContext, selectors=[MethodInvocation(arguments=[MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=paramAlias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllParams, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TemplateParam, sub_type=None))), label=None)
return[call[Statement.of, parameter[call[declarations.build, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] Keyword[protected] identifier[Statement] identifier[genParamTypeChecks] operator[SEP] identifier[TemplateNode] identifier[node] , identifier[String] identifier[alias] operator[SEP] {
identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[Statement] operator[>] identifier[declarations] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TemplateParam] identifier[param] operator[:] identifier[node] operator[SEP] identifier[getAllParams] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[paramName] operator[=] identifier[param] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[SoyType] identifier[paramType] operator[=] identifier[param] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[CodeChunk] operator[SEP] identifier[Generator] identifier[generator] operator[=] identifier[templateTranslationContext] operator[SEP] identifier[codeGenerator] operator[SEP] operator[SEP] operator[SEP] identifier[Expression] identifier[paramChunk] operator[=] identifier[genCodeForParamAccess] operator[SEP] identifier[paramName] , identifier[param] operator[SEP] operator[SEP] identifier[JsType] identifier[jsType] operator[=] identifier[getJsTypeForParamTypeCheck] operator[SEP] identifier[paramType] operator[SEP] operator[SEP] identifier[String] identifier[paramAlias] operator[=] identifier[genParamAlias] operator[SEP] identifier[paramName] operator[SEP] operator[SEP] identifier[Expression] identifier[coerced] operator[=] identifier[jsType] operator[SEP] identifier[getValueCoercion] operator[SEP] identifier[paramChunk] , identifier[generator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[coerced] operator[!=] Other[null] operator[SEP] {
identifier[paramChunk] operator[=] identifier[generator] operator[SEP] identifier[declarationBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setRhs] operator[SEP] identifier[coerced] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[param] operator[SEP] identifier[hasDefault] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[coerced] operator[==] Other[null] operator[SEP] {
identifier[paramChunk] operator[=] identifier[generator] operator[SEP] identifier[declarationBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setRhs] operator[SEP] identifier[paramChunk] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[SEP] operator[SEP] operator[SEP]
}
identifier[declarations] operator[SEP] identifier[add] operator[SEP] identifier[genParamDefault] operator[SEP] identifier[param] , identifier[paramChunk] , identifier[alias] , identifier[jsType] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Expression] identifier[value] operator[SEP] identifier[Optional] operator[<] identifier[Expression] operator[>] identifier[soyTypeAssertion] operator[=] identifier[jsType] operator[SEP] identifier[getSoyTypeAssertion] operator[SEP] identifier[paramChunk] , identifier[paramName] , identifier[generator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[soyTypeAssertion] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[soyTypeAssertion] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[value] operator[=] identifier[paramChunk] operator[SEP]
}
identifier[VariableDeclaration] operator[SEP] identifier[Builder] identifier[declarationBuilder] operator[=] identifier[VariableDeclaration] operator[SEP] identifier[builder] operator[SEP] identifier[paramAlias] operator[SEP] operator[SEP] identifier[setRhs] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[setGoogRequires] operator[SEP] identifier[jsType] operator[SEP] identifier[getGoogRequires] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[declarationBuilder] operator[SEP] identifier[setJsDoc] operator[SEP] identifier[JsDoc] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[addParameterizedAnnotation] operator[SEP] literal[String] , identifier[getJsTypeForParamForDeclaration] operator[SEP] identifier[paramType] operator[SEP] operator[SEP] identifier[typeExpr] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[VariableDeclaration] identifier[declaration] operator[=] identifier[declarationBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[declarations] operator[SEP] identifier[add] operator[SEP] identifier[declaration] operator[SEP] operator[SEP] identifier[templateTranslationContext] operator[SEP] identifier[soyToJsVariableMappings] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[paramName] , identifier[id] operator[SEP] identifier[paramAlias] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Statement] operator[SEP] identifier[of] operator[SEP] identifier[declarations] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void initDefaultRule(ErrorListener errorListener) throws TransformerException
{
// Then manufacture a default
m_defaultRule = new ElemTemplate();
m_defaultRule.setStylesheet(this);
XPath defMatch = new XPath("*", this, this, XPath.MATCH, errorListener);
m_defaultRule.setMatch(defMatch);
ElemApplyTemplates childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
childrenElement.setSelect(m_selectDefault);
m_defaultRule.appendChild(childrenElement);
m_startRule = m_defaultRule;
// -----------------------------
m_defaultTextRule = new ElemTemplate();
m_defaultTextRule.setStylesheet(this);
defMatch = new XPath("text() | @*", this, this, XPath.MATCH, errorListener);
m_defaultTextRule.setMatch(defMatch);
ElemValueOf elemValueOf = new ElemValueOf();
m_defaultTextRule.appendChild(elemValueOf);
XPath selectPattern = new XPath(".", this, this, XPath.SELECT, errorListener);
elemValueOf.setSelect(selectPattern);
//--------------------------------
m_defaultRootRule = new ElemTemplate();
m_defaultRootRule.setStylesheet(this);
defMatch = new XPath("/", this, this, XPath.MATCH, errorListener);
m_defaultRootRule.setMatch(defMatch);
childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
m_defaultRootRule.appendChild(childrenElement);
childrenElement.setSelect(m_selectDefault);
} | class class_name[name] begin[{]
method[initDefaultRule, return_type[void], modifier[private], parameter[errorListener]] begin[{]
assign[member[.m_defaultRule], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ElemTemplate, sub_type=None))]
call[m_defaultRule.setStylesheet, parameter[THIS[]]]
local_variable[type[XPath], defMatch]
call[m_defaultRule.setMatch, parameter[member[.defMatch]]]
local_variable[type[ElemApplyTemplates], childrenElement]
call[childrenElement.setIsDefaultTemplate, parameter[literal[true]]]
call[childrenElement.setSelect, parameter[member[.m_selectDefault]]]
call[m_defaultRule.appendChild, parameter[member[.childrenElement]]]
assign[member[.m_startRule], member[.m_defaultRule]]
assign[member[.m_defaultTextRule], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ElemTemplate, sub_type=None))]
call[m_defaultTextRule.setStylesheet, parameter[THIS[]]]
assign[member[.defMatch], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="text() | @*"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=MATCH, postfix_operators=[], prefix_operators=[], qualifier=XPath, selectors=[]), MemberReference(member=errorListener, 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=XPath, sub_type=None))]
call[m_defaultTextRule.setMatch, parameter[member[.defMatch]]]
local_variable[type[ElemValueOf], elemValueOf]
call[m_defaultTextRule.appendChild, parameter[member[.elemValueOf]]]
local_variable[type[XPath], selectPattern]
call[elemValueOf.setSelect, parameter[member[.selectPattern]]]
assign[member[.m_defaultRootRule], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ElemTemplate, sub_type=None))]
call[m_defaultRootRule.setStylesheet, parameter[THIS[]]]
assign[member[.defMatch], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=MATCH, postfix_operators=[], prefix_operators=[], qualifier=XPath, selectors=[]), MemberReference(member=errorListener, 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=XPath, sub_type=None))]
call[m_defaultRootRule.setMatch, parameter[member[.defMatch]]]
assign[member[.childrenElement], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ElemApplyTemplates, sub_type=None))]
call[childrenElement.setIsDefaultTemplate, parameter[literal[true]]]
call[m_defaultRootRule.appendChild, parameter[member[.childrenElement]]]
call[childrenElement.setSelect, parameter[member[.m_selectDefault]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initDefaultRule] operator[SEP] identifier[ErrorListener] identifier[errorListener] operator[SEP] Keyword[throws] identifier[TransformerException] {
identifier[m_defaultRule] operator[=] Keyword[new] identifier[ElemTemplate] operator[SEP] operator[SEP] operator[SEP] identifier[m_defaultRule] operator[SEP] identifier[setStylesheet] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[XPath] identifier[defMatch] operator[=] Keyword[new] identifier[XPath] operator[SEP] literal[String] , Keyword[this] , Keyword[this] , identifier[XPath] operator[SEP] identifier[MATCH] , identifier[errorListener] operator[SEP] operator[SEP] identifier[m_defaultRule] operator[SEP] identifier[setMatch] operator[SEP] identifier[defMatch] operator[SEP] operator[SEP] identifier[ElemApplyTemplates] identifier[childrenElement] operator[=] Keyword[new] identifier[ElemApplyTemplates] operator[SEP] operator[SEP] operator[SEP] identifier[childrenElement] operator[SEP] identifier[setIsDefaultTemplate] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[childrenElement] operator[SEP] identifier[setSelect] operator[SEP] identifier[m_selectDefault] operator[SEP] operator[SEP] identifier[m_defaultRule] operator[SEP] identifier[appendChild] operator[SEP] identifier[childrenElement] operator[SEP] operator[SEP] identifier[m_startRule] operator[=] identifier[m_defaultRule] operator[SEP] identifier[m_defaultTextRule] operator[=] Keyword[new] identifier[ElemTemplate] operator[SEP] operator[SEP] operator[SEP] identifier[m_defaultTextRule] operator[SEP] identifier[setStylesheet] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[defMatch] operator[=] Keyword[new] identifier[XPath] operator[SEP] literal[String] , Keyword[this] , Keyword[this] , identifier[XPath] operator[SEP] identifier[MATCH] , identifier[errorListener] operator[SEP] operator[SEP] identifier[m_defaultTextRule] operator[SEP] identifier[setMatch] operator[SEP] identifier[defMatch] operator[SEP] operator[SEP] identifier[ElemValueOf] identifier[elemValueOf] operator[=] Keyword[new] identifier[ElemValueOf] operator[SEP] operator[SEP] operator[SEP] identifier[m_defaultTextRule] operator[SEP] identifier[appendChild] operator[SEP] identifier[elemValueOf] operator[SEP] operator[SEP] identifier[XPath] identifier[selectPattern] operator[=] Keyword[new] identifier[XPath] operator[SEP] literal[String] , Keyword[this] , Keyword[this] , identifier[XPath] operator[SEP] identifier[SELECT] , identifier[errorListener] operator[SEP] operator[SEP] identifier[elemValueOf] operator[SEP] identifier[setSelect] operator[SEP] identifier[selectPattern] operator[SEP] operator[SEP] identifier[m_defaultRootRule] operator[=] Keyword[new] identifier[ElemTemplate] operator[SEP] operator[SEP] operator[SEP] identifier[m_defaultRootRule] operator[SEP] identifier[setStylesheet] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[defMatch] operator[=] Keyword[new] identifier[XPath] operator[SEP] literal[String] , Keyword[this] , Keyword[this] , identifier[XPath] operator[SEP] identifier[MATCH] , identifier[errorListener] operator[SEP] operator[SEP] identifier[m_defaultRootRule] operator[SEP] identifier[setMatch] operator[SEP] identifier[defMatch] operator[SEP] operator[SEP] identifier[childrenElement] operator[=] Keyword[new] identifier[ElemApplyTemplates] operator[SEP] operator[SEP] operator[SEP] identifier[childrenElement] operator[SEP] identifier[setIsDefaultTemplate] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[m_defaultRootRule] operator[SEP] identifier[appendChild] operator[SEP] identifier[childrenElement] operator[SEP] operator[SEP] identifier[childrenElement] operator[SEP] identifier[setSelect] operator[SEP] identifier[m_selectDefault] operator[SEP] operator[SEP]
}
|
public void copyChunk() {
if (!isDone()) {
try {
this.rewriteResponse =
runWithRetries(
new Callable<RewriteResponse>() {
@Override
public RewriteResponse call() {
return storageRpc.continueRewrite(rewriteResponse);
}
},
serviceOptions.getRetrySettings(),
StorageImpl.EXCEPTION_HANDLER,
serviceOptions.getClock());
} catch (RetryHelper.RetryHelperException e) {
throw StorageException.translateAndThrow(e);
}
}
} | class class_name[name] begin[{]
method[copyChunk, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isDone, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=rewriteResponse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=rewriteResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=continueRewrite, postfix_operators=[], prefix_operators=[], qualifier=storageRpc, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=RewriteResponse, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RewriteResponse, sub_type=None))], dimensions=None, name=Callable, sub_type=None)), MethodInvocation(arguments=[], member=getRetrySettings, postfix_operators=[], prefix_operators=[], qualifier=serviceOptions, selectors=[], type_arguments=None), MemberReference(member=EXCEPTION_HANDLER, postfix_operators=[], prefix_operators=[], qualifier=StorageImpl, selectors=[]), MethodInvocation(arguments=[], member=getClock, postfix_operators=[], prefix_operators=[], qualifier=serviceOptions, selectors=[], type_arguments=None)], member=runWithRetries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=translateAndThrow, postfix_operators=[], prefix_operators=[], qualifier=StorageException, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RetryHelper.RetryHelperException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[copyChunk] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isDone] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[rewriteResponse] operator[=] identifier[runWithRetries] operator[SEP] Keyword[new] identifier[Callable] operator[<] identifier[RewriteResponse] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[RewriteResponse] identifier[call] operator[SEP] operator[SEP] {
Keyword[return] identifier[storageRpc] operator[SEP] identifier[continueRewrite] operator[SEP] identifier[rewriteResponse] operator[SEP] operator[SEP]
}
} , identifier[serviceOptions] operator[SEP] identifier[getRetrySettings] operator[SEP] operator[SEP] , identifier[StorageImpl] operator[SEP] identifier[EXCEPTION_HANDLER] , identifier[serviceOptions] operator[SEP] identifier[getClock] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RetryHelper] operator[SEP] identifier[RetryHelperException] identifier[e] operator[SEP] {
Keyword[throw] identifier[StorageException] operator[SEP] identifier[translateAndThrow] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
|
@Override
protected void updateFaxJobFromInputDataImpl(String[] inputData,FaxJob faxJob)
{
//get amount
int amount=inputData.length;
if((amount%2)==0)
{
String argument=null;
String key=null;
String value=null;
String propertyPrefix="-property:";
int propertyPrefixLength=propertyPrefix.length();
for(int index=0;index<inputData.length;index=index+2)
{
//get next argument and value
argument=inputData[index];
value=inputData[index+1];
if(argument.equals("-priority"))
{
FaxJobPriority priority=FaxJobPriority.valueOf(value);
faxJob.setPriority(priority);
}
else if(argument.equals("-target_address"))
{
faxJob.setTargetAddress(value);
}
else if(argument.equals("-target_name"))
{
faxJob.setTargetName(value);
}
else if(argument.equals("-sender_name"))
{
faxJob.setSenderName(value);
}
else if(argument.equals("-sender_fax_number"))
{
faxJob.setSenderFaxNumber(value);
}
else if(argument.equals("-sender_email"))
{
faxJob.setSenderEmail(value);
}
else if(argument.startsWith(propertyPrefix))
{
if(argument.length()>propertyPrefixLength)
{
//get key
key=argument.substring(propertyPrefixLength);
//set property
faxJob.setProperty(key,value);
}
}
else if(!argument.equals("-file"))
{
throw new FaxException("Invalid input provided, unsupported argument: "+argument);
}
}
}
else
{
throw new FaxException("Invalid input provided, expected even number of arguments.");
}
} | class class_name[name] begin[{]
method[updateFaxJobFromInputDataImpl, return_type[void], modifier[protected], parameter[inputData, faxJob]] begin[{]
local_variable[type[int], amount]
if[binary_operation[binary_operation[member[.amount], %, literal[2]], ==, literal[0]]] begin[{]
local_variable[type[String], argument]
local_variable[type[String], key]
local_variable[type[String], value]
local_variable[type[String], propertyPrefix]
local_variable[type[int], propertyPrefixLength]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=argument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=inputData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=inputData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))])), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-priority")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-target_address")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-target_name")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-sender_name")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-sender_fax_number")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-sender_email")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=propertyPrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-file")], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=argument, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid input provided, unsupported argument: "), operandr=MemberReference(member=argument, 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=FaxException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None), operandr=MemberReference(member=propertyPrefixLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=propertyPrefixLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=argument, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSenderEmail, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSenderFaxNumber, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSenderName, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTargetName, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTargetAddress, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=FaxJobPriority, selectors=[], type_arguments=None), name=priority)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FaxJobPriority, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=priority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPriority, postfix_operators=[], prefix_operators=[], qualifier=faxJob, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=inputData, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+))]), label=None)
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid input provided, expected even number of arguments.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FaxException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[updateFaxJobFromInputDataImpl] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[inputData] , identifier[FaxJob] identifier[faxJob] operator[SEP] {
Keyword[int] identifier[amount] operator[=] identifier[inputData] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[amount] operator[%] Other[2] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[String] identifier[argument] operator[=] Other[null] operator[SEP] identifier[String] identifier[key] operator[=] Other[null] operator[SEP] identifier[String] identifier[value] operator[=] Other[null] operator[SEP] identifier[String] identifier[propertyPrefix] operator[=] literal[String] operator[SEP] Keyword[int] identifier[propertyPrefixLength] operator[=] identifier[propertyPrefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] identifier[index] operator[<] identifier[inputData] operator[SEP] identifier[length] operator[SEP] identifier[index] operator[=] identifier[index] operator[+] Other[2] operator[SEP] {
identifier[argument] operator[=] identifier[inputData] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[inputData] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[FaxJobPriority] identifier[priority] operator[=] identifier[FaxJobPriority] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[faxJob] operator[SEP] identifier[setPriority] operator[SEP] identifier[priority] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[faxJob] operator[SEP] identifier[setTargetAddress] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[faxJob] operator[SEP] identifier[setTargetName] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[faxJob] operator[SEP] identifier[setSenderName] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[faxJob] operator[SEP] identifier[setSenderFaxNumber] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[faxJob] operator[SEP] identifier[setSenderEmail] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[startsWith] operator[SEP] identifier[propertyPrefix] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] identifier[propertyPrefixLength] operator[SEP] {
identifier[key] operator[=] identifier[argument] operator[SEP] identifier[substring] operator[SEP] identifier[propertyPrefixLength] operator[SEP] operator[SEP] identifier[faxJob] operator[SEP] identifier[setProperty] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[argument] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FaxException] operator[SEP] literal[String] operator[+] identifier[argument] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[FaxException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public void push(String symbol) {
long now = System.currentTimeMillis();
if (!symbol.equals(lastSymbol) || (now - lastActivity > interdigitInterval)) {
lastActivity = now;
lastSymbol = symbol;
detectorImpl.fireEvent(symbol);
}
else
lastActivity=now;
} | class class_name[name] begin[{]
method[push, return_type[void], modifier[public], parameter[symbol]] begin[{]
local_variable[type[long], now]
if[binary_operation[call[symbol.equals, parameter[member[.lastSymbol]]], ||, binary_operation[binary_operation[member[.now], -, member[.lastActivity]], >, member[.interdigitInterval]]]] begin[{]
assign[member[.lastActivity], member[.now]]
assign[member[.lastSymbol], member[.symbol]]
call[detectorImpl.fireEvent, parameter[member[.symbol]]]
else begin[{]
assign[member[.lastActivity], member[.now]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[push] operator[SEP] identifier[String] identifier[symbol] operator[SEP] {
Keyword[long] identifier[now] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[symbol] operator[SEP] identifier[equals] operator[SEP] identifier[lastSymbol] operator[SEP] operator[||] operator[SEP] identifier[now] operator[-] identifier[lastActivity] operator[>] identifier[interdigitInterval] operator[SEP] operator[SEP] {
identifier[lastActivity] operator[=] identifier[now] operator[SEP] identifier[lastSymbol] operator[=] identifier[symbol] operator[SEP] identifier[detectorImpl] operator[SEP] identifier[fireEvent] operator[SEP] identifier[symbol] operator[SEP] operator[SEP]
}
Keyword[else] identifier[lastActivity] operator[=] identifier[now] operator[SEP]
}
|
@Nonnull
public static GenericodeReader <com.helger.genericode.v04.CodeListDocument> gc04CodeList ()
{
return new GenericodeReader<> (EGenericodeDocumentType.GC04_CODE_LIST,
com.helger.genericode.v04.CodeListDocument.class);
} | class class_name[name] begin[{]
method[gc04CodeList, return_type[type[GenericodeReader]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=GC04_CODE_LIST, postfix_operators=[], prefix_operators=[], qualifier=EGenericodeDocumentType, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=com.helger.genericode.v04, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CodeListDocument, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=GenericodeReader, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[GenericodeReader] operator[<] identifier[com] operator[SEP] identifier[helger] operator[SEP] identifier[genericode] operator[SEP] identifier[v04] operator[SEP] identifier[CodeListDocument] operator[>] identifier[gc04CodeList] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[GenericodeReader] operator[<] operator[>] operator[SEP] identifier[EGenericodeDocumentType] operator[SEP] identifier[GC04_CODE_LIST] , identifier[com] operator[SEP] identifier[helger] operator[SEP] identifier[genericode] operator[SEP] identifier[v04] operator[SEP] identifier[CodeListDocument] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static List<String> getServiceUrlsFromDNS(EurekaClientConfig clientConfig, String instanceZone, boolean preferSameZone, ServiceUrlRandomizer randomizer) {
String region = getRegion(clientConfig);
// Get zone-specific DNS names for the given region so that we can get a
// list of available zones
Map<String, List<String>> zoneDnsNamesMap = getZoneBasedDiscoveryUrlsFromRegion(clientConfig, region);
Set<String> availableZones = zoneDnsNamesMap.keySet();
List<String> zones = new ArrayList<String>(availableZones);
if (zones.isEmpty()) {
throw new RuntimeException("No available zones configured for the instanceZone " + instanceZone);
}
int zoneIndex = 0;
boolean zoneFound = false;
for (String zone : zones) {
logger.debug("Checking if the instance zone {} is the same as the zone from DNS {}", instanceZone, zone);
if (preferSameZone) {
if (instanceZone.equalsIgnoreCase(zone)) {
zoneFound = true;
}
} else {
if (!instanceZone.equalsIgnoreCase(zone)) {
zoneFound = true;
}
}
if (zoneFound) {
logger.debug("The zone index from the list {} that matches the instance zone {} is {}",
zones, instanceZone, zoneIndex);
break;
}
zoneIndex++;
}
if (zoneIndex >= zones.size()) {
if (logger.isWarnEnabled()) {
logger.warn("No match for the zone {} in the list of available zones {}",
instanceZone, zones.toArray());
}
} else {
// Rearrange the zones with the instance zone first
for (int i = 0; i < zoneIndex; i++) {
String zone = zones.remove(0);
zones.add(zone);
}
}
// Now get the eureka urls for all the zones in the order and return it
List<String> serviceUrls = new ArrayList<String>();
for (String zone : zones) {
for (String zoneCname : zoneDnsNamesMap.get(zone)) {
List<String> ec2Urls = new ArrayList<String>(getEC2DiscoveryUrlsFromZone(zoneCname, DiscoveryUrlType.CNAME));
// Rearrange the list to distribute the load in case of multiple servers
if (ec2Urls.size() > 1) {
randomizer.randomize(ec2Urls);
}
for (String ec2Url : ec2Urls) {
StringBuilder sb = new StringBuilder()
.append("http://")
.append(ec2Url)
.append(":")
.append(clientConfig.getEurekaServerPort());
if (clientConfig.getEurekaServerURLContext() != null) {
if (!clientConfig.getEurekaServerURLContext().startsWith("/")) {
sb.append("/");
}
sb.append(clientConfig.getEurekaServerURLContext());
if (!clientConfig.getEurekaServerURLContext().endsWith("/")) {
sb.append("/");
}
} else {
sb.append("/");
}
String serviceUrl = sb.toString();
logger.debug("The EC2 url is {}", serviceUrl);
serviceUrls.add(serviceUrl);
}
}
}
// Rearrange the fail over server list to distribute the load
String primaryServiceUrl = serviceUrls.remove(0);
randomizer.randomize(serviceUrls);
serviceUrls.add(0, primaryServiceUrl);
if (logger.isDebugEnabled()) {
logger.debug("This client will talk to the following serviceUrls in order : {} ",
(Object) serviceUrls.toArray());
}
return serviceUrls;
} | class class_name[name] begin[{]
method[getServiceUrlsFromDNS, return_type[type[List]], modifier[public static], parameter[clientConfig, instanceZone, preferSameZone, randomizer]] begin[{]
local_variable[type[String], region]
local_variable[type[Map], zoneDnsNamesMap]
local_variable[type[Set], availableZones]
local_variable[type[List], zones]
if[call[zones.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No available zones configured for the instanceZone "), operandr=MemberReference(member=instanceZone, 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=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], zoneIndex]
local_variable[type[boolean], zoneFound]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Checking if the instance zone {} is the same as the zone from DNS {}"), MemberReference(member=instanceZone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=preferSameZone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=['!'], qualifier=instanceZone, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=zoneFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=instanceZone, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=zoneFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))])), IfStatement(condition=MemberReference(member=zoneFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The zone index from the list {} that matches the instance zone {} is {}"), MemberReference(member=zones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=instanceZone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zoneIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])), StatementExpression(expression=MemberReference(member=zoneIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=zones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=zone)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[binary_operation[member[.zoneIndex], >=, call[zones.size, parameter[]]]] begin[{]
if[call[logger.isWarnEnabled, parameter[]]] begin[{]
call[logger.warn, parameter[literal["No match for the zone {} in the list of available zones {}"], member[.instanceZone], call[zones.toArray, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=zones, selectors=[], type_arguments=None), name=zone)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=zones, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=zoneIndex, 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[}]
local_variable[type[List], serviceUrls]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=zoneCname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CNAME, postfix_operators=[], prefix_operators=[], qualifier=DiscoveryUrlType, selectors=[])], member=getEC2DiscoveryUrlsFromZone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=ec2Urls)], 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)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=ec2Urls, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ec2Urls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=randomize, postfix_operators=[], prefix_operators=[], qualifier=randomizer, selectors=[], type_arguments=None), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http://")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ec2Url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEurekaServerPort, postfix_operators=[], prefix_operators=[], qualifier=clientConfig, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=sb)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getEurekaServerURLContext, postfix_operators=[], prefix_operators=[], qualifier=clientConfig, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getEurekaServerURLContext, postfix_operators=[], prefix_operators=['!'], qualifier=clientConfig, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEurekaServerURLContext, postfix_operators=[], prefix_operators=[], qualifier=clientConfig, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getEurekaServerURLContext, postfix_operators=[], prefix_operators=['!'], qualifier=clientConfig, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=endsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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)]))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), name=serviceUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The EC2 url is {}"), MemberReference(member=serviceUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=serviceUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=serviceUrls, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ec2Urls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ec2Url)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=zoneDnsNamesMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=zoneCname)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=zones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=zone)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[String], primaryServiceUrl]
call[randomizer.randomize, parameter[member[.serviceUrls]]]
call[serviceUrls.add, parameter[literal[0], member[.primaryServiceUrl]]]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[literal["This client will talk to the following serviceUrls in order : {} "], Cast(expression=MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=serviceUrls, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.serviceUrls]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[getServiceUrlsFromDNS] operator[SEP] identifier[EurekaClientConfig] identifier[clientConfig] , identifier[String] identifier[instanceZone] , Keyword[boolean] identifier[preferSameZone] , identifier[ServiceUrlRandomizer] identifier[randomizer] operator[SEP] {
identifier[String] identifier[region] operator[=] identifier[getRegion] operator[SEP] identifier[clientConfig] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[zoneDnsNamesMap] operator[=] identifier[getZoneBasedDiscoveryUrlsFromRegion] operator[SEP] identifier[clientConfig] , identifier[region] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[availableZones] operator[=] identifier[zoneDnsNamesMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[zones] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[availableZones] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[zones] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[instanceZone] operator[SEP] operator[SEP]
}
Keyword[int] identifier[zoneIndex] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[zoneFound] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[zone] operator[:] identifier[zones] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[instanceZone] , identifier[zone] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[preferSameZone] operator[SEP] {
Keyword[if] operator[SEP] identifier[instanceZone] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[zone] operator[SEP] operator[SEP] {
identifier[zoneFound] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[instanceZone] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[zone] operator[SEP] operator[SEP] {
identifier[zoneFound] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[zoneFound] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[zones] , identifier[instanceZone] , identifier[zoneIndex] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
identifier[zoneIndex] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[zoneIndex] operator[>=] identifier[zones] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[instanceZone] , identifier[zones] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[zoneIndex] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[zone] operator[=] identifier[zones] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[zones] operator[SEP] identifier[add] operator[SEP] identifier[zone] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[String] operator[>] identifier[serviceUrls] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[zone] operator[:] identifier[zones] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[zoneCname] operator[:] identifier[zoneDnsNamesMap] operator[SEP] identifier[get] operator[SEP] identifier[zone] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[ec2Urls] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[getEC2DiscoveryUrlsFromZone] operator[SEP] identifier[zoneCname] , identifier[DiscoveryUrlType] operator[SEP] identifier[CNAME] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ec2Urls] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[randomizer] operator[SEP] identifier[randomize] operator[SEP] identifier[ec2Urls] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ec2Url] operator[:] identifier[ec2Urls] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[ec2Url] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[clientConfig] operator[SEP] identifier[getEurekaServerPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clientConfig] operator[SEP] identifier[getEurekaServerURLContext] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[clientConfig] operator[SEP] identifier[getEurekaServerURLContext] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[clientConfig] operator[SEP] identifier[getEurekaServerURLContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[clientConfig] operator[SEP] identifier[getEurekaServerURLContext] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[serviceUrl] operator[=] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[serviceUrl] operator[SEP] operator[SEP] identifier[serviceUrls] operator[SEP] identifier[add] operator[SEP] identifier[serviceUrl] operator[SEP] operator[SEP]
}
}
}
identifier[String] identifier[primaryServiceUrl] operator[=] identifier[serviceUrls] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[randomizer] operator[SEP] identifier[randomize] operator[SEP] identifier[serviceUrls] operator[SEP] operator[SEP] identifier[serviceUrls] operator[SEP] identifier[add] operator[SEP] Other[0] , identifier[primaryServiceUrl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , operator[SEP] identifier[Object] operator[SEP] identifier[serviceUrls] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[serviceUrls] operator[SEP]
}
|
public static void main(String[] args) {
// determine if a valid log4j config exists and initialize a default logger if not
if (System.getProperty("log4j.configuration") == null) {
Logger root = Logger.getRootLogger();
root.removeAllAppenders();
PatternLayout layout = new PatternLayout("%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n");
ConsoleAppender appender = new ConsoleAppender(layout, "System.err");
root.addAppender(appender);
root.setLevel(Level.INFO);
}
JobManager jobManager;
try {
jobManager = initialize(args);
// Start info server for jobmanager
jobManager.startInfoServer();
}
catch (Exception e) {
LOG.fatal(e.getMessage(), e);
System.exit(FAILURE_RETURN_CODE);
}
// Clean up is triggered through a shutdown hook
// freeze this thread to keep the JVM alive (the job manager threads are daemon threads)
Object w = new Object();
synchronized (w) {
try {
w.wait();
} catch (InterruptedException e) {}
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[call[System.getProperty, parameter[literal["log4j.configuration"]]], ==, literal[null]]] begin[{]
local_variable[type[Logger], root]
call[root.removeAllAppenders, parameter[]]
local_variable[type[PatternLayout], layout]
local_variable[type[ConsoleAppender], appender]
call[root.addAppender, parameter[member[.appender]]]
call[root.setLevel, parameter[member[Level.INFO]]]
else begin[{]
None
end[}]
local_variable[type[JobManager], jobManager]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jobManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=startInfoServer, postfix_operators=[], prefix_operators=[], qualifier=jobManager, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fatal, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FAILURE_RETURN_CODE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, 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)
local_variable[type[Object], w]
SYNCHRONIZED[member[.w]] BEGIN[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, postfix_operators=[], prefix_operators=[], qualifier=w, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
END[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[Logger] identifier[root] operator[=] identifier[Logger] operator[SEP] identifier[getRootLogger] operator[SEP] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[removeAllAppenders] operator[SEP] operator[SEP] operator[SEP] identifier[PatternLayout] identifier[layout] operator[=] Keyword[new] identifier[PatternLayout] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ConsoleAppender] identifier[appender] operator[=] Keyword[new] identifier[ConsoleAppender] operator[SEP] identifier[layout] , literal[String] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[addAppender] operator[SEP] identifier[appender] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setLevel] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] operator[SEP] operator[SEP]
}
identifier[JobManager] identifier[jobManager] operator[SEP] Keyword[try] {
identifier[jobManager] operator[=] identifier[initialize] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[jobManager] operator[SEP] identifier[startInfoServer] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[fatal] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] identifier[FAILURE_RETURN_CODE] operator[SEP] operator[SEP]
}
identifier[Object] identifier[w] operator[=] Keyword[new] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[w] operator[SEP] {
Keyword[try] {
identifier[w] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
}
}
|
@Override
public FileOutputStream createOutputStream(String name, boolean append) throws FileNotFoundException {
return new FileOutputStream(name, append);
} | class class_name[name] begin[{]
method[createOutputStream, return_type[type[FileOutputStream]], modifier[public], parameter[name, append]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=append, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[FileOutputStream] identifier[createOutputStream] operator[SEP] identifier[String] identifier[name] , Keyword[boolean] identifier[append] operator[SEP] Keyword[throws] identifier[FileNotFoundException] {
Keyword[return] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[name] , identifier[append] operator[SEP] operator[SEP]
}
|
@Override
public CheckIfPhoneNumberIsOptedOutResult checkIfPhoneNumberIsOptedOut(CheckIfPhoneNumberIsOptedOutRequest request) {
request = beforeClientExecution(request);
return executeCheckIfPhoneNumberIsOptedOut(request);
} | class class_name[name] begin[{]
method[checkIfPhoneNumberIsOptedOut, return_type[type[CheckIfPhoneNumberIsOptedOutResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeCheckIfPhoneNumberIsOptedOut, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CheckIfPhoneNumberIsOptedOutResult] identifier[checkIfPhoneNumberIsOptedOut] operator[SEP] identifier[CheckIfPhoneNumberIsOptedOutRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeCheckIfPhoneNumberIsOptedOut] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public int put(Widget widget) {
attach(widget);
for (int i = 0; i < content.length; ++i)
for (int j = 0; j < content[i].length; ++j)
if (content[i][j] == null) {
content[i][j] = widget;
this.sendElement();
return i;
}
throw new IndexOutOfBoundsException();
//return -1;
} | class class_name[name] begin[{]
method[put, return_type[type[int]], modifier[public], parameter[widget]] begin[{]
call[.attach, parameter[member[.widget]]]
ForStatement(body=ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, 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=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=widget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=sendElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), ReturnStatement(expression=MemberReference(member=i, 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=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=content, 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)
ThrowStatement(expression=ClassCreator(arguments=[], 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)
end[}]
END[}] | Keyword[public] Keyword[int] identifier[put] operator[SEP] identifier[Widget] identifier[widget] operator[SEP] {
identifier[attach] operator[SEP] identifier[widget] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[content] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[content] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[j] operator[SEP] Keyword[if] operator[SEP] identifier[content] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[content] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[widget] operator[SEP] Keyword[this] operator[SEP] identifier[sendElement] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] operator[SEP] operator[SEP]
}
|
@Implementation
public static Typeface getFontSync(FontRequest request) {
return Typeface.create(request.getQuery(), Typeface.NORMAL);
} | class class_name[name] begin[{]
method[getFontSync, return_type[type[Typeface]], modifier[public static], parameter[request]] begin[{]
return[call[Typeface.create, parameter[call[request.getQuery, parameter[]], member[Typeface.NORMAL]]]]
end[}]
END[}] | annotation[@] identifier[Implementation] Keyword[public] Keyword[static] identifier[Typeface] identifier[getFontSync] operator[SEP] identifier[FontRequest] identifier[request] operator[SEP] {
Keyword[return] identifier[Typeface] operator[SEP] identifier[create] operator[SEP] identifier[request] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] , identifier[Typeface] operator[SEP] identifier[NORMAL] operator[SEP] operator[SEP]
}
|
public static boolean getBooleanParam(JSONObject params, String paramName) throws ApiException {
if (!params.containsKey(paramName)) {
throw new ApiException(ApiException.Type.MISSING_PARAMETER, paramName);
}
try {
return params.getBoolean(paramName);
} catch (JSONException e) {
throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, paramName, e);
}
} | class class_name[name] begin[{]
method[getBooleanParam, return_type[type[boolean]], modifier[public static], parameter[params, paramName]] begin[{]
if[call[params.containsKey, parameter[member[.paramName]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=MISSING_PARAMETER, postfix_operators=[], prefix_operators=[], qualifier=ApiException.Type, selectors=[]), MemberReference(member=paramName, 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=ApiException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBoolean, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ILLEGAL_PARAMETER, postfix_operators=[], prefix_operators=[], qualifier=ApiException.Type, selectors=[]), MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApiException, 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] Keyword[boolean] identifier[getBooleanParam] operator[SEP] identifier[JSONObject] identifier[params] , identifier[String] identifier[paramName] operator[SEP] Keyword[throws] identifier[ApiException] {
Keyword[if] operator[SEP] operator[!] identifier[params] operator[SEP] identifier[containsKey] operator[SEP] identifier[paramName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] identifier[ApiException] operator[SEP] identifier[Type] operator[SEP] identifier[MISSING_PARAMETER] , identifier[paramName] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[params] operator[SEP] identifier[getBoolean] operator[SEP] identifier[paramName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] identifier[ApiException] operator[SEP] identifier[Type] operator[SEP] identifier[ILLEGAL_PARAMETER] , identifier[paramName] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public boolean isSearchable() {
if (isIdProperty()) {
return true;
}
Indexed indexedAnnotation = getIndexAnnotation();
return indexedAnnotation != null && indexedAnnotation.searchable();
} | class class_name[name] begin[{]
method[isSearchable, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[call[.isIdProperty, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[Indexed], indexedAnnotation]
return[binary_operation[binary_operation[member[.indexedAnnotation], !=, literal[null]], &&, call[indexedAnnotation.searchable, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isSearchable] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isIdProperty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Indexed] identifier[indexedAnnotation] operator[=] identifier[getIndexAnnotation] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[indexedAnnotation] operator[!=] Other[null] operator[&&] identifier[indexedAnnotation] operator[SEP] identifier[searchable] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(DisableStageTransitionRequest disableStageTransitionRequest, ProtocolMarshaller protocolMarshaller) {
if (disableStageTransitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disableStageTransitionRequest.getPipelineName(), PIPELINENAME_BINDING);
protocolMarshaller.marshall(disableStageTransitionRequest.getStageName(), STAGENAME_BINDING);
protocolMarshaller.marshall(disableStageTransitionRequest.getTransitionType(), TRANSITIONTYPE_BINDING);
protocolMarshaller.marshall(disableStageTransitionRequest.getReason(), REASON_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[disableStageTransitionRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.disableStageTransitionRequest], ==, 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=getPipelineName, postfix_operators=[], prefix_operators=[], qualifier=disableStageTransitionRequest, selectors=[], type_arguments=None), MemberReference(member=PIPELINENAME_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=getStageName, postfix_operators=[], prefix_operators=[], qualifier=disableStageTransitionRequest, selectors=[], type_arguments=None), MemberReference(member=STAGENAME_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=getTransitionType, postfix_operators=[], prefix_operators=[], qualifier=disableStageTransitionRequest, selectors=[], type_arguments=None), MemberReference(member=TRANSITIONTYPE_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=getReason, postfix_operators=[], prefix_operators=[], qualifier=disableStageTransitionRequest, selectors=[], type_arguments=None), MemberReference(member=REASON_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[DisableStageTransitionRequest] identifier[disableStageTransitionRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[disableStageTransitionRequest] 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[disableStageTransitionRequest] operator[SEP] identifier[getPipelineName] operator[SEP] operator[SEP] , identifier[PIPELINENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[disableStageTransitionRequest] operator[SEP] identifier[getStageName] operator[SEP] operator[SEP] , identifier[STAGENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[disableStageTransitionRequest] operator[SEP] identifier[getTransitionType] operator[SEP] operator[SEP] , identifier[TRANSITIONTYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[disableStageTransitionRequest] operator[SEP] identifier[getReason] operator[SEP] operator[SEP] , identifier[REASON_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 boolean containsAll(K key, Collection<? extends V> values) {
return _getValues(key).containsAll(values);
} | class class_name[name] begin[{]
method[containsAll, return_type[type[boolean]], modifier[public], parameter[key, values]] begin[{]
return[call[._getValues, parameter[member[.key]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[containsAll] operator[SEP] identifier[K] identifier[key] , identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[V] operator[>] identifier[values] operator[SEP] {
Keyword[return] identifier[_getValues] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[containsAll] operator[SEP] identifier[values] operator[SEP] operator[SEP]
}
|
private void updateDeltaFieldConfig(String srcColumnName, String tgtColumnName) {
if (this.workUnitState.contains(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY)) {
String watermarkCol = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY);
this.workUnitState.setProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY,
watermarkCol.replaceAll(srcColumnName, tgtColumnName));
}
} | class class_name[name] begin[{]
method[updateDeltaFieldConfig, return_type[void], modifier[private], parameter[srcColumnName, tgtColumnName]] begin[{]
if[THIS[member[None.workUnitState]call[None.contains, parameter[member[ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY]]]]] begin[{]
local_variable[type[String], watermarkCol]
THIS[member[None.workUnitState]call[None.setProp, parameter[member[ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY], call[watermarkCol.replaceAll, parameter[member[.srcColumnName], member[.tgtColumnName]]]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateDeltaFieldConfig] operator[SEP] identifier[String] identifier[srcColumnName] , identifier[String] identifier[tgtColumnName] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[workUnitState] operator[SEP] identifier[contains] operator[SEP] identifier[ConfigurationKeys] operator[SEP] identifier[EXTRACT_DELTA_FIELDS_KEY] operator[SEP] operator[SEP] {
identifier[String] identifier[watermarkCol] operator[=] Keyword[this] operator[SEP] identifier[workUnitState] operator[SEP] identifier[getProp] operator[SEP] identifier[ConfigurationKeys] operator[SEP] identifier[EXTRACT_DELTA_FIELDS_KEY] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[workUnitState] operator[SEP] identifier[setProp] operator[SEP] identifier[ConfigurationKeys] operator[SEP] identifier[EXTRACT_DELTA_FIELDS_KEY] , identifier[watermarkCol] operator[SEP] identifier[replaceAll] operator[SEP] identifier[srcColumnName] , identifier[tgtColumnName] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <T> RateLimiterOperator<T> of(RateLimiter rateLimiter) {
return of(rateLimiter, Schedulers.parallel());
} | class class_name[name] begin[{]
method[of, return_type[type[RateLimiterOperator]], modifier[public static], parameter[rateLimiter]] begin[{]
return[call[.of, parameter[member[.rateLimiter], call[Schedulers.parallel, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[RateLimiterOperator] operator[<] identifier[T] operator[>] identifier[of] operator[SEP] identifier[RateLimiter] identifier[rateLimiter] operator[SEP] {
Keyword[return] identifier[of] operator[SEP] identifier[rateLimiter] , identifier[Schedulers] operator[SEP] identifier[parallel] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final ChannelInitializer<Channel> httpServer(
final SimpleChannelInboundHandler<HttpRequest> handler) {
Preconditions.checkArgument(handler.isSharable());
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("httpCodec", new HttpServerCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
pipeline.addLast("httpServerHandler", handler);
}
};
} | class class_name[name] begin[{]
method[httpServer, return_type[type[ChannelInitializer]], modifier[final public static], parameter[handler]] begin[{]
call[Preconditions.checkArgument, parameter[call[handler.isSharable, parameter[]]]]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=pipeline, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None), name=pipeline)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelPipeline, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="httpCodec"), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpServerCodec, sub_type=None))], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=pipeline, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="aggregator"), ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=*), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=*)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpObjectAggregator, sub_type=None))], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=pipeline, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="httpServerHandler"), MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=pipeline, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'protected'}, name=initChannel, parameters=[FormalParameter(annotations=[], modifiers=set(), name=channel, type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None), varargs=False)], return_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=Channel, sub_type=None))], dimensions=None, name=ChannelInitializer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[ChannelInitializer] operator[<] identifier[Channel] operator[>] identifier[httpServer] operator[SEP] Keyword[final] identifier[SimpleChannelInboundHandler] operator[<] identifier[HttpRequest] operator[>] identifier[handler] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[handler] operator[SEP] identifier[isSharable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ChannelInitializer] operator[<] identifier[Channel] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[initChannel] operator[SEP] identifier[Channel] identifier[channel] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ChannelPipeline] identifier[pipeline] operator[=] identifier[channel] operator[SEP] identifier[pipeline] operator[SEP] operator[SEP] operator[SEP] identifier[pipeline] operator[SEP] identifier[addLast] operator[SEP] literal[String] , Keyword[new] identifier[HttpServerCodec] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pipeline] operator[SEP] identifier[addLast] operator[SEP] literal[String] , Keyword[new] identifier[HttpObjectAggregator] operator[SEP] Other[10] operator[*] Other[1024] operator[*] Other[1024] operator[SEP] operator[SEP] operator[SEP] identifier[pipeline] operator[SEP] identifier[addLast] operator[SEP] literal[String] , identifier[handler] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
@Override
public RequestDispatcher getRequestDispatcher(String arg0) {
try {
collaborator.preInvoke(componentMetaData);
return request.getRequestDispatcher(arg0);
} finally {
collaborator.postInvoke();
}
} | class class_name[name] begin[{]
method[getRequestDispatcher, return_type[type[RequestDispatcher]], modifier[public], parameter[arg0]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=componentMetaData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=preInvoke, postfix_operators=[], prefix_operators=[], qualifier=collaborator, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=arg0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRequestDispatcher, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=postInvoke, postfix_operators=[], prefix_operators=[], qualifier=collaborator, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RequestDispatcher] identifier[getRequestDispatcher] operator[SEP] identifier[String] identifier[arg0] operator[SEP] {
Keyword[try] {
identifier[collaborator] operator[SEP] identifier[preInvoke] operator[SEP] identifier[componentMetaData] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP] identifier[getRequestDispatcher] operator[SEP] identifier[arg0] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[collaborator] operator[SEP] identifier[postInvoke] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static FileSystemBinaryStore create( File directory, File trash ) {
String key = directory.getAbsolutePath();
FileSystemBinaryStore store = INSTANCES.get(key);
if (store == null) {
store = trash != null ? new FileSystemBinaryStore(directory, trash) : new FileSystemBinaryStore(directory);
FileSystemBinaryStore existing = INSTANCES.putIfAbsent(key, store);
if (existing != null) {
store = existing;
}
}
return store;
} | class class_name[name] begin[{]
method[create, return_type[type[FileSystemBinaryStore]], modifier[public static], parameter[directory, trash]] begin[{]
local_variable[type[String], key]
local_variable[type[FileSystemBinaryStore], store]
if[binary_operation[member[.store], ==, literal[null]]] begin[{]
assign[member[.store], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=trash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=ClassCreator(arguments=[MemberReference(member=directory, 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=FileSystemBinaryStore, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=directory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trash, 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=FileSystemBinaryStore, sub_type=None)))]
local_variable[type[FileSystemBinaryStore], existing]
if[binary_operation[member[.existing], !=, literal[null]]] begin[{]
assign[member[.store], member[.existing]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.store]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FileSystemBinaryStore] identifier[create] operator[SEP] identifier[File] identifier[directory] , identifier[File] identifier[trash] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[directory] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] identifier[FileSystemBinaryStore] identifier[store] operator[=] identifier[INSTANCES] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[store] operator[==] Other[null] operator[SEP] {
identifier[store] operator[=] identifier[trash] operator[!=] Other[null] operator[?] Keyword[new] identifier[FileSystemBinaryStore] operator[SEP] identifier[directory] , identifier[trash] operator[SEP] operator[:] Keyword[new] identifier[FileSystemBinaryStore] operator[SEP] identifier[directory] operator[SEP] operator[SEP] identifier[FileSystemBinaryStore] identifier[existing] operator[=] identifier[INSTANCES] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[key] , identifier[store] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existing] operator[!=] Other[null] operator[SEP] {
identifier[store] operator[=] identifier[existing] operator[SEP]
}
}
Keyword[return] identifier[store] operator[SEP]
}
|
public boolean couldHaveCallback(final String name) {
final Boolean has = hasHandlerMap.get(name);
if (has == null) {
return true;
}
return has;
} | class class_name[name] begin[{]
method[couldHaveCallback, return_type[type[boolean]], modifier[public], parameter[name]] begin[{]
local_variable[type[Boolean], has]
if[binary_operation[member[.has], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[member[.has]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[couldHaveCallback] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[final] identifier[Boolean] identifier[has] operator[=] identifier[hasHandlerMap] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[has] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[has] operator[SEP]
}
|
protected final void init(I inboundHandler, O outboundHandler) {
validate(inboundHandler, outboundHandler);
this.inboundHandler = inboundHandler;
this.outboundHandler = outboundHandler;
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[final protected], parameter[inboundHandler, outboundHandler]] begin[{]
call[.validate, parameter[member[.inboundHandler], member[.outboundHandler]]]
assign[THIS[member[None.inboundHandler]], member[.inboundHandler]]
assign[THIS[member[None.outboundHandler]], member[.outboundHandler]]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[void] identifier[init] operator[SEP] identifier[I] identifier[inboundHandler] , identifier[O] identifier[outboundHandler] operator[SEP] {
identifier[validate] operator[SEP] identifier[inboundHandler] , identifier[outboundHandler] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[inboundHandler] operator[=] identifier[inboundHandler] operator[SEP] Keyword[this] operator[SEP] identifier[outboundHandler] operator[=] identifier[outboundHandler] operator[SEP]
}
|
@Override
public String addEmpty() {
CommonModel entity =createModel();
entity.initNew();
mDao.insert(entity);
return entity.getId();
} | class class_name[name] begin[{]
method[addEmpty, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[CommonModel], entity]
call[entity.initNew, parameter[]]
call[mDao.insert, parameter[member[.entity]]]
return[call[entity.getId, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[addEmpty] operator[SEP] operator[SEP] {
identifier[CommonModel] identifier[entity] operator[=] identifier[createModel] operator[SEP] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[initNew] operator[SEP] operator[SEP] operator[SEP] identifier[mDao] operator[SEP] identifier[insert] operator[SEP] identifier[entity] operator[SEP] operator[SEP] Keyword[return] identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setBah(ByteArrayHolder bah, ObjectPool<ByteArrayHolder> pool) {
this.bah = bah;
this.pool = pool;
} | class class_name[name] begin[{]
method[setBah, return_type[void], modifier[public], parameter[bah, pool]] begin[{]
assign[THIS[member[None.bah]], member[.bah]]
assign[THIS[member[None.pool]], member[.pool]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBah] operator[SEP] identifier[ByteArrayHolder] identifier[bah] , identifier[ObjectPool] operator[<] identifier[ByteArrayHolder] operator[>] identifier[pool] operator[SEP] {
Keyword[this] operator[SEP] identifier[bah] operator[=] identifier[bah] operator[SEP] Keyword[this] operator[SEP] identifier[pool] operator[=] identifier[pool] operator[SEP]
}
|
public Targeting addAttributes(String attributeName, String attributeValue){
attributesMap.put(attributeName,attributeValue);
return this;
} | class class_name[name] begin[{]
method[addAttributes, return_type[type[Targeting]], modifier[public], parameter[attributeName, attributeValue]] begin[{]
call[attributesMap.put, parameter[member[.attributeName], member[.attributeValue]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Targeting] identifier[addAttributes] operator[SEP] identifier[String] identifier[attributeName] , identifier[String] identifier[attributeValue] operator[SEP] {
identifier[attributesMap] operator[SEP] identifier[put] operator[SEP] identifier[attributeName] , identifier[attributeValue] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static void parse(
final String pattern, final List patternConverters,
final List formattingInfos, final Map converterRegistry, final Map rules) {
if (pattern == null) {
throw new NullPointerException("pattern");
}
StringBuffer currentLiteral = new StringBuffer(32);
int patternLength = pattern.length();
int state = LITERAL_STATE;
char c;
int i = 0;
ExtrasFormattingInfo formattingInfo = ExtrasFormattingInfo.getDefault();
while (i < patternLength) {
c = pattern.charAt(i++);
switch (state) {
case LITERAL_STATE:
// In literal state, the last char is always a literal.
if (i == patternLength) {
currentLiteral.append(c);
continue;
}
if (c == ESCAPE_CHAR) {
// peek at the next char.
switch (pattern.charAt(i)) {
case ESCAPE_CHAR:
currentLiteral.append(c);
i++; // move pointer
break;
default:
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString()));
formattingInfos.add(ExtrasFormattingInfo.getDefault());
}
currentLiteral.setLength(0);
currentLiteral.append(c); // append %
state = CONVERTER_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
}
} else {
currentLiteral.append(c);
}
break;
case CONVERTER_STATE:
currentLiteral.append(c);
switch (c) {
case '-':
formattingInfo =
new ExtrasFormattingInfo(
true,
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '!':
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
true,
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '.':
state = DOT_STATE;
break;
default:
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
c - '0',
formattingInfo.getMaxLength());
state = MIN_STATE;
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
// Next pattern is assumed to be a literal.
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
} // switch
break;
case MIN_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
(formattingInfo.getMinLength() * 10) + (c - '0'),
formattingInfo.getMaxLength());
} else if (c == '.') {
state = DOT_STATE;
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
break;
case DOT_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
c - '0');
state = MAX_STATE;
} else {
LogLog.error(
"Error occured in position " + i
+ ".\n Was expecting digit, instead got char \"" + c + "\".");
state = LITERAL_STATE;
}
break;
case MAX_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
(formattingInfo.getMaxLength() * 10) + (c - '0'));
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
break;
} // switch
}
// while
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString()));
formattingInfos.add(ExtrasFormattingInfo.getDefault());
}
} | class class_name[name] begin[{]
method[parse, return_type[void], modifier[public static], parameter[pattern, patternConverters, formattingInfos, converterRegistry, rules]] begin[{]
if[binary_operation[member[.pattern], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="pattern")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[StringBuffer], currentLiteral]
local_variable[type[int], patternLength]
local_variable[type[int], state]
local_variable[type[char], c]
local_variable[type[int], i]
local_variable[type[ExtrasFormattingInfo], formattingInfo]
while[binary_operation[member[.i], <, member[.patternLength]]] begin[{]
assign[member[.c], call[pattern.charAt, parameter[member[.i]]]]
SwitchStatement(cases=[SwitchStatementCase(case=['LITERAL_STATE'], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=patternLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ESCAPE_CHAR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=['ESCAPE_CHAR'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LiteralPatternConverter, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=patternConverters, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=ExtrasFormattingInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=formattingInfos, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=CONVERTER_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=ExtrasFormattingInfo, selectors=[], type_arguments=None)), label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CONVERTER_STATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MethodInvocation(arguments=[], member=isRightTruncated, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMinLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMaxLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='!')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isLeftAligned, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MethodInvocation(arguments=[], member=getMinLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMaxLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=DOT_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentLiteral, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=converterRegistry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=patternConverters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=finalizeConverter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=LITERAL_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=ExtrasFormattingInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isLeftAligned, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isRightTruncated, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-), MethodInvocation(arguments=[], member=getMaxLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=MIN_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MIN_STATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.'), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentLiteral, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=converterRegistry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=patternConverters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=finalizeConverter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=LITERAL_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=ExtrasFormattingInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=DOT_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isLeftAligned, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isRightTruncated, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMinLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-), operator=+), MethodInvocation(arguments=[], member=getMaxLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DOT_STATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error occured in position "), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".\n Was expecting digit, instead got char \""), operator=+), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\"."), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LogLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=LITERAL_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isLeftAligned, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isRightTruncated, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMinLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=MAX_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MAX_STATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentLiteral, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=converterRegistry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=patternConverters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formattingInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=finalizeConverter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=LITERAL_STATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=ExtrasFormattingInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=formattingInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isLeftAligned, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isRightTruncated, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMinLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMaxLength, postfix_operators=[], prefix_operators=[], qualifier=formattingInfo, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtrasFormattingInfo, sub_type=None))), label=None)])), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
if[binary_operation[call[currentLiteral.length, parameter[]], !=, literal[0]]] begin[{]
call[patternConverters.add, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=currentLiteral, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LiteralPatternConverter, sub_type=None))]]
call[formattingInfos.add, parameter[call[ExtrasFormattingInfo.getDefault, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[parse] operator[SEP] Keyword[final] identifier[String] identifier[pattern] , Keyword[final] identifier[List] identifier[patternConverters] , Keyword[final] identifier[List] identifier[formattingInfos] , Keyword[final] identifier[Map] identifier[converterRegistry] , Keyword[final] identifier[Map] identifier[rules] operator[SEP] {
Keyword[if] operator[SEP] identifier[pattern] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[StringBuffer] identifier[currentLiteral] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[32] operator[SEP] operator[SEP] Keyword[int] identifier[patternLength] operator[=] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[state] operator[=] identifier[LITERAL_STATE] operator[SEP] Keyword[char] identifier[c] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[ExtrasFormattingInfo] identifier[formattingInfo] operator[=] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[<] identifier[patternLength] operator[SEP] {
identifier[c] operator[=] identifier[pattern] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[++] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[state] operator[SEP] {
Keyword[case] identifier[LITERAL_STATE] operator[:] Keyword[if] operator[SEP] identifier[i] operator[==] identifier[patternLength] operator[SEP] {
identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[c] operator[==] identifier[ESCAPE_CHAR] operator[SEP] {
Keyword[switch] operator[SEP] identifier[pattern] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[case] identifier[ESCAPE_CHAR] operator[:] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[patternConverters] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[LiteralPatternConverter] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[formattingInfos] operator[SEP] identifier[add] operator[SEP] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[currentLiteral] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[CONVERTER_STATE] operator[SEP] identifier[formattingInfo] operator[=] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[CONVERTER_STATE] operator[:] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] literal[boolean] , identifier[formattingInfo] operator[SEP] identifier[isRightTruncated] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMinLength] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] identifier[formattingInfo] operator[SEP] identifier[isLeftAligned] operator[SEP] operator[SEP] , literal[boolean] , identifier[formattingInfo] operator[SEP] identifier[getMinLength] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[state] operator[=] identifier[DOT_STATE] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] operator[SEP] identifier[c] operator[>=] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[c] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] identifier[formattingInfo] operator[SEP] identifier[isLeftAligned] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[isRightTruncated] operator[SEP] operator[SEP] , identifier[c] operator[-] literal[String] , identifier[formattingInfo] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[MIN_STATE] operator[SEP]
}
Keyword[else] {
identifier[i] operator[=] identifier[finalizeConverter] operator[SEP] identifier[c] , identifier[pattern] , identifier[i] , identifier[currentLiteral] , identifier[formattingInfo] , identifier[converterRegistry] , identifier[rules] , identifier[patternConverters] , identifier[formattingInfos] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[LITERAL_STATE] operator[SEP] identifier[formattingInfo] operator[=] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[case] identifier[MIN_STATE] operator[:] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c] operator[>=] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[c] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] identifier[formattingInfo] operator[SEP] identifier[isLeftAligned] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[isRightTruncated] operator[SEP] operator[SEP] , operator[SEP] identifier[formattingInfo] operator[SEP] identifier[getMinLength] operator[SEP] operator[SEP] operator[*] Other[10] operator[SEP] operator[+] operator[SEP] identifier[c] operator[-] literal[String] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[state] operator[=] identifier[DOT_STATE] operator[SEP]
}
Keyword[else] {
identifier[i] operator[=] identifier[finalizeConverter] operator[SEP] identifier[c] , identifier[pattern] , identifier[i] , identifier[currentLiteral] , identifier[formattingInfo] , identifier[converterRegistry] , identifier[rules] , identifier[patternConverters] , identifier[formattingInfos] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[LITERAL_STATE] operator[SEP] identifier[formattingInfo] operator[=] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[DOT_STATE] operator[:] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c] operator[>=] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[c] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] identifier[formattingInfo] operator[SEP] identifier[isLeftAligned] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[isRightTruncated] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMinLength] operator[SEP] operator[SEP] , identifier[c] operator[-] literal[String] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[MAX_STATE] operator[SEP]
}
Keyword[else] {
identifier[LogLog] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[i] operator[+] literal[String] operator[+] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[LITERAL_STATE] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[MAX_STATE] operator[:] identifier[currentLiteral] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c] operator[>=] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[c] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[formattingInfo] operator[=] Keyword[new] identifier[ExtrasFormattingInfo] operator[SEP] identifier[formattingInfo] operator[SEP] identifier[isLeftAligned] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[isRightTruncated] operator[SEP] operator[SEP] , identifier[formattingInfo] operator[SEP] identifier[getMinLength] operator[SEP] operator[SEP] , operator[SEP] identifier[formattingInfo] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[*] Other[10] operator[SEP] operator[+] operator[SEP] identifier[c] operator[-] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[i] operator[=] identifier[finalizeConverter] operator[SEP] identifier[c] , identifier[pattern] , identifier[i] , identifier[currentLiteral] , identifier[formattingInfo] , identifier[converterRegistry] , identifier[rules] , identifier[patternConverters] , identifier[formattingInfos] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[LITERAL_STATE] operator[SEP] identifier[formattingInfo] operator[=] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[patternConverters] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[LiteralPatternConverter] operator[SEP] identifier[currentLiteral] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[formattingInfos] operator[SEP] identifier[add] operator[SEP] identifier[ExtrasFormattingInfo] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public java.lang.String getCodeBucket() {
java.lang.Object ref = codeBucket_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
codeBucket_ = s;
return s;
}
} | class class_name[name] begin[{]
method[getCodeBucket, return_type[type[java]], modifier[public], parameter[]] begin[{]
local_variable[type[java], ref]
if[binary_operation[member[.ref], instanceof, type[java]]] begin[{]
return[Cast(expression=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))))]
else begin[{]
local_variable[type[com], bs]
local_variable[type[java], s]
assign[member[.codeBucket_], member[.s]]
return[member[.s]]
end[}]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[getCodeBucket] operator[SEP] operator[SEP] {
identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Object] identifier[ref] operator[=] identifier[codeBucket_] operator[SEP] Keyword[if] operator[SEP] identifier[ref] Keyword[instanceof] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] {
Keyword[return] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] identifier[ref] operator[SEP]
}
Keyword[else] {
identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] identifier[bs] operator[=] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] operator[SEP] identifier[ref] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[s] operator[=] identifier[bs] operator[SEP] identifier[toStringUtf8] operator[SEP] operator[SEP] operator[SEP] identifier[codeBucket_] operator[=] identifier[s] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
}
|
public List<ColumnResult<ConstructorResult<T>>> getAllColumn()
{
List<ColumnResult<ConstructorResult<T>>> list = new ArrayList<ColumnResult<ConstructorResult<T>>>();
List<Node> nodeList = childNode.get("column");
for(Node node: nodeList)
{
ColumnResult<ConstructorResult<T>> type = new ColumnResultImpl<ConstructorResult<T>>(this, "column", childNode, node);
list.add(type);
}
return list;
} | class class_name[name] begin[{]
method[getAllColumn, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[List], nodeList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="column"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ConstructorResult, sub_type=None))], dimensions=None, name=ColumnResultImpl, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ConstructorResult, sub_type=None))], dimensions=[], name=ColumnResult, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[ColumnResult] operator[<] identifier[ConstructorResult] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[getAllColumn] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[ColumnResult] operator[<] identifier[ConstructorResult] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ColumnResult] operator[<] identifier[ConstructorResult] operator[<] identifier[T] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[node] operator[:] identifier[nodeList] operator[SEP] {
identifier[ColumnResult] operator[<] identifier[ConstructorResult] operator[<] identifier[T] operator[>] operator[>] identifier[type] operator[=] Keyword[new] identifier[ColumnResultImpl] operator[<] identifier[ConstructorResult] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[node] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public static MuxerFormat getFormat(int index) {
long cPtr = VideoJNI.MuxerFormat_getFormat(index);
return (cPtr == 0) ? null : new MuxerFormat(cPtr, false);
} | class class_name[name] begin[{]
method[getFormat, return_type[type[MuxerFormat]], modifier[public static], parameter[index]] begin[{]
local_variable[type[long], cPtr]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=cPtr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=ClassCreator(arguments=[MemberReference(member=cPtr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MuxerFormat, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MuxerFormat] identifier[getFormat] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[long] identifier[cPtr] operator[=] identifier[VideoJNI] operator[SEP] identifier[MuxerFormat_getFormat] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[cPtr] operator[==] Other[0] operator[SEP] operator[?] Other[null] operator[:] Keyword[new] identifier[MuxerFormat] operator[SEP] identifier[cPtr] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public boolean comparingNames(String name, String otherName) {
for (String word : getNormalizeName(name).split(" ")) {
if (!StringUtils.containsIgnoreCase(getNormalizeName(otherName).trim(), word)) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[comparingNames, return_type[type[boolean]], modifier[public], parameter[name, otherName]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=otherName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNormalizeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsIgnoreCase, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNormalizeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=split, 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=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[comparingNames] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[otherName] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[word] operator[:] identifier[getNormalizeName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[getNormalizeName] operator[SEP] identifier[otherName] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] , identifier[word] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void cancel(String[] protocol, int[] reasonCode, String[] reasonText) {
if(ackReceived)
throw new IllegalStateException("There has been an ACK received. Can not cancel more brnaches, the INVITE tx has finished.");
cancelAllExcept(null, protocol, reasonCode, reasonText, true);
} | class class_name[name] begin[{]
method[cancel, return_type[void], modifier[public], parameter[protocol, reasonCode, reasonText]] begin[{]
if[member[.ackReceived]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There has been an ACK received. Can not cancel more brnaches, the INVITE tx has finished.")], 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[.cancelAllExcept, parameter[literal[null], member[.protocol], member[.reasonCode], member[.reasonText], literal[true]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[cancel] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[protocol] , Keyword[int] operator[SEP] operator[SEP] identifier[reasonCode] , identifier[String] operator[SEP] operator[SEP] identifier[reasonText] operator[SEP] {
Keyword[if] operator[SEP] identifier[ackReceived] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[cancelAllExcept] operator[SEP] Other[null] , identifier[protocol] , identifier[reasonCode] , identifier[reasonText] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteClusterRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteClusterRequest.getClusterId(), CLUSTERID_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[deleteClusterRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteClusterRequest], ==, 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=getClusterId, postfix_operators=[], prefix_operators=[], qualifier=deleteClusterRequest, selectors=[], type_arguments=None), MemberReference(member=CLUSTERID_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[DeleteClusterRequest] identifier[deleteClusterRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteClusterRequest] 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[deleteClusterRequest] operator[SEP] identifier[getClusterId] operator[SEP] operator[SEP] , identifier[CLUSTERID_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 <T> T[] validIndex(final T[] array, final int index, final String message) {
return INSTANCE.validIndex(array, index, message);
} | class class_name[name] begin[{]
method[validIndex, return_type[type[T]], modifier[public static], parameter[array, index, message]] begin[{]
return[call[INSTANCE.validIndex, parameter[member[.array], member[.index], member[.message]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[validIndex] operator[SEP] Keyword[final] identifier[T] operator[SEP] operator[SEP] identifier[array] , Keyword[final] Keyword[int] identifier[index] , Keyword[final] identifier[String] identifier[message] operator[SEP] {
Keyword[return] identifier[INSTANCE] operator[SEP] identifier[validIndex] operator[SEP] identifier[array] , identifier[index] , identifier[message] operator[SEP] operator[SEP]
}
|
void removeGuardParameters( Map<String, Expression> parameters ) {
if( parameters != null ) {
removeMixin();
}
isGuard = false;
} | class class_name[name] begin[{]
method[removeGuardParameters, return_type[void], modifier[default], parameter[parameters]] begin[{]
if[binary_operation[member[.parameters], !=, literal[null]]] begin[{]
call[.removeMixin, parameter[]]
else begin[{]
None
end[}]
assign[member[.isGuard], literal[false]]
end[}]
END[}] | Keyword[void] identifier[removeGuardParameters] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Expression] operator[>] identifier[parameters] operator[SEP] {
Keyword[if] operator[SEP] identifier[parameters] operator[!=] Other[null] operator[SEP] {
identifier[removeMixin] operator[SEP] operator[SEP] operator[SEP]
}
identifier[isGuard] operator[=] literal[boolean] operator[SEP]
}
|
public void putLong(int pos, long l) {
adaptSize(pos + 8);
ByteBuffer bb = getBuffer(pos);
int index = pos % _bufferSize;
if (bb.limit() - index >= 8) {
bb.putLong(index, l);
} else {
byte b0 = (byte)l;
byte b1 = (byte)(l >> 8);
byte b2 = (byte)(l >> 16);
byte b3 = (byte)(l >> 24);
byte b4 = (byte)(l >> 32);
byte b5 = (byte)(l >> 40);
byte b6 = (byte)(l >> 48);
byte b7 = (byte)(l >> 56);
if (_order == ByteOrder.BIG_ENDIAN) {
putBytes(pos, b7, b6, b5, b4, b3, b2, b1, b0);
} else {
putBytes(pos, b0, b1, b2, b3, b4, b5, b6, b7);
}
}
} | class class_name[name] begin[{]
method[putLong, return_type[void], modifier[public], parameter[pos, l]] begin[{]
call[.adaptSize, parameter[binary_operation[member[.pos], +, literal[8]]]]
local_variable[type[ByteBuffer], bb]
local_variable[type[int], index]
if[binary_operation[binary_operation[call[bb.limit, parameter[]], -, member[.index]], >=, literal[8]]] begin[{]
call[bb.putLong, parameter[member[.index], member[.l]]]
else begin[{]
local_variable[type[byte], b0]
local_variable[type[byte], b1]
local_variable[type[byte], b2]
local_variable[type[byte], b3]
local_variable[type[byte], b4]
local_variable[type[byte], b5]
local_variable[type[byte], b6]
local_variable[type[byte], b7]
if[binary_operation[member[._order], ==, member[ByteOrder.BIG_ENDIAN]]] begin[{]
call[.putBytes, parameter[member[.pos], member[.b7], member[.b6], member[.b5], member[.b4], member[.b3], member[.b2], member[.b1], member[.b0]]]
else begin[{]
call[.putBytes, parameter[member[.pos], member[.b0], member[.b1], member[.b2], member[.b3], member[.b4], member[.b5], member[.b6], member[.b7]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[putLong] operator[SEP] Keyword[int] identifier[pos] , Keyword[long] identifier[l] operator[SEP] {
identifier[adaptSize] operator[SEP] identifier[pos] operator[+] Other[8] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[bb] operator[=] identifier[getBuffer] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[pos] operator[%] identifier[_bufferSize] operator[SEP] Keyword[if] operator[SEP] identifier[bb] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[-] identifier[index] operator[>=] Other[8] operator[SEP] {
identifier[bb] operator[SEP] identifier[putLong] operator[SEP] identifier[index] , identifier[l] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[byte] identifier[b0] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[l] operator[SEP] Keyword[byte] identifier[b1] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] Keyword[byte] identifier[b2] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] Keyword[byte] identifier[b3] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[24] operator[SEP] operator[SEP] Keyword[byte] identifier[b4] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[32] operator[SEP] operator[SEP] Keyword[byte] identifier[b5] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[40] operator[SEP] operator[SEP] Keyword[byte] identifier[b6] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[48] operator[SEP] operator[SEP] Keyword[byte] identifier[b7] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[l] operator[>] operator[>] Other[56] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_order] operator[==] identifier[ByteOrder] operator[SEP] identifier[BIG_ENDIAN] operator[SEP] {
identifier[putBytes] operator[SEP] identifier[pos] , identifier[b7] , identifier[b6] , identifier[b5] , identifier[b4] , identifier[b3] , identifier[b2] , identifier[b1] , identifier[b0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[putBytes] operator[SEP] identifier[pos] , identifier[b0] , identifier[b1] , identifier[b2] , identifier[b3] , identifier[b4] , identifier[b5] , identifier[b6] , identifier[b7] operator[SEP] operator[SEP]
}
}
}
|
@SuppressWarnings("rawtypes")
protected void setupCredentials(GitCommand<?> command) {
GitSettings settings = lookupSettings();
if (settings != null && command instanceof TransportCommand) {
TransportCommand cmd = (TransportCommand) command;
cmd.setCredentialsProvider(settings.getCredentials());
}
} | class class_name[name] begin[{]
method[setupCredentials, return_type[void], modifier[protected], parameter[command]] begin[{]
local_variable[type[GitSettings], settings]
if[binary_operation[binary_operation[member[.settings], !=, literal[null]], &&, binary_operation[member[.command], instanceof, type[TransportCommand]]]] begin[{]
local_variable[type[TransportCommand], cmd]
call[cmd.setCredentialsProvider, parameter[call[settings.getCredentials, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[void] identifier[setupCredentials] operator[SEP] identifier[GitCommand] operator[<] operator[?] operator[>] identifier[command] operator[SEP] {
identifier[GitSettings] identifier[settings] operator[=] identifier[lookupSettings] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[settings] operator[!=] Other[null] operator[&&] identifier[command] Keyword[instanceof] identifier[TransportCommand] operator[SEP] {
identifier[TransportCommand] identifier[cmd] operator[=] operator[SEP] identifier[TransportCommand] operator[SEP] identifier[command] operator[SEP] identifier[cmd] operator[SEP] identifier[setCredentialsProvider] operator[SEP] identifier[settings] operator[SEP] identifier[getCredentials] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static int orientationRobust(Point2D p, Point2D q, Point2D r) {
ECoordinate det_ec = new ECoordinate();
det_ec.set(q.x);
det_ec.sub(p.x);
ECoordinate rp_y_ec = new ECoordinate();
rp_y_ec.set(r.y);
rp_y_ec.sub(p.y);
ECoordinate qp_y_ec = new ECoordinate();
qp_y_ec.set(q.y);
qp_y_ec.sub(p.y);
ECoordinate rp_x_ec = new ECoordinate();
rp_x_ec.set(r.x);
rp_x_ec.sub(p.x);
det_ec.mul(rp_y_ec);
qp_y_ec.mul(rp_x_ec);
det_ec.sub(qp_y_ec);
if (!det_ec.isFuzzyZero()) {
double det_ec_value = det_ec.value();
if (det_ec_value < 0.0)
return -1;
if (det_ec_value > 0.0)
return 1;
return 0;
}
// Need extended precision
BigDecimal det_mp = new BigDecimal(q.x);
BigDecimal px_mp = new BigDecimal(p.x);
BigDecimal py_mp = new BigDecimal(p.y);
det_mp = det_mp.subtract(px_mp);
BigDecimal rp_y_mp = new BigDecimal(r.y);
rp_y_mp = rp_y_mp.subtract(py_mp);
BigDecimal qp_y_mp = new BigDecimal(q.y);
qp_y_mp = qp_y_mp.subtract(py_mp);
BigDecimal rp_x_mp = new BigDecimal(r.x);
rp_x_mp = rp_x_mp.subtract(px_mp);
det_mp = det_mp.multiply(rp_y_mp);
qp_y_mp = qp_y_mp.multiply(rp_x_mp);
det_mp = det_mp.subtract(qp_y_mp);
return det_mp.signum();
} | class class_name[name] begin[{]
method[orientationRobust, return_type[type[int]], modifier[public static], parameter[p, q, r]] begin[{]
local_variable[type[ECoordinate], det_ec]
call[det_ec.set, parameter[member[q.x]]]
call[det_ec.sub, parameter[member[p.x]]]
local_variable[type[ECoordinate], rp_y_ec]
call[rp_y_ec.set, parameter[member[r.y]]]
call[rp_y_ec.sub, parameter[member[p.y]]]
local_variable[type[ECoordinate], qp_y_ec]
call[qp_y_ec.set, parameter[member[q.y]]]
call[qp_y_ec.sub, parameter[member[p.y]]]
local_variable[type[ECoordinate], rp_x_ec]
call[rp_x_ec.set, parameter[member[r.x]]]
call[rp_x_ec.sub, parameter[member[p.x]]]
call[det_ec.mul, parameter[member[.rp_y_ec]]]
call[qp_y_ec.mul, parameter[member[.rp_x_ec]]]
call[det_ec.sub, parameter[member[.qp_y_ec]]]
if[call[det_ec.isFuzzyZero, parameter[]]] begin[{]
local_variable[type[double], det_ec_value]
if[binary_operation[member[.det_ec_value], <, literal[0.0]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
if[binary_operation[member[.det_ec_value], >, literal[0.0]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[BigDecimal], det_mp]
local_variable[type[BigDecimal], px_mp]
local_variable[type[BigDecimal], py_mp]
assign[member[.det_mp], call[det_mp.subtract, parameter[member[.px_mp]]]]
local_variable[type[BigDecimal], rp_y_mp]
assign[member[.rp_y_mp], call[rp_y_mp.subtract, parameter[member[.py_mp]]]]
local_variable[type[BigDecimal], qp_y_mp]
assign[member[.qp_y_mp], call[qp_y_mp.subtract, parameter[member[.py_mp]]]]
local_variable[type[BigDecimal], rp_x_mp]
assign[member[.rp_x_mp], call[rp_x_mp.subtract, parameter[member[.px_mp]]]]
assign[member[.det_mp], call[det_mp.multiply, parameter[member[.rp_y_mp]]]]
assign[member[.qp_y_mp], call[qp_y_mp.multiply, parameter[member[.rp_x_mp]]]]
assign[member[.det_mp], call[det_mp.subtract, parameter[member[.qp_y_mp]]]]
return[call[det_mp.signum, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[orientationRobust] operator[SEP] identifier[Point2D] identifier[p] , identifier[Point2D] identifier[q] , identifier[Point2D] identifier[r] operator[SEP] {
identifier[ECoordinate] identifier[det_ec] operator[=] Keyword[new] identifier[ECoordinate] operator[SEP] operator[SEP] operator[SEP] identifier[det_ec] operator[SEP] identifier[set] operator[SEP] identifier[q] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[det_ec] operator[SEP] identifier[sub] operator[SEP] identifier[p] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[ECoordinate] identifier[rp_y_ec] operator[=] Keyword[new] identifier[ECoordinate] operator[SEP] operator[SEP] operator[SEP] identifier[rp_y_ec] operator[SEP] identifier[set] operator[SEP] identifier[r] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[rp_y_ec] operator[SEP] identifier[sub] operator[SEP] identifier[p] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[ECoordinate] identifier[qp_y_ec] operator[=] Keyword[new] identifier[ECoordinate] operator[SEP] operator[SEP] operator[SEP] identifier[qp_y_ec] operator[SEP] identifier[set] operator[SEP] identifier[q] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[qp_y_ec] operator[SEP] identifier[sub] operator[SEP] identifier[p] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[ECoordinate] identifier[rp_x_ec] operator[=] Keyword[new] identifier[ECoordinate] operator[SEP] operator[SEP] operator[SEP] identifier[rp_x_ec] operator[SEP] identifier[set] operator[SEP] identifier[r] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[rp_x_ec] operator[SEP] identifier[sub] operator[SEP] identifier[p] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[det_ec] operator[SEP] identifier[mul] operator[SEP] identifier[rp_y_ec] operator[SEP] operator[SEP] identifier[qp_y_ec] operator[SEP] identifier[mul] operator[SEP] identifier[rp_x_ec] operator[SEP] operator[SEP] identifier[det_ec] operator[SEP] identifier[sub] operator[SEP] identifier[qp_y_ec] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[det_ec] operator[SEP] identifier[isFuzzyZero] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[det_ec_value] operator[=] identifier[det_ec] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[det_ec_value] operator[<] literal[Float] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[det_ec_value] operator[>] literal[Float] operator[SEP] Keyword[return] Other[1] operator[SEP] Keyword[return] Other[0] operator[SEP]
}
identifier[BigDecimal] identifier[det_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[q] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[px_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[p] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[py_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[p] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[det_mp] operator[=] identifier[det_mp] operator[SEP] identifier[subtract] operator[SEP] identifier[px_mp] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[rp_y_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[r] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[rp_y_mp] operator[=] identifier[rp_y_mp] operator[SEP] identifier[subtract] operator[SEP] identifier[py_mp] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[qp_y_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[q] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[qp_y_mp] operator[=] identifier[qp_y_mp] operator[SEP] identifier[subtract] operator[SEP] identifier[py_mp] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[rp_x_mp] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[r] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[rp_x_mp] operator[=] identifier[rp_x_mp] operator[SEP] identifier[subtract] operator[SEP] identifier[px_mp] operator[SEP] operator[SEP] identifier[det_mp] operator[=] identifier[det_mp] operator[SEP] identifier[multiply] operator[SEP] identifier[rp_y_mp] operator[SEP] operator[SEP] identifier[qp_y_mp] operator[=] identifier[qp_y_mp] operator[SEP] identifier[multiply] operator[SEP] identifier[rp_x_mp] operator[SEP] operator[SEP] identifier[det_mp] operator[=] identifier[det_mp] operator[SEP] identifier[subtract] operator[SEP] identifier[qp_y_mp] operator[SEP] operator[SEP] Keyword[return] identifier[det_mp] operator[SEP] identifier[signum] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <A extends Annotation> List<A> getRepeatableAnnotations(Method method, Class<A> annotationClass) {
A[] annotations = method.getAnnotationsByType(annotationClass);
if (annotations == null || annotations.length == 0) {
for (Annotation metaAnnotation : method.getAnnotations()) {
annotations = metaAnnotation.annotationType().getAnnotationsByType(annotationClass);
if (annotations != null && annotations.length > 0) {
return Arrays.asList(annotations);
}
}
Method superclassMethod = getOverriddenMethod(method);
if (superclassMethod != null) {
return getRepeatableAnnotations(superclassMethod, annotationClass);
}
}
if (annotations == null) {
return null;
}
return Arrays.asList(annotations);
} | class class_name[name] begin[{]
method[getRepeatableAnnotations, return_type[type[List]], modifier[public static], parameter[method, annotationClass]] begin[{]
local_variable[type[A], annotations]
if[binary_operation[binary_operation[member[.annotations], ==, literal[null]], ||, binary_operation[member[annotations.length], ==, literal[0]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=annotationType, postfix_operators=[], prefix_operators=[], qualifier=metaAnnotation, selectors=[MethodInvocation(arguments=[MemberReference(member=annotationClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnnotationsByType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=annotations, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAnnotations, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=metaAnnotation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Annotation, sub_type=None))), label=None)
local_variable[type[Method], superclassMethod]
if[binary_operation[member[.superclassMethod], !=, literal[null]]] begin[{]
return[call[.getRepeatableAnnotations, parameter[member[.superclassMethod], member[.annotationClass]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.annotations], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[Arrays.asList, parameter[member[.annotations]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[A] Keyword[extends] identifier[Annotation] operator[>] identifier[List] operator[<] identifier[A] operator[>] identifier[getRepeatableAnnotations] operator[SEP] identifier[Method] identifier[method] , identifier[Class] operator[<] identifier[A] operator[>] identifier[annotationClass] operator[SEP] {
identifier[A] operator[SEP] operator[SEP] identifier[annotations] operator[=] identifier[method] operator[SEP] identifier[getAnnotationsByType] operator[SEP] identifier[annotationClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[annotations] operator[==] Other[null] operator[||] identifier[annotations] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[Annotation] identifier[metaAnnotation] operator[:] identifier[method] operator[SEP] identifier[getAnnotations] operator[SEP] operator[SEP] operator[SEP] {
identifier[annotations] operator[=] identifier[metaAnnotation] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[getAnnotationsByType] operator[SEP] identifier[annotationClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[annotations] operator[!=] Other[null] operator[&&] identifier[annotations] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[annotations] operator[SEP] operator[SEP]
}
}
identifier[Method] identifier[superclassMethod] operator[=] identifier[getOverriddenMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superclassMethod] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[getRepeatableAnnotations] operator[SEP] identifier[superclassMethod] , identifier[annotationClass] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[annotations] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[annotations] operator[SEP] operator[SEP]
}
|
public void actionPerformed(ActionEvent ev) {
String s = ev.getActionCommand();
// System.out.println("Action performed " + s);
if (s.equals("ConnectOk")) {
finishCreate();
} else if (s.equals("ConnectCancel")) {
dispose();
}
} | class class_name[name] begin[{]
method[actionPerformed, return_type[void], modifier[public], parameter[ev]] begin[{]
local_variable[type[String], s]
if[call[s.equals, parameter[literal["ConnectOk"]]]] begin[{]
call[.finishCreate, parameter[]]
else begin[{]
if[call[s.equals, parameter[literal["ConnectCancel"]]]] begin[{]
call[.dispose, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[actionPerformed] operator[SEP] identifier[ActionEvent] identifier[ev] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[ev] operator[SEP] identifier[getActionCommand] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[finishCreate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public ShippingAddress updateShippingAddress(final String accountCode, final long shippingAddressId, ShippingAddress shippingAddress) {
return doPUT(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE + "/" + shippingAddressId, shippingAddress,
ShippingAddress.class);
} | class class_name[name] begin[{]
method[updateShippingAddress, return_type[type[ShippingAddress]], modifier[public], parameter[accountCode, shippingAddressId, shippingAddress]] begin[{]
return[call[.doPUT, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[Accounts.ACCOUNTS_RESOURCE], +, literal["/"]], +, member[.accountCode]], +, member[ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE]], +, literal["/"]], +, member[.shippingAddressId]], member[.shippingAddress], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ShippingAddress, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[ShippingAddress] identifier[updateShippingAddress] operator[SEP] Keyword[final] identifier[String] identifier[accountCode] , Keyword[final] Keyword[long] identifier[shippingAddressId] , identifier[ShippingAddress] identifier[shippingAddress] operator[SEP] {
Keyword[return] identifier[doPUT] operator[SEP] identifier[Accounts] operator[SEP] identifier[ACCOUNTS_RESOURCE] operator[+] literal[String] operator[+] identifier[accountCode] operator[+] identifier[ShippingAddresses] operator[SEP] identifier[SHIPPING_ADDRESSES_RESOURCE] operator[+] literal[String] operator[+] identifier[shippingAddressId] , identifier[shippingAddress] , identifier[ShippingAddress] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public int delTemplateEntry(String template,
Object entry) {
int returnCode = NO_EXCEPTION;
if (!this.disableTemplatesSupport) {
if (delayOffload) {
Result result = auxTemplateDependencyTable.removeEntry(template, entry);
returnCode = result.returnCode;
if (!result.bExist && returnCode != DISK_EXCEPTION) {
returnCode = delValueSetEntry(TEMPLATE_ID_DATA, template, entry);
}
} else {
returnCode = delValueSetEntry(TEMPLATE_ID_DATA, template, entry);
}
}
return returnCode;
} | class class_name[name] begin[{]
method[delTemplateEntry, return_type[type[int]], modifier[public], parameter[template, entry]] begin[{]
local_variable[type[int], returnCode]
if[THIS[member[None.disableTemplatesSupport]]] begin[{]
if[member[.delayOffload]] begin[{]
local_variable[type[Result], result]
assign[member[.returnCode], member[result.returnCode]]
if[binary_operation[member[result.bExist], &&, binary_operation[member[.returnCode], !=, member[.DISK_EXCEPTION]]]] begin[{]
assign[member[.returnCode], call[.delValueSetEntry, parameter[member[.TEMPLATE_ID_DATA], member[.template], member[.entry]]]]
else begin[{]
None
end[}]
else begin[{]
assign[member[.returnCode], call[.delValueSetEntry, parameter[member[.TEMPLATE_ID_DATA], member[.template], member[.entry]]]]
end[}]
else begin[{]
None
end[}]
return[member[.returnCode]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[delTemplateEntry] operator[SEP] identifier[String] identifier[template] , identifier[Object] identifier[entry] operator[SEP] {
Keyword[int] identifier[returnCode] operator[=] identifier[NO_EXCEPTION] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[disableTemplatesSupport] operator[SEP] {
Keyword[if] operator[SEP] identifier[delayOffload] operator[SEP] {
identifier[Result] identifier[result] operator[=] identifier[auxTemplateDependencyTable] operator[SEP] identifier[removeEntry] operator[SEP] identifier[template] , identifier[entry] operator[SEP] operator[SEP] identifier[returnCode] operator[=] identifier[result] operator[SEP] identifier[returnCode] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[result] operator[SEP] identifier[bExist] operator[&&] identifier[returnCode] operator[!=] identifier[DISK_EXCEPTION] operator[SEP] {
identifier[returnCode] operator[=] identifier[delValueSetEntry] operator[SEP] identifier[TEMPLATE_ID_DATA] , identifier[template] , identifier[entry] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[returnCode] operator[=] identifier[delValueSetEntry] operator[SEP] identifier[TEMPLATE_ID_DATA] , identifier[template] , identifier[entry] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[returnCode] operator[SEP]
}
|
public Coding addSecurity() { //3
Coding t = new Coding();
if (this.security == null)
this.security = new ArrayList<Coding>();
this.security.add(t);
return t;
} | class class_name[name] begin[{]
method[addSecurity, return_type[type[Coding]], modifier[public], parameter[]] begin[{]
local_variable[type[Coding], t]
if[binary_operation[THIS[member[None.security]], ==, literal[null]]] begin[{]
assign[THIS[member[None.security]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Coding, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.security]call[None.add, parameter[member[.t]]]]
return[member[.t]]
end[}]
END[}] | Keyword[public] identifier[Coding] identifier[addSecurity] operator[SEP] operator[SEP] {
identifier[Coding] identifier[t] operator[=] Keyword[new] identifier[Coding] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[security] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[security] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Coding] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[security] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] identifier[t] operator[SEP]
}
|
@Override
public SetEndpointAttributesResult setEndpointAttributes(SetEndpointAttributesRequest request) {
request = beforeClientExecution(request);
return executeSetEndpointAttributes(request);
} | class class_name[name] begin[{]
method[setEndpointAttributes, return_type[type[SetEndpointAttributesResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeSetEndpointAttributes, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SetEndpointAttributesResult] identifier[setEndpointAttributes] operator[SEP] identifier[SetEndpointAttributesRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeSetEndpointAttributes] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@Nullable
public static SoyType getSoyTypeForBinaryOperator(
SoyType t0, SoyType t1, SoyTypeBinaryOperator operator) {
if (t0.getKind() == Kind.ERROR || t1.getKind() == Kind.ERROR) {
return ErrorType.getInstance();
}
// If both types are nullable, we will make the result nullable as well.
// If only one of these input types is nullable, we don't. For example, {int} and {int|null}
// probably should return {int} instead of {int|null}.
boolean isNullable = isNullable(t0) && isNullable(t1);
// TODO(b/64098780): Make arithmetic operations on nullable type consistent.
// For now, we remove nulltype from the union type.
SoyType left = tryRemoveNull(t0);
SoyType right = tryRemoveNull(t1);
if (left.getKind() == SoyType.Kind.UNION) {
return getSoyTypeFromUnionForBinaryOperator((UnionType) left, right, isNullable, operator);
}
if (right.getKind() == SoyType.Kind.UNION) {
// When we calculate the return type of a binary operator, it should always be commutative so
// the order should not matter.
return getSoyTypeFromUnionForBinaryOperator((UnionType) right, left, isNullable, operator);
}
SoyType result = operator.resolve(left, right);
if (result == null) {
return null;
}
return isNullable ? makeNullable(result) : result;
} | class class_name[name] begin[{]
method[getSoyTypeForBinaryOperator, return_type[type[SoyType]], modifier[public static], parameter[t0, t1, operator]] begin[{]
if[binary_operation[binary_operation[call[t0.getKind, parameter[]], ==, member[Kind.ERROR]], ||, binary_operation[call[t1.getKind, parameter[]], ==, member[Kind.ERROR]]]] begin[{]
return[call[ErrorType.getInstance, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[boolean], isNullable]
local_variable[type[SoyType], left]
local_variable[type[SoyType], right]
if[binary_operation[call[left.getKind, parameter[]], ==, member[SoyType.Kind.UNION]]] begin[{]
return[call[.getSoyTypeFromUnionForBinaryOperator, parameter[Cast(expression=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=UnionType, sub_type=None)), member[.right], member[.isNullable], member[.operator]]]]
else begin[{]
None
end[}]
if[binary_operation[call[right.getKind, parameter[]], ==, member[SoyType.Kind.UNION]]] begin[{]
return[call[.getSoyTypeFromUnionForBinaryOperator, parameter[Cast(expression=MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=UnionType, sub_type=None)), member[.left], member[.isNullable], member[.operator]]]]
else begin[{]
None
end[}]
local_variable[type[SoyType], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=MemberReference(member=isNullable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeNullable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[SoyType] identifier[getSoyTypeForBinaryOperator] operator[SEP] identifier[SoyType] identifier[t0] , identifier[SoyType] identifier[t1] , identifier[SoyTypeBinaryOperator] identifier[operator] operator[SEP] {
Keyword[if] operator[SEP] identifier[t0] operator[SEP] identifier[getKind] operator[SEP] operator[SEP] operator[==] identifier[Kind] operator[SEP] identifier[ERROR] operator[||] identifier[t1] operator[SEP] identifier[getKind] operator[SEP] operator[SEP] operator[==] identifier[Kind] operator[SEP] identifier[ERROR] operator[SEP] {
Keyword[return] identifier[ErrorType] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[isNullable] operator[=] identifier[isNullable] operator[SEP] identifier[t0] operator[SEP] operator[&&] identifier[isNullable] operator[SEP] identifier[t1] operator[SEP] operator[SEP] identifier[SoyType] identifier[left] operator[=] identifier[tryRemoveNull] operator[SEP] identifier[t0] operator[SEP] operator[SEP] identifier[SoyType] identifier[right] operator[=] identifier[tryRemoveNull] operator[SEP] identifier[t1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[left] operator[SEP] identifier[getKind] operator[SEP] operator[SEP] operator[==] identifier[SoyType] operator[SEP] identifier[Kind] operator[SEP] identifier[UNION] operator[SEP] {
Keyword[return] identifier[getSoyTypeFromUnionForBinaryOperator] operator[SEP] operator[SEP] identifier[UnionType] operator[SEP] identifier[left] , identifier[right] , identifier[isNullable] , identifier[operator] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[right] operator[SEP] identifier[getKind] operator[SEP] operator[SEP] operator[==] identifier[SoyType] operator[SEP] identifier[Kind] operator[SEP] identifier[UNION] operator[SEP] {
Keyword[return] identifier[getSoyTypeFromUnionForBinaryOperator] operator[SEP] operator[SEP] identifier[UnionType] operator[SEP] identifier[right] , identifier[left] , identifier[isNullable] , identifier[operator] operator[SEP] operator[SEP]
}
identifier[SoyType] identifier[result] operator[=] identifier[operator] operator[SEP] identifier[resolve] operator[SEP] identifier[left] , identifier[right] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[isNullable] operator[?] identifier[makeNullable] operator[SEP] identifier[result] operator[SEP] operator[:] identifier[result] operator[SEP]
}
|
public String getValue(final ConfigParam param) {
if (param == null) {
return null;
}
// Buscamos en las variables del sistema
Object obj = System.getProperty(param.getName());
// Si no, se busca en el fichero de configuracion
if (obj == null) {
obj = this.props.get(param.getName());
}
// Si tampoco esta ahi, y es un valor que tenga un valor por defecto,
// se devuelve el valor por defecto
if (obj == null) {
log.warn("Property [{}] not found", param.getName());
obj = param.getDefaultValue();
}
// Se devuelve el valor del parametro
return (String) obj;
} | class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[public], parameter[param]] begin[{]
if[binary_operation[member[.param], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
assign[member[.obj], THIS[member[None.props]call[None.get, parameter[call[param.getName, parameter[]]]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
call[log.warn, parameter[literal["Property [{}] not found"], call[param.getName, parameter[]]]]
assign[member[.obj], call[param.getDefaultValue, parameter[]]]
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getValue] operator[SEP] Keyword[final] identifier[ConfigParam] identifier[param] operator[SEP] {
Keyword[if] operator[SEP] identifier[param] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Object] identifier[obj] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[param] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
identifier[obj] operator[=] Keyword[this] operator[SEP] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[param] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[param] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[=] identifier[param] operator[SEP] identifier[getDefaultValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[String] operator[SEP] identifier[obj] operator[SEP]
}
|
int print(ResultSet rs, DispatchCallback callback) throws SQLException {
String format = getOpts().getOutputFormat();
OutputFormat f = getOutputFormats().get(format);
if ("csv".equals(format)) {
final SeparatedValuesOutputFormat csvOutput =
(SeparatedValuesOutputFormat) f;
if ((csvOutput.separator == null && getOpts().getCsvDelimiter() != null)
|| (csvOutput.separator != null
&& !csvOutput.separator.equals(getOpts().getCsvDelimiter())
|| csvOutput.quoteCharacter
!= getOpts().getCsvQuoteCharacter())) {
f = new SeparatedValuesOutputFormat(this,
getOpts().getCsvDelimiter(), getOpts().getCsvQuoteCharacter());
Map<String, OutputFormat> updFormats =
new HashMap<>(getOutputFormats());
updFormats.put("csv", f);
updateOutputFormats(updFormats);
}
}
Rows rows;
if (getOpts().getIncremental()) {
rows = new IncrementalRows(this, rs, callback);
} else {
rows = new BufferedRows(this, rs);
}
return f.print(rows);
} | class class_name[name] begin[{]
method[print, return_type[type[int]], modifier[default], parameter[rs, callback]] begin[{]
local_variable[type[String], format]
local_variable[type[OutputFormat], f]
if[literal["csv"]] begin[{]
local_variable[type[SeparatedValuesOutputFormat], csvOutput]
if[binary_operation[binary_operation[binary_operation[member[csvOutput.separator], ==, literal[null]], &&, binary_operation[call[.getOpts, parameter[]], !=, literal[null]]], ||, binary_operation[binary_operation[binary_operation[member[csvOutput.separator], !=, literal[null]], &&, call[csvOutput.separator.equals, parameter[call[.getOpts, parameter[]]]]], ||, binary_operation[member[csvOutput.quoteCharacter], !=, call[.getOpts, parameter[]]]]]] begin[{]
assign[member[.f], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=getOpts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCsvDelimiter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getOpts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCsvQuoteCharacter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SeparatedValuesOutputFormat, sub_type=None))]
local_variable[type[Map], updFormats]
call[updFormats.put, parameter[literal["csv"], member[.f]]]
call[.updateOutputFormats, parameter[member[.updFormats]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[Rows], rows]
if[call[.getOpts, parameter[]]] begin[{]
assign[member[.rows], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=callback, 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=IncrementalRows, sub_type=None))]
else begin[{]
assign[member[.rows], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=rs, 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=BufferedRows, sub_type=None))]
end[}]
return[call[f.print, parameter[member[.rows]]]]
end[}]
END[}] | Keyword[int] identifier[print] operator[SEP] identifier[ResultSet] identifier[rs] , identifier[DispatchCallback] identifier[callback] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[String] identifier[format] operator[=] identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getOutputFormat] operator[SEP] operator[SEP] operator[SEP] identifier[OutputFormat] identifier[f] operator[=] identifier[getOutputFormats] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[format] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[format] operator[SEP] operator[SEP] {
Keyword[final] identifier[SeparatedValuesOutputFormat] identifier[csvOutput] operator[=] operator[SEP] identifier[SeparatedValuesOutputFormat] operator[SEP] identifier[f] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[csvOutput] operator[SEP] identifier[separator] operator[==] Other[null] operator[&&] identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getCsvDelimiter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] identifier[csvOutput] operator[SEP] identifier[separator] operator[!=] Other[null] operator[&&] operator[!] identifier[csvOutput] operator[SEP] identifier[separator] operator[SEP] identifier[equals] operator[SEP] identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getCsvDelimiter] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[csvOutput] operator[SEP] identifier[quoteCharacter] operator[!=] identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getCsvQuoteCharacter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[f] operator[=] Keyword[new] identifier[SeparatedValuesOutputFormat] operator[SEP] Keyword[this] , identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getCsvDelimiter] operator[SEP] operator[SEP] , identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getCsvQuoteCharacter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[OutputFormat] operator[>] identifier[updFormats] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] identifier[getOutputFormats] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[updFormats] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[f] operator[SEP] operator[SEP] identifier[updateOutputFormats] operator[SEP] identifier[updFormats] operator[SEP] operator[SEP]
}
}
identifier[Rows] identifier[rows] operator[SEP] Keyword[if] operator[SEP] identifier[getOpts] operator[SEP] operator[SEP] operator[SEP] identifier[getIncremental] operator[SEP] operator[SEP] operator[SEP] {
identifier[rows] operator[=] Keyword[new] identifier[IncrementalRows] operator[SEP] Keyword[this] , identifier[rs] , identifier[callback] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rows] operator[=] Keyword[new] identifier[BufferedRows] operator[SEP] Keyword[this] , identifier[rs] operator[SEP] operator[SEP]
}
Keyword[return] identifier[f] operator[SEP] identifier[print] operator[SEP] identifier[rows] operator[SEP] operator[SEP]
}
|
static boolean[] compactArray(boolean[] array, int index, int length)
{
if (index == 0 && length == array.length) {
return array;
}
return Arrays.copyOfRange(array, index, index + length);
} | class class_name[name] begin[{]
method[compactArray, return_type[type[boolean]], modifier[static], parameter[array, index, length]] begin[{]
if[binary_operation[binary_operation[member[.index], ==, literal[0]], &&, binary_operation[member[.length], ==, member[array.length]]]] begin[{]
return[member[.array]]
else begin[{]
None
end[}]
return[call[Arrays.copyOfRange, parameter[member[.array], member[.index], binary_operation[member[.index], +, member[.length]]]]]
end[}]
END[}] | Keyword[static] Keyword[boolean] operator[SEP] operator[SEP] identifier[compactArray] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[index] , Keyword[int] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[==] Other[0] operator[&&] identifier[length] operator[==] identifier[array] operator[SEP] identifier[length] operator[SEP] {
Keyword[return] identifier[array] operator[SEP]
}
Keyword[return] identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[array] , identifier[index] , identifier[index] operator[+] identifier[length] operator[SEP] operator[SEP]
}
|
public Optional<String> getSigningKey(final RegisteredService registeredService) {
val property = getSigningKeyRegisteredServiceProperty();
if (property.isAssignedTo(registeredService)) {
val signingKey = property.getPropertyValue(registeredService).getValue();
return Optional.of(signingKey);
}
return Optional.empty();
} | class class_name[name] begin[{]
method[getSigningKey, return_type[type[Optional]], modifier[public], parameter[registeredService]] begin[{]
local_variable[type[val], property]
if[call[property.isAssignedTo, parameter[member[.registeredService]]]] begin[{]
local_variable[type[val], signingKey]
return[call[Optional.of, parameter[member[.signingKey]]]]
else begin[{]
None
end[}]
return[call[Optional.empty, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[Optional] operator[<] identifier[String] operator[>] identifier[getSigningKey] operator[SEP] Keyword[final] identifier[RegisteredService] identifier[registeredService] operator[SEP] {
identifier[val] identifier[property] operator[=] identifier[getSigningKeyRegisteredServiceProperty] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isAssignedTo] operator[SEP] identifier[registeredService] operator[SEP] operator[SEP] {
identifier[val] identifier[signingKey] operator[=] identifier[property] operator[SEP] identifier[getPropertyValue] operator[SEP] identifier[registeredService] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[signingKey] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
|
public X509CRLEntry getRevokedCertificate(X509Certificate certificate) {
X500Principal certIssuer = certificate.getIssuerX500Principal();
X500Principal crlIssuer = getIssuerX500Principal();
if (certIssuer.equals(crlIssuer) == false) {
return null;
}
return getRevokedCertificate(certificate.getSerialNumber());
} | class class_name[name] begin[{]
method[getRevokedCertificate, return_type[type[X509CRLEntry]], modifier[public], parameter[certificate]] begin[{]
local_variable[type[X500Principal], certIssuer]
local_variable[type[X500Principal], crlIssuer]
if[binary_operation[call[certIssuer.equals, parameter[member[.crlIssuer]]], ==, literal[false]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.getRevokedCertificate, parameter[call[certificate.getSerialNumber, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[X509CRLEntry] identifier[getRevokedCertificate] operator[SEP] identifier[X509Certificate] identifier[certificate] operator[SEP] {
identifier[X500Principal] identifier[certIssuer] operator[=] identifier[certificate] operator[SEP] identifier[getIssuerX500Principal] operator[SEP] operator[SEP] operator[SEP] identifier[X500Principal] identifier[crlIssuer] operator[=] identifier[getIssuerX500Principal] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[certIssuer] operator[SEP] identifier[equals] operator[SEP] identifier[crlIssuer] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[getRevokedCertificate] operator[SEP] identifier[certificate] operator[SEP] identifier[getSerialNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void verifyThatFileTextContentIsEqualToFileTextContent(String filePath, File lastDownloadedFile) throws IOException, ParserConfigurationException, SAXException {
verifyFileIsSimilarToFile(filePath, lastDownloadedFile);
} | class class_name[name] begin[{]
method[verifyThatFileTextContentIsEqualToFileTextContent, return_type[void], modifier[public], parameter[filePath, lastDownloadedFile]] begin[{]
call[.verifyFileIsSimilarToFile, parameter[member[.filePath], member[.lastDownloadedFile]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[verifyThatFileTextContentIsEqualToFileTextContent] operator[SEP] identifier[String] identifier[filePath] , identifier[File] identifier[lastDownloadedFile] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ParserConfigurationException] , identifier[SAXException] {
identifier[verifyFileIsSimilarToFile] operator[SEP] identifier[filePath] , identifier[lastDownloadedFile] operator[SEP] operator[SEP]
}
|
public CmsCategory getCategory(CmsObject cms, String categoryRootPath) throws CmsException {
CmsResource resource = cms.readResource(cms.getRequestContext().removeSiteRoot(categoryRootPath));
return getCategory(cms, resource);
} | class class_name[name] begin[{]
method[getCategory, return_type[type[CmsCategory]], modifier[public], parameter[cms, categoryRootPath]] begin[{]
local_variable[type[CmsResource], resource]
return[call[.getCategory, parameter[member[.cms], member[.resource]]]]
end[}]
END[}] | Keyword[public] identifier[CmsCategory] identifier[getCategory] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[String] identifier[categoryRootPath] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[CmsResource] identifier[resource] operator[=] identifier[cms] operator[SEP] identifier[readResource] operator[SEP] identifier[cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[removeSiteRoot] operator[SEP] identifier[categoryRootPath] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getCategory] operator[SEP] identifier[cms] , identifier[resource] operator[SEP] operator[SEP]
}
|
protected Record getOrNullIfExpired(Record record, long now, boolean backup) {
if (!isRecordStoreExpirable()) {
return record;
}
if (record == null) {
return null;
}
Data key = record.getKey();
if (isLocked(key)) {
return record;
}
if (!isExpired(record, now, backup)) {
return record;
}
evict(key, backup);
if (!backup) {
doPostEvictionOperations(record);
}
return null;
} | class class_name[name] begin[{]
method[getOrNullIfExpired, return_type[type[Record]], modifier[protected], parameter[record, now, backup]] begin[{]
if[call[.isRecordStoreExpirable, parameter[]]] begin[{]
return[member[.record]]
else begin[{]
None
end[}]
if[binary_operation[member[.record], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Data], key]
if[call[.isLocked, parameter[member[.key]]]] begin[{]
return[member[.record]]
else begin[{]
None
end[}]
if[call[.isExpired, parameter[member[.record], member[.now], member[.backup]]]] begin[{]
return[member[.record]]
else begin[{]
None
end[}]
call[.evict, parameter[member[.key], member[.backup]]]
if[member[.backup]] begin[{]
call[.doPostEvictionOperations, parameter[member[.record]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[Record] identifier[getOrNullIfExpired] operator[SEP] identifier[Record] identifier[record] , Keyword[long] identifier[now] , Keyword[boolean] identifier[backup] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isRecordStoreExpirable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[record] operator[SEP]
}
Keyword[if] operator[SEP] identifier[record] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Data] identifier[key] operator[=] identifier[record] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isLocked] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[return] identifier[record] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isExpired] operator[SEP] identifier[record] , identifier[now] , identifier[backup] operator[SEP] operator[SEP] {
Keyword[return] identifier[record] operator[SEP]
}
identifier[evict] operator[SEP] identifier[key] , identifier[backup] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[backup] operator[SEP] {
identifier[doPostEvictionOperations] operator[SEP] identifier[record] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public boolean isConsistentWith(KbState other) {
// Both states need to have the same functions in the same order.
// Don't check the names specifically though, because it's expensive.
Preconditions.checkArgument(other.functionNames.size() == functionNames.size());
List<FunctionAssignment> otherAssignments = other.getAssignments();
for (int i = 0; i < functionAssignments.size(); i++) {
FunctionAssignment a1 = functionAssignments.get(i);
FunctionAssignment a2 = otherAssignments.get(i);
if (!a1.isConsistentWith(a2)) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[isConsistentWith, return_type[type[boolean]], modifier[public], parameter[other]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[call[other.functionNames.size, parameter[]], ==, call[functionNames.size, parameter[]]]]]
local_variable[type[List], otherAssignments]
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=functionAssignments, selectors=[], type_arguments=None), name=a1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FunctionAssignment, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=otherAssignments, selectors=[], type_arguments=None), name=a2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FunctionAssignment, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=a2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isConsistentWith, postfix_operators=[], prefix_operators=['!'], qualifier=a1, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=functionAssignments, 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[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isConsistentWith] operator[SEP] identifier[KbState] identifier[other] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[other] operator[SEP] identifier[functionNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[functionNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[FunctionAssignment] operator[>] identifier[otherAssignments] operator[=] identifier[other] operator[SEP] identifier[getAssignments] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[functionAssignments] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[FunctionAssignment] identifier[a1] operator[=] identifier[functionAssignments] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[FunctionAssignment] identifier[a2] operator[=] identifier[otherAssignments] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[a1] operator[SEP] identifier[isConsistentWith] operator[SEP] identifier[a2] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private boolean isProcessConfigFile(File file) {
if (this.configuration.getProcessConfigDirOrFile().isFile()) {
return file.equals(this.configuration.getProcessConfigDirOrFile());
}
// If the file doesn't exist anymore, treat it as a regular file (to handle file deletion events)
if(file.exists() && !file.isFile()) {
return false;
}
final String fileName = file.getName();
return !fileName.startsWith(".") && (fileName.endsWith(".json") || fileName.endsWith(".yml") || fileName.endsWith(".yaml"));
} | class class_name[name] begin[{]
method[isProcessConfigFile, return_type[type[boolean]], modifier[private], parameter[file]] begin[{]
if[THIS[member[None.configuration]call[None.getProcessConfigDirOrFile, parameter[]]call[None.isFile, parameter[]]]] begin[{]
return[call[file.equals, parameter[THIS[member[None.configuration]call[None.getProcessConfigDirOrFile, parameter[]]]]]]
else begin[{]
None
end[}]
if[binary_operation[call[file.exists, parameter[]], &&, call[file.isFile, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], fileName]
return[binary_operation[call[fileName.startsWith, parameter[literal["."]]], &&, binary_operation[binary_operation[call[fileName.endsWith, parameter[literal[".json"]]], ||, call[fileName.endsWith, parameter[literal[".yml"]]]], ||, call[fileName.endsWith, parameter[literal[".yaml"]]]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isProcessConfigFile] operator[SEP] identifier[File] identifier[file] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[configuration] operator[SEP] identifier[getProcessConfigDirOrFile] operator[SEP] operator[SEP] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[file] operator[SEP] identifier[equals] operator[SEP] Keyword[this] operator[SEP] identifier[configuration] operator[SEP] identifier[getProcessConfigDirOrFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[file] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[String] identifier[fileName] operator[=] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[fileName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
PropertyFilterList<S> getTailPropertyFilterList() {
PropertyFilterList<S> tail = mTailPropertyFilterList;
if (tail == null) {
buildFilterValues();
tail = mTailPropertyFilterList;
}
return tail;
} | class class_name[name] begin[{]
method[getTailPropertyFilterList, return_type[type[PropertyFilterList]], modifier[default], parameter[]] begin[{]
local_variable[type[PropertyFilterList], tail]
if[binary_operation[member[.tail], ==, literal[null]]] begin[{]
call[.buildFilterValues, parameter[]]
assign[member[.tail], member[.mTailPropertyFilterList]]
else begin[{]
None
end[}]
return[member[.tail]]
end[}]
END[}] | identifier[PropertyFilterList] operator[<] identifier[S] operator[>] identifier[getTailPropertyFilterList] operator[SEP] operator[SEP] {
identifier[PropertyFilterList] operator[<] identifier[S] operator[>] identifier[tail] operator[=] identifier[mTailPropertyFilterList] operator[SEP] Keyword[if] operator[SEP] identifier[tail] operator[==] Other[null] operator[SEP] {
identifier[buildFilterValues] operator[SEP] operator[SEP] operator[SEP] identifier[tail] operator[=] identifier[mTailPropertyFilterList] operator[SEP]
}
Keyword[return] identifier[tail] operator[SEP]
}
|
public void refreshExtensions() throws ExtensionRefreshException {
ExtensionList<ExtensionFinder> finders = getExtensionList(ExtensionFinder.class);
for (ExtensionFinder ef : finders) {
if (!ef.isRefreshable())
throw new ExtensionRefreshException(ef+" doesn't support refresh");
}
List<ExtensionComponentSet> fragments = Lists.newArrayList();
for (ExtensionFinder ef : finders) {
fragments.add(ef.refresh());
}
ExtensionComponentSet delta = ExtensionComponentSet.union(fragments).filtered();
// if we find a new ExtensionFinder, we need it to list up all the extension points as well
List<ExtensionComponent<ExtensionFinder>> newFinders = Lists.newArrayList(delta.find(ExtensionFinder.class));
while (!newFinders.isEmpty()) {
ExtensionFinder f = newFinders.remove(newFinders.size()-1).getInstance();
ExtensionComponentSet ecs = ExtensionComponentSet.allOf(f).filtered();
newFinders.addAll(ecs.find(ExtensionFinder.class));
delta = ExtensionComponentSet.union(delta, ecs);
}
for (ExtensionList el : extensionLists.values()) {
el.refresh(delta);
}
for (ExtensionList el : descriptorLists.values()) {
el.refresh(delta);
}
// TODO: we need some generalization here so that extension points can be notified when a refresh happens?
for (ExtensionComponent<RootAction> ea : delta.find(RootAction.class)) {
Action a = ea.getInstance();
if (!actions.contains(a)) actions.add(a);
}
} | class class_name[name] begin[{]
method[refreshExtensions, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[ExtensionList], finders]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isRefreshable, postfix_operators=[], prefix_operators=['!'], qualifier=ef, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=ef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" doesn't support refresh"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtensionRefreshException, sub_type=None)), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=finders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionFinder, sub_type=None))), label=None)
local_variable[type[List], fragments]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=refresh, postfix_operators=[], prefix_operators=[], qualifier=ef, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fragments, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=finders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionFinder, sub_type=None))), label=None)
local_variable[type[ExtensionComponentSet], delta]
local_variable[type[List], newFinders]
while[call[newFinders.isEmpty, parameter[]]] begin[{]
local_variable[type[ExtensionFinder], f]
local_variable[type[ExtensionComponentSet], ecs]
call[newFinders.addAll, parameter[call[ecs.find, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtensionFinder, sub_type=None))]]]]
assign[member[.delta], call[ExtensionComponentSet.union, parameter[member[.delta], member[.ecs]]]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=refresh, postfix_operators=[], prefix_operators=[], qualifier=el, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=extensionLists, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=el)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionList, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=refresh, postfix_operators=[], prefix_operators=[], qualifier=el, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=descriptorLists, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=el)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionList, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=ea, selectors=[], type_arguments=None), name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Action, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=actions, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=actions, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RootAction, sub_type=None))], member=find, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ea)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RootAction, sub_type=None))], dimensions=[], name=ExtensionComponent, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[refreshExtensions] operator[SEP] operator[SEP] Keyword[throws] identifier[ExtensionRefreshException] {
identifier[ExtensionList] operator[<] identifier[ExtensionFinder] operator[>] identifier[finders] operator[=] identifier[getExtensionList] operator[SEP] identifier[ExtensionFinder] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExtensionFinder] identifier[ef] operator[:] identifier[finders] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ef] operator[SEP] identifier[isRefreshable] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ExtensionRefreshException] operator[SEP] identifier[ef] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[ExtensionComponentSet] operator[>] identifier[fragments] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExtensionFinder] identifier[ef] operator[:] identifier[finders] operator[SEP] {
identifier[fragments] operator[SEP] identifier[add] operator[SEP] identifier[ef] operator[SEP] identifier[refresh] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ExtensionComponentSet] identifier[delta] operator[=] identifier[ExtensionComponentSet] operator[SEP] identifier[union] operator[SEP] identifier[fragments] operator[SEP] operator[SEP] identifier[filtered] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ExtensionComponent] operator[<] identifier[ExtensionFinder] operator[>] operator[>] identifier[newFinders] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] identifier[delta] operator[SEP] identifier[find] operator[SEP] identifier[ExtensionFinder] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[newFinders] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[ExtensionFinder] identifier[f] operator[=] identifier[newFinders] operator[SEP] identifier[remove] operator[SEP] identifier[newFinders] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[ExtensionComponentSet] identifier[ecs] operator[=] identifier[ExtensionComponentSet] operator[SEP] identifier[allOf] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[filtered] operator[SEP] operator[SEP] operator[SEP] identifier[newFinders] operator[SEP] identifier[addAll] operator[SEP] identifier[ecs] operator[SEP] identifier[find] operator[SEP] identifier[ExtensionFinder] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[delta] operator[=] identifier[ExtensionComponentSet] operator[SEP] identifier[union] operator[SEP] identifier[delta] , identifier[ecs] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ExtensionList] identifier[el] operator[:] identifier[extensionLists] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[el] operator[SEP] identifier[refresh] operator[SEP] identifier[delta] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ExtensionList] identifier[el] operator[:] identifier[descriptorLists] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[el] operator[SEP] identifier[refresh] operator[SEP] identifier[delta] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ExtensionComponent] operator[<] identifier[RootAction] operator[>] identifier[ea] operator[:] identifier[delta] operator[SEP] identifier[find] operator[SEP] identifier[RootAction] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[Action] identifier[a] operator[=] identifier[ea] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[actions] operator[SEP] identifier[contains] operator[SEP] identifier[a] operator[SEP] operator[SEP] identifier[actions] operator[SEP] identifier[add] operator[SEP] identifier[a] operator[SEP] operator[SEP]
}
}
|
public static String add( String str, String str2 ) {
return FastStringUtils.noCopyStringFromChars(
Chr.add(
FastStringUtils.toCharArray(str),
FastStringUtils.toCharArray(str2) )
);
} | class class_name[name] begin[{]
method[add, return_type[type[String]], modifier[public static], parameter[str, str2]] begin[{]
return[call[FastStringUtils.noCopyStringFromChars, parameter[call[Chr.add, parameter[call[FastStringUtils.toCharArray, parameter[member[.str]]], call[FastStringUtils.toCharArray, parameter[member[.str2]]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[add] operator[SEP] identifier[String] identifier[str] , identifier[String] identifier[str2] operator[SEP] {
Keyword[return] identifier[FastStringUtils] operator[SEP] identifier[noCopyStringFromChars] operator[SEP] identifier[Chr] operator[SEP] identifier[add] operator[SEP] identifier[FastStringUtils] operator[SEP] identifier[toCharArray] operator[SEP] identifier[str] operator[SEP] , identifier[FastStringUtils] operator[SEP] identifier[toCharArray] operator[SEP] identifier[str2] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T extends MPBase> JsonObject getJsonFromResource(T resourceObject) {
return (JsonObject) gson.toJsonTree(resourceObject);
} | class class_name[name] begin[{]
method[getJsonFromResource, return_type[type[JsonObject]], modifier[public static], parameter[resourceObject]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=resourceObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toJsonTree, postfix_operators=[], prefix_operators=[], qualifier=gson, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[MPBase] operator[>] identifier[JsonObject] identifier[getJsonFromResource] operator[SEP] identifier[T] identifier[resourceObject] operator[SEP] {
Keyword[return] operator[SEP] identifier[JsonObject] operator[SEP] identifier[gson] operator[SEP] identifier[toJsonTree] operator[SEP] identifier[resourceObject] operator[SEP] operator[SEP]
}
|
protected void putAspectAdviceBean(String aspectId, Object adviceBean) {
if (aspectAdviceResult == null) {
aspectAdviceResult = new AspectAdviceResult();
}
aspectAdviceResult.putAspectAdviceBean(aspectId, adviceBean);
} | class class_name[name] begin[{]
method[putAspectAdviceBean, return_type[void], modifier[protected], parameter[aspectId, adviceBean]] begin[{]
if[binary_operation[member[.aspectAdviceResult], ==, literal[null]]] begin[{]
assign[member[.aspectAdviceResult], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AspectAdviceResult, sub_type=None))]
else begin[{]
None
end[}]
call[aspectAdviceResult.putAspectAdviceBean, parameter[member[.aspectId], member[.adviceBean]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[putAspectAdviceBean] operator[SEP] identifier[String] identifier[aspectId] , identifier[Object] identifier[adviceBean] operator[SEP] {
Keyword[if] operator[SEP] identifier[aspectAdviceResult] operator[==] Other[null] operator[SEP] {
identifier[aspectAdviceResult] operator[=] Keyword[new] identifier[AspectAdviceResult] operator[SEP] operator[SEP] operator[SEP]
}
identifier[aspectAdviceResult] operator[SEP] identifier[putAspectAdviceBean] operator[SEP] identifier[aspectId] , identifier[adviceBean] operator[SEP] operator[SEP]
}
|
public void pass(String action, String expectedResult, String actualResult) {
passes++;
recordStep(action, expectedResult, actualResult, false, Success.PASS);
} | class class_name[name] begin[{]
method[pass, return_type[void], modifier[public], parameter[action, expectedResult, actualResult]] begin[{]
member[.passes]
call[.recordStep, parameter[member[.action], member[.expectedResult], member[.actualResult], literal[false], member[Success.PASS]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[pass] operator[SEP] identifier[String] identifier[action] , identifier[String] identifier[expectedResult] , identifier[String] identifier[actualResult] operator[SEP] {
identifier[passes] operator[++] operator[SEP] identifier[recordStep] operator[SEP] identifier[action] , identifier[expectedResult] , identifier[actualResult] , literal[boolean] , identifier[Success] operator[SEP] identifier[PASS] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.