code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static String setParameters(String value, final Object[] params) {
if (params != null) {
for (int i = 0; i < params.length; i++) {
value = value.replaceAll("\\{" + i + "\\}", params[i].toString());
}
}
return value;
} | class class_name[name] begin[{]
method[setParameters, return_type[type[String]], modifier[public static], parameter[value, params]] begin[{]
if[binary_operation[member[.params], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\{"), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\}"), operator=+), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=replaceAll, postfix_operators=[], prefix_operators=[], qualifier=value, 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=params, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[setParameters] operator[SEP] identifier[String] identifier[value] , Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[params] operator[SEP] {
Keyword[if] operator[SEP] identifier[params] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[params] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[value] operator[=] identifier[value] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[+] identifier[i] operator[+] literal[String] , identifier[params] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[value] operator[SEP]
}
|
private Coordinate getLocationWithinMaxBounds(Coordinate original) {
double x = original.getX();
double y = original.getY();
if (maxBounds != null) {
if (original.getX() < maxBounds.getX()) {
x = maxBounds.getX();
} else if (original.getX() > maxBounds.getMaxX()) {
x = maxBounds.getMaxX();
}
if (original.getY() < maxBounds.getY()) {
y = maxBounds.getY();
} else if (original.getY() > maxBounds.getMaxY()) {
y = maxBounds.getMaxY();
}
}
return new Coordinate(x, y);
} | class class_name[name] begin[{]
method[getLocationWithinMaxBounds, return_type[type[Coordinate]], modifier[private], parameter[original]] begin[{]
local_variable[type[double], x]
local_variable[type[double], y]
if[binary_operation[member[.maxBounds], !=, literal[null]]] begin[{]
if[binary_operation[call[original.getX, parameter[]], <, call[maxBounds.getX, parameter[]]]] begin[{]
assign[member[.x], call[maxBounds.getX, parameter[]]]
else begin[{]
if[binary_operation[call[original.getX, parameter[]], >, call[maxBounds.getMaxX, parameter[]]]] begin[{]
assign[member[.x], call[maxBounds.getMaxX, parameter[]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[original.getY, parameter[]], <, call[maxBounds.getY, parameter[]]]] begin[{]
assign[member[.y], call[maxBounds.getY, parameter[]]]
else begin[{]
if[binary_operation[call[original.getY, parameter[]], >, call[maxBounds.getMaxY, parameter[]]]] begin[{]
assign[member[.y], call[maxBounds.getMaxY, parameter[]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, 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=Coordinate, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[Coordinate] identifier[getLocationWithinMaxBounds] operator[SEP] identifier[Coordinate] identifier[original] operator[SEP] {
Keyword[double] identifier[x] operator[=] identifier[original] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[y] operator[=] identifier[original] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxBounds] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[original] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[<] identifier[maxBounds] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] {
identifier[x] operator[=] identifier[maxBounds] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[original] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[>] identifier[maxBounds] operator[SEP] identifier[getMaxX] operator[SEP] operator[SEP] operator[SEP] {
identifier[x] operator[=] identifier[maxBounds] operator[SEP] identifier[getMaxX] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[original] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[<] identifier[maxBounds] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] {
identifier[y] operator[=] identifier[maxBounds] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[original] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[>] identifier[maxBounds] operator[SEP] identifier[getMaxY] operator[SEP] operator[SEP] operator[SEP] {
identifier[y] operator[=] identifier[maxBounds] operator[SEP] identifier[getMaxY] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[Coordinate] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP]
}
|
@Override
public RecordReader createReader(InputSplit split) throws IOException, InterruptedException {
RecordReader reader = new ListStringRecordReader();
reader.initialize(split);
return reader;
} | class class_name[name] begin[{]
method[createReader, return_type[type[RecordReader]], modifier[public], parameter[split]] begin[{]
local_variable[type[RecordReader], reader]
call[reader.initialize, parameter[member[.split]]]
return[member[.reader]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RecordReader] identifier[createReader] operator[SEP] identifier[InputSplit] identifier[split] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[RecordReader] identifier[reader] operator[=] Keyword[new] identifier[ListStringRecordReader] operator[SEP] operator[SEP] operator[SEP] identifier[reader] operator[SEP] identifier[initialize] operator[SEP] identifier[split] operator[SEP] operator[SEP] Keyword[return] identifier[reader] operator[SEP]
}
|
@Override
public void doHandshake(NextFilter nextFilter) throws ProxyAuthException {
LOGGER.debug(" doHandshake()");
if (step > 0 && challengePacket == null) {
throw new IllegalStateException("NTLM Challenge packet not received");
}
HttpProxyRequest req = (HttpProxyRequest) request;
Map<String, List<String>> headers = req.getHeaders() != null ? req
.getHeaders() : new HashMap<>();
String domain = req.getProperties().get(
HttpProxyConstants.DOMAIN_PROPERTY);
String workstation = req.getProperties().get(
HttpProxyConstants.WORKSTATION_PROPERTY);
if (step > 0) {
LOGGER.debug(" sending NTLM challenge response");
byte[] challenge = NTLMUtilities
.extractChallengeFromType2Message(challengePacket);
int serverFlags = NTLMUtilities
.extractFlagsFromType2Message(challengePacket);
String username = req.getProperties().get(
HttpProxyConstants.USER_PROPERTY);
String password = req.getProperties().get(
HttpProxyConstants.PWD_PROPERTY);
byte[] authenticationPacket = NTLMUtilities.createType3Message(
username, password, challenge, domain, workstation,
serverFlags, null);
StringUtilities.addValueToHeader(headers,
"Proxy-Authorization",
"NTLM "+ new String(Base64
.encodeBase64(authenticationPacket)),
true);
} else {
LOGGER.debug(" sending NTLM negotiation packet");
byte[] negotiationPacket = NTLMUtilities.createType1Message(
workstation, domain, null, null);
StringUtilities
.addValueToHeader(
headers,
"Proxy-Authorization",
"NTLM "+ new String(Base64
.encodeBase64(negotiationPacket)),
true);
}
addKeepAliveHeaders(headers);
req.setHeaders(headers);
writeRequest(nextFilter, req);
step++;
} | class class_name[name] begin[{]
method[doHandshake, return_type[void], modifier[public], parameter[nextFilter]] begin[{]
call[LOGGER.debug, parameter[literal[" doHandshake()"]]]
if[binary_operation[binary_operation[member[.step], >, literal[0]], &&, binary_operation[member[.challengePacket], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NTLM Challenge packet not received")], 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[}]
local_variable[type[HttpProxyRequest], req]
local_variable[type[Map], headers]
local_variable[type[String], domain]
local_variable[type[String], workstation]
if[binary_operation[member[.step], >, literal[0]]] begin[{]
call[LOGGER.debug, parameter[literal[" sending NTLM challenge response"]]]
local_variable[type[byte], challenge]
local_variable[type[int], serverFlags]
local_variable[type[String], username]
local_variable[type[String], password]
local_variable[type[byte], authenticationPacket]
call[StringUtilities.addValueToHeader, parameter[member[.headers], literal["Proxy-Authorization"], binary_operation[literal["NTLM "], +, ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=authenticationPacket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeBase64, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], literal[true]]]
else begin[{]
call[LOGGER.debug, parameter[literal[" sending NTLM negotiation packet"]]]
local_variable[type[byte], negotiationPacket]
call[StringUtilities.addValueToHeader, parameter[member[.headers], literal["Proxy-Authorization"], binary_operation[literal["NTLM "], +, ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=negotiationPacket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeBase64, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], literal[true]]]
end[}]
call[.addKeepAliveHeaders, parameter[member[.headers]]]
call[req.setHeaders, parameter[member[.headers]]]
call[.writeRequest, parameter[member[.nextFilter], member[.req]]]
member[.step]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doHandshake] operator[SEP] identifier[NextFilter] identifier[nextFilter] operator[SEP] Keyword[throws] identifier[ProxyAuthException] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[step] operator[>] Other[0] operator[&&] identifier[challengePacket] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[HttpProxyRequest] identifier[req] operator[=] operator[SEP] identifier[HttpProxyRequest] operator[SEP] identifier[request] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[headers] operator[=] identifier[req] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[req] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[domain] operator[=] identifier[req] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpProxyConstants] operator[SEP] identifier[DOMAIN_PROPERTY] operator[SEP] operator[SEP] identifier[String] identifier[workstation] operator[=] identifier[req] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpProxyConstants] operator[SEP] identifier[WORKSTATION_PROPERTY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[step] operator[>] Other[0] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[challenge] operator[=] identifier[NTLMUtilities] operator[SEP] identifier[extractChallengeFromType2Message] operator[SEP] identifier[challengePacket] operator[SEP] operator[SEP] Keyword[int] identifier[serverFlags] operator[=] identifier[NTLMUtilities] operator[SEP] identifier[extractFlagsFromType2Message] operator[SEP] identifier[challengePacket] operator[SEP] operator[SEP] identifier[String] identifier[username] operator[=] identifier[req] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpProxyConstants] operator[SEP] identifier[USER_PROPERTY] operator[SEP] operator[SEP] identifier[String] identifier[password] operator[=] identifier[req] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpProxyConstants] operator[SEP] identifier[PWD_PROPERTY] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[authenticationPacket] operator[=] identifier[NTLMUtilities] operator[SEP] identifier[createType3Message] operator[SEP] identifier[username] , identifier[password] , identifier[challenge] , identifier[domain] , identifier[workstation] , identifier[serverFlags] , Other[null] operator[SEP] operator[SEP] identifier[StringUtilities] operator[SEP] identifier[addValueToHeader] operator[SEP] identifier[headers] , literal[String] , literal[String] operator[+] Keyword[new] identifier[String] operator[SEP] identifier[Base64] operator[SEP] identifier[encodeBase64] operator[SEP] identifier[authenticationPacket] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[negotiationPacket] operator[=] identifier[NTLMUtilities] operator[SEP] identifier[createType1Message] operator[SEP] identifier[workstation] , identifier[domain] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[StringUtilities] operator[SEP] identifier[addValueToHeader] operator[SEP] identifier[headers] , literal[String] , literal[String] operator[+] Keyword[new] identifier[String] operator[SEP] identifier[Base64] operator[SEP] identifier[encodeBase64] operator[SEP] identifier[negotiationPacket] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
identifier[addKeepAliveHeaders] operator[SEP] identifier[headers] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setHeaders] operator[SEP] identifier[headers] operator[SEP] operator[SEP] identifier[writeRequest] operator[SEP] identifier[nextFilter] , identifier[req] operator[SEP] operator[SEP] identifier[step] operator[++] operator[SEP]
}
|
public GenericDraweeHierarchyBuilder setPlaceholderImage(
Drawable placeholderDrawable, @Nullable ScalingUtils.ScaleType placeholderImageScaleType) {
mPlaceholderImage = placeholderDrawable;
mPlaceholderImageScaleType = placeholderImageScaleType;
return this;
} | class class_name[name] begin[{]
method[setPlaceholderImage, return_type[type[GenericDraweeHierarchyBuilder]], modifier[public], parameter[placeholderDrawable, placeholderImageScaleType]] begin[{]
assign[member[.mPlaceholderImage], member[.placeholderDrawable]]
assign[member[.mPlaceholderImageScaleType], member[.placeholderImageScaleType]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[GenericDraweeHierarchyBuilder] identifier[setPlaceholderImage] operator[SEP] identifier[Drawable] identifier[placeholderDrawable] , annotation[@] identifier[Nullable] identifier[ScalingUtils] operator[SEP] identifier[ScaleType] identifier[placeholderImageScaleType] operator[SEP] {
identifier[mPlaceholderImage] operator[=] identifier[placeholderDrawable] operator[SEP] identifier[mPlaceholderImageScaleType] operator[=] identifier[placeholderImageScaleType] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public void handle(RequestContext context, AccessDeniedException e) throws SecurityProviderException, IOException {
saveException(context, e);
if (StringUtils.isNotEmpty(getErrorPageUrl())) {
forwardToErrorPage(context);
} else {
sendError(e, context);
}
} | class class_name[name] begin[{]
method[handle, return_type[void], modifier[public], parameter[context, e]] begin[{]
call[.saveException, parameter[member[.context], member[.e]]]
if[call[StringUtils.isNotEmpty, parameter[call[.getErrorPageUrl, parameter[]]]]] begin[{]
call[.forwardToErrorPage, parameter[member[.context]]]
else begin[{]
call[.sendError, parameter[member[.e], member[.context]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[RequestContext] identifier[context] , identifier[AccessDeniedException] identifier[e] operator[SEP] Keyword[throws] identifier[SecurityProviderException] , identifier[IOException] {
identifier[saveException] operator[SEP] identifier[context] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[getErrorPageUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[forwardToErrorPage] operator[SEP] identifier[context] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sendError] operator[SEP] identifier[e] , identifier[context] operator[SEP] operator[SEP]
}
}
|
static private String generateEmail(int id) {
String address;
int pseudorandom = id % 5;
address = Integer.toString(id) + "@" + emailservice[pseudorandom] + ".com";
return address;
} | class class_name[name] begin[{]
method[generateEmail, return_type[type[String]], modifier[private static], parameter[id]] begin[{]
local_variable[type[String], address]
local_variable[type[int], pseudorandom]
assign[member[.address], binary_operation[binary_operation[binary_operation[call[Integer.toString, parameter[member[.id]]], +, literal["@"]], +, member[.emailservice]], +, literal[".com"]]]
return[member[.address]]
end[}]
END[}] | Keyword[static] Keyword[private] identifier[String] identifier[generateEmail] operator[SEP] Keyword[int] identifier[id] operator[SEP] {
identifier[String] identifier[address] operator[SEP] Keyword[int] identifier[pseudorandom] operator[=] identifier[id] operator[%] Other[5] operator[SEP] identifier[address] operator[=] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[id] operator[SEP] operator[+] literal[String] operator[+] identifier[emailservice] operator[SEP] identifier[pseudorandom] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[return] identifier[address] operator[SEP]
}
|
public static Object callMethod(OgnlContext context, Object target, String methodName, Object[] args)
throws OgnlException
{
if (target == null)
throw new NullPointerException("target is null for method " + methodName);
return getMethodAccessor(target.getClass()).callMethod(context, target, methodName, args);
} | class class_name[name] begin[{]
method[callMethod, return_type[type[Object]], modifier[public static], parameter[context, target, methodName, args]] begin[{]
if[binary_operation[member[.target], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="target is null for method "), operandr=MemberReference(member=methodName, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.getMethodAccessor, parameter[call[target.getClass, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[callMethod] operator[SEP] identifier[OgnlContext] identifier[context] , identifier[Object] identifier[target] , identifier[String] identifier[methodName] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[OgnlException] {
Keyword[if] operator[SEP] identifier[target] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[+] identifier[methodName] operator[SEP] operator[SEP] Keyword[return] identifier[getMethodAccessor] operator[SEP] identifier[target] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[callMethod] operator[SEP] identifier[context] , identifier[target] , identifier[methodName] , identifier[args] operator[SEP] operator[SEP]
}
|
public static boolean isLocalContentUri(@Nullable Uri uri) {
final String scheme = getSchemeOrNull(uri);
return LOCAL_CONTENT_SCHEME.equals(scheme);
} | class class_name[name] begin[{]
method[isLocalContentUri, return_type[type[boolean]], modifier[public static], parameter[uri]] begin[{]
local_variable[type[String], scheme]
return[call[LOCAL_CONTENT_SCHEME.equals, parameter[member[.scheme]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isLocalContentUri] operator[SEP] annotation[@] identifier[Nullable] identifier[Uri] identifier[uri] operator[SEP] {
Keyword[final] identifier[String] identifier[scheme] operator[=] identifier[getSchemeOrNull] operator[SEP] identifier[uri] operator[SEP] operator[SEP] Keyword[return] identifier[LOCAL_CONTENT_SCHEME] operator[SEP] identifier[equals] operator[SEP] identifier[scheme] operator[SEP] operator[SEP]
}
|
public Set<Association> getAssociationsFromDB(final JAASSystem _jaasSystem)
throws EFapsException
{
final Set<Association> ret = new HashSet<>();
Connection con = null;
try {
final List<Long> associationIds = new ArrayList<>();
con = Context.getConnection();
Statement stmt = null;
try {
final StringBuilder cmd = new StringBuilder();
cmd.append("select ").append("ID ")
.append("from T_USERASSOC ")
.append("where GROUPID in (")
.append("select ").append("USERABSTRACTTO ")
.append("from V_USERPERSON2GROUP ")
.append("where USERABSTRACTFROM =").append(getId())
.append(") and ROLEID in (")
.append("select ").append("USERABSTRACTTO ")
.append("from V_USERPERSON2ROLE ")
.append("where USERABSTRACTFROM =").append(getId())
.append(")");
stmt = con.createStatement();
final ResultSet resultset = stmt.executeQuery(cmd.toString());
while (resultset.next()) {
associationIds.add(resultset.getLong(1));
}
resultset.close();
} catch (final SQLException e) {
throw new EFapsException(getClass(), "getAssociationsFromDB.SQLException", e, getName());
} finally {
try {
if (stmt != null) {
stmt.close();
con.commit();
}
} catch (final SQLException e) {
throw new EFapsException(getClass(), "getAssociationsFromDB.SQLException", e, getName());
}
}
for (final Long associationId : associationIds) {
final Association association = Association.get(associationId);
ret.add(association);
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("could not read child type ids", e);
}
}
return ret;
} | class class_name[name] begin[{]
method[getAssociationsFromDB, return_type[type[Set]], modifier[public], parameter[_jaasSystem]] begin[{]
local_variable[type[Set], ret]
local_variable[type[Connection], con]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=associationIds)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=con, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=stmt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Statement, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=cmd)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="select ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ID ")], 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="from T_USERASSOC ")], 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="where GROUPID in (")], 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="select ")], 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="USERABSTRACTTO ")], 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="from V_USERPERSON2GROUP ")], 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="where USERABSTRACTFROM =")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], 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=") and ROLEID in (")], 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="select ")], 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="USERABSTRACTTO ")], 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="from V_USERPERSON2ROLE ")], 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="where USERABSTRACTFROM =")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], 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)], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=createStatement, postfix_operators=[], prefix_operators=[], qualifier=con, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None)], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), name=resultset)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=resultset, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=associationIds, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=resultset, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=resultset, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getAssociationsFromDB.SQLException"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EFapsException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=commit, postfix_operators=[], prefix_operators=[], qualifier=con, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getAssociationsFromDB.SQLException"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EFapsException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)], label=None, resources=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=associationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=Association, selectors=[], type_arguments=None), name=association)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Association, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=association, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=associationIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=associationId)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))), label=None)], catches=None, finally_block=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=con, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isClosed, postfix_operators=[], prefix_operators=['!'], qualifier=con, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=con, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="could not read child type ids"), 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=CacheReloadException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[Association] operator[>] identifier[getAssociationsFromDB] operator[SEP] Keyword[final] identifier[JAASSystem] identifier[_jaasSystem] operator[SEP] Keyword[throws] identifier[EFapsException] {
Keyword[final] identifier[Set] operator[<] identifier[Association] operator[>] identifier[ret] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Connection] identifier[con] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[List] operator[<] identifier[Long] operator[>] identifier[associationIds] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[con] operator[=] identifier[Context] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[Statement] identifier[stmt] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[StringBuilder] identifier[cmd] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[cmd] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[stmt] operator[=] identifier[con] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ResultSet] identifier[resultset] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] identifier[cmd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[resultset] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[associationIds] operator[SEP] identifier[add] operator[SEP] identifier[resultset] operator[SEP] identifier[getLong] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[resultset] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EFapsException] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , literal[String] , identifier[e] , identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[stmt] operator[!=] Other[null] operator[SEP] {
identifier[stmt] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[con] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EFapsException] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , literal[String] , identifier[e] , identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[final] identifier[Long] identifier[associationId] operator[:] identifier[associationIds] operator[SEP] {
Keyword[final] identifier[Association] identifier[association] operator[=] identifier[Association] operator[SEP] identifier[get] operator[SEP] identifier[associationId] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[association] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[con] operator[!=] Other[null] operator[&&] operator[!] identifier[con] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[con] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CacheReloadException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static long endTime(String str, PrintStream stream) {
long elapsed = endTime();
stream.println(str + " Time elapsed: " + (elapsed) + " ms");
return elapsed;
} | class class_name[name] begin[{]
method[endTime, return_type[type[long]], modifier[public static], parameter[str, stream]] begin[{]
local_variable[type[long], elapsed]
call[stream.println, parameter[binary_operation[binary_operation[member[.str], +, literal[" Time elapsed: "]], +, Cast(expression=Literal(postfix_operators=[], prefix_operators=['+'], qualifier=None, selectors=[], value=" ms"), type=ReferenceType(arguments=None, dimensions=[], name=elapsed, sub_type=None))]]]
return[member[.elapsed]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[endTime] operator[SEP] identifier[String] identifier[str] , identifier[PrintStream] identifier[stream] operator[SEP] {
Keyword[long] identifier[elapsed] operator[=] identifier[endTime] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[str] operator[+] literal[String] operator[+] operator[SEP] identifier[elapsed] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[elapsed] operator[SEP]
}
|
public static boolean writeObjectToFile(Object obj, File f) {
try {
FileOutputStream fout = new FileOutputStream(f);
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(obj);
oos.close();
} catch (Exception e) {
System.out.println("Error writing Object to file: "
+ e.getMessage());
return false;
}
return true;
} | class class_name[name] begin[{]
method[writeObjectToFile, return_type[type[boolean]], modifier[public static], parameter[obj, f]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None)), name=fout)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=fout, 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=ObjectOutputStream, sub_type=None)), name=oos)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectOutputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=oos, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=oos, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error writing Object to file: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[writeObjectToFile] operator[SEP] identifier[Object] identifier[obj] , identifier[File] identifier[f] operator[SEP] {
Keyword[try] {
identifier[FileOutputStream] identifier[fout] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[oos] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] identifier[fout] operator[SEP] operator[SEP] identifier[oos] operator[SEP] identifier[writeObject] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[oos] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public byte[] toByte(Object bean, Charset charset)
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Object value = this.getFieldValue(bean);
if (isDynamicField()) {
return getDynamicFieldByteValue(value, charset);
} else if (String.class.equals(field.getType())) {
// 如果是动态属性
return BytesUtil.objString2Byte((String) value, max, charset);
} else if (long.class.equals(field.getType())) {
return BytesUtil.long2buff((long) value);
} else if (int.class.equals(field.getType())) {
return BytesUtil.long2buff((int) value);
} else if (Date.class.equals(field.getType())) {
throw new FdfsColumnMapException("Date 还不支持");
} else if (byte.class.equals(field.getType())) {
byte[] result = new byte[1];
result[0] = (byte) value;
return result;
} else if (boolean.class.equals(field.getType())) {
throw new FdfsColumnMapException("boolean 还不支持");
}
throw new FdfsColumnMapException("将属性值转换为byte时未识别的FdfsColumn类型" + field.getName());
} | class class_name[name] begin[{]
method[toByte, return_type[type[byte]], modifier[public], parameter[bean, charset]] begin[{]
local_variable[type[Object], value]
if[call[.isDynamicField, parameter[]]] begin[{]
return[call[.getDynamicFieldByteValue, parameter[member[.value], member[.charset]]]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))] begin[{]
return[call[BytesUtil.objString2Byte, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), member[.max], member[.charset]]]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=long))] begin[{]
return[call[BytesUtil.long2buff, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))]]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=int))] begin[{]
return[call[BytesUtil.long2buff, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Date 还不支持")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FdfsColumnMapException, sub_type=None)), label=None)
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=byte))] begin[{]
local_variable[type[byte], result]
assign[member[.result], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
return[member[.result]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=boolean))] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="boolean 还不支持")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FdfsColumnMapException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="将属性值转换为byte时未识别的FdfsColumn类型"), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FdfsColumnMapException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[toByte] operator[SEP] identifier[Object] identifier[bean] , identifier[Charset] identifier[charset] operator[SEP] Keyword[throws] identifier[IllegalAccessException] , identifier[InvocationTargetException] , identifier[NoSuchMethodException] {
identifier[Object] identifier[value] operator[=] Keyword[this] operator[SEP] identifier[getFieldValue] operator[SEP] identifier[bean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isDynamicField] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[getDynamicFieldByteValue] operator[SEP] identifier[value] , identifier[charset] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[BytesUtil] operator[SEP] identifier[objString2Byte] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[value] , identifier[max] , identifier[charset] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[long] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[BytesUtil] operator[SEP] identifier[long2buff] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[int] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[BytesUtil] operator[SEP] identifier[long2buff] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Date] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FdfsColumnMapException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[byte] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[0] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[value] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FdfsColumnMapException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[FdfsColumnMapException] operator[SEP] literal[String] operator[+] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static InitializationException newInitializationException(String message, Object... args) {
return newInitializationException(null, message, args);
} | class class_name[name] begin[{]
method[newInitializationException, return_type[type[InitializationException]], modifier[public static], parameter[message, args]] begin[{]
return[call[.newInitializationException, parameter[literal[null], member[.message], member[.args]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InitializationException] identifier[newInitializationException] operator[SEP] identifier[String] identifier[message] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[return] identifier[newInitializationException] operator[SEP] Other[null] , identifier[message] , identifier[args] operator[SEP] operator[SEP]
}
|
private static List<Field> _getAnnotationColumns(Class<?> clazz,
Class<? extends Annotation> annoClazz) {
if(clazz == null) {
return new ArrayList<Field>();
}
List<Class<?>> classLink = new ArrayList<Class<?>>();
Class<?> curClass = clazz;
while (curClass != null) {
classLink.add(curClass);
curClass = curClass.getSuperclass();
}
return _getFields(classLink, annoClazz);
} | class class_name[name] begin[{]
method[_getAnnotationColumns, return_type[type[List]], modifier[private static], parameter[clazz, annoClazz]] begin[{]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
return[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=Field, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[List], classLink]
local_variable[type[Class], curClass]
while[binary_operation[member[.curClass], !=, literal[null]]] begin[{]
call[classLink.add, parameter[member[.curClass]]]
assign[member[.curClass], call[curClass.getSuperclass, parameter[]]]
end[}]
return[call[._getFields, parameter[member[.classLink], member[.annoClazz]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[List] operator[<] identifier[Field] operator[>] identifier[_getAnnotationColumns] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[annoClazz] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] identifier[Field] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[classLink] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[curClass] operator[=] identifier[clazz] operator[SEP] Keyword[while] operator[SEP] identifier[curClass] operator[!=] Other[null] operator[SEP] {
identifier[classLink] operator[SEP] identifier[add] operator[SEP] identifier[curClass] operator[SEP] operator[SEP] identifier[curClass] operator[=] identifier[curClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_getFields] operator[SEP] identifier[classLink] , identifier[annoClazz] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/citygml/bridge/2.0", name = "_GenericApplicationPropertyOfBridgePart")
public JAXBElement<Object> create_GenericApplicationPropertyOfBridgePart(Object value) {
return new JAXBElement<Object>(__GenericApplicationPropertyOfBridgePart_QNAME, Object.class, null, value);
} | class class_name[name] begin[{]
method[create_GenericApplicationPropertyOfBridgePart, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=__GenericApplicationPropertyOfBridgePart_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[Object] operator[>] identifier[create_GenericApplicationPropertyOfBridgePart] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[Object] operator[>] operator[SEP] identifier[__GenericApplicationPropertyOfBridgePart_QNAME] , identifier[Object] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public static void main(final String[] args) {
Switch about = new Switch("a", "about", "display about message");
Switch help = new Switch("h", "help", "display help message");
FileArgument inputHmlFile = new FileArgument("i", "input-hml-file", "input HML file, default stdin", false);
FileArgument outputFile = new FileArgument("o", "output-file", "output allele assignment file, default stdout", false);
ArgumentList arguments = new ArgumentList(about, help, inputHmlFile, outputFile);
CommandLine commandLine = new CommandLine(args);
ExtractExpectedHaploids extractExpectedHaploids = null;
try
{
CommandLineParser.parse(commandLine, arguments);
if (about.wasFound()) {
About.about(System.out);
System.exit(0);
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
extractExpectedHaploids = new ExtractExpectedHaploids(inputHmlFile.getValue(), outputFile.getValue());
}
catch (CommandLineParseException | IllegalArgumentException e) {
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(extractExpectedHaploids.call());
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[Switch], about]
local_variable[type[Switch], help]
local_variable[type[FileArgument], inputHmlFile]
local_variable[type[FileArgument], outputFile]
local_variable[type[ArgumentList], arguments]
local_variable[type[CommandLine], commandLine]
local_variable[type[ExtractExpectedHaploids], extractExpectedHaploids]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=CommandLineParser, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=about, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=about, postfix_operators=[], prefix_operators=[], qualifier=About, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=help, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=USAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=Usage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=extractExpectedHaploids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=inputHmlFile, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=outputFile, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExtractExpectedHaploids, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=USAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=Usage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], 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=['CommandLineParseException', 'IllegalArgumentException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=call, postfix_operators=[], prefix_operators=[], qualifier=extractExpectedHaploids, selectors=[], type_arguments=None)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, 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), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], 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)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[Switch] identifier[about] operator[=] Keyword[new] identifier[Switch] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[Switch] identifier[help] operator[=] Keyword[new] identifier[Switch] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[FileArgument] identifier[inputHmlFile] operator[=] Keyword[new] identifier[FileArgument] operator[SEP] literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[FileArgument] identifier[outputFile] operator[=] Keyword[new] identifier[FileArgument] operator[SEP] literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[ArgumentList] identifier[arguments] operator[=] Keyword[new] identifier[ArgumentList] operator[SEP] identifier[about] , identifier[help] , identifier[inputHmlFile] , identifier[outputFile] operator[SEP] operator[SEP] identifier[CommandLine] identifier[commandLine] operator[=] Keyword[new] identifier[CommandLine] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[ExtractExpectedHaploids] identifier[extractExpectedHaploids] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[CommandLineParser] operator[SEP] identifier[parse] operator[SEP] identifier[commandLine] , identifier[arguments] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[about] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[About] operator[SEP] identifier[about] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[help] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[Usage] operator[SEP] identifier[usage] operator[SEP] identifier[USAGE] , Other[null] , identifier[commandLine] , identifier[arguments] , identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[extractExpectedHaploids] operator[=] Keyword[new] identifier[ExtractExpectedHaploids] operator[SEP] identifier[inputHmlFile] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[outputFile] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CommandLineParseException] operator[|] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
identifier[Usage] operator[SEP] identifier[usage] operator[SEP] identifier[USAGE] , identifier[e] , identifier[commandLine] , identifier[arguments] , identifier[System] operator[SEP] identifier[err] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[System] operator[SEP] identifier[exit] operator[SEP] identifier[extractExpectedHaploids] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
|
@Override
public Module start(Module.Context context) {
// FIXME: logger is a hack!
final Logger logger = new Logger.Default(System.err);
// List of commands to use
context.register(Build.Platform.class, WHILEY_PLATFORM);
// List of content types
context.register(Content.Type.class, WhileyFile.ContentType);
context.register(Content.Type.class, WyilFile.ContentType);
// Done
return new Module() {
// what goes here?
};
} | class class_name[name] begin[{]
method[start, return_type[type[Module]], modifier[public], parameter[context]] begin[{]
local_variable[type[Logger], logger]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=Build, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Platform, sub_type=None)), member[.WHILEY_PLATFORM]]]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=Content, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Type, sub_type=None)), member[WhileyFile.ContentType]]]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=Content, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Type, sub_type=None)), member[WyilFile.ContentType]]]
return[ClassCreator(arguments=[], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Module, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Module] identifier[start] operator[SEP] identifier[Module] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[final] identifier[Logger] identifier[logger] operator[=] Keyword[new] identifier[Logger] operator[SEP] identifier[Default] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[Build] operator[SEP] identifier[Platform] operator[SEP] Keyword[class] , identifier[WHILEY_PLATFORM] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[Content] operator[SEP] identifier[Type] operator[SEP] Keyword[class] , identifier[WhileyFile] operator[SEP] identifier[ContentType] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[Content] operator[SEP] identifier[Type] operator[SEP] Keyword[class] , identifier[WyilFile] operator[SEP] identifier[ContentType] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Module] operator[SEP] operator[SEP] {
} operator[SEP]
}
|
public void setPage(int page) {
if(page < 0)
throw new IllegalArgumentException(Bundle.getErrorString("PagerModel_IllegalPage"));
/* todo: need to check that the new 'current' page is in range given the first/last boundaries */
_currentRow = new Integer(page * getPageSize());
} | class class_name[name] begin[{]
method[setPage, return_type[void], modifier[public], parameter[page]] begin[{]
if[binary_operation[member[.page], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PagerModel_IllegalPage")], member=getErrorString, postfix_operators=[], prefix_operators=[], qualifier=Bundle, 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[._currentRow], ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=page, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getPageSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=*)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPage] operator[SEP] Keyword[int] identifier[page] operator[SEP] {
Keyword[if] operator[SEP] identifier[page] operator[<] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[Bundle] operator[SEP] identifier[getErrorString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[_currentRow] operator[=] Keyword[new] identifier[Integer] operator[SEP] identifier[page] operator[*] identifier[getPageSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<String> readLines(InputStream inputStream,
String charsetName) {
List<String> stringList = new ArrayList<>();
try {
consumeInputStream(inputStream, charsetName, stringList::add);
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturn(log, e,
"readLines", Collections::emptyList, inputStream, charsetName);
}
return stringList;
} | class class_name[name] begin[{]
method[readLines, return_type[type[List]], modifier[public static], parameter[inputStream, charsetName]] begin[{]
local_variable[type[List], stringList]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charsetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodReference(expression=MemberReference(member=stringList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=consumeInputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="readLines"), MethodReference(expression=MemberReference(member=Collections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=emptyList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charsetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleExceptionAndReturn, postfix_operators=[], prefix_operators=[], qualifier=JMExceptionManager, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.stringList]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[readLines] operator[SEP] identifier[InputStream] identifier[inputStream] , identifier[String] identifier[charsetName] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[stringList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[consumeInputStream] operator[SEP] identifier[inputStream] , identifier[charsetName] , identifier[stringList] operator[::] identifier[add] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] identifier[JMExceptionManager] operator[SEP] identifier[handleExceptionAndReturn] operator[SEP] identifier[log] , identifier[e] , literal[String] , identifier[Collections] operator[::] identifier[emptyList] , identifier[inputStream] , identifier[charsetName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[stringList] operator[SEP]
}
|
@Override
public void checkNotClosed() throws SISessionUnavailableException
{
if ((_closed) || (_closing && !(_asynchConsumer.isAsynchConsumerRunning())))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
//check the close conditions to produce a well-formed error message
if (_consumerKey.isClosedDueToDelete())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "SISessionDroppedException - deleted");
throw new SISessionDroppedException(
nls.getFormattedMessage(
"DESTINATION_DELETED_ERROR_CWSIP00221",
new Object[] {
_consumerDispatcher.getDestination().getName(),
_consumerDispatcher.getMessageProcessor().getMessagingEngineName() },
null));
}
if (_consumerKey.isClosedDueToReceiveExclusive())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "SISessionDroppedException - receive Exclusive");
throw new SISessionDroppedException(
nls.getFormattedMessage(
"DESTINATION_EXCLUSIVE_ERROR_CWSIP00222",
new Object[] {
_consumerDispatcher.getDestination().getName(),
_consumerDispatcher.getMessageProcessor().getMessagingEngineName() },
null));
}
if (_consumerKey.isClosedDueToLocalizationUnreachable())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "SISessionDroppedException - localisation unreachable");
throw new SISessionDroppedException(
nls.getFormattedMessage(
"DESTINATION_UNREACHABLE_ERROR_CWSIP00223",
new Object[] {
_consumerDispatcher.getDestination().getName(),
_consumerDispatcher.getMessageProcessor().getMessagingEngineName() },
null));
}
SISessionUnavailableException e =
new SISessionUnavailableException(
nls.getFormattedMessage(
"CONSUMER_CLOSED_ERROR_CWSIP0177",
new Object[] { _consumerDispatcher.getDestination().getName(),
_messageProcessor.getMessagingEngineName() },
null));
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "consumer closed");
throw e;
}
} | class class_name[name] begin[{]
method[checkNotClosed, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[._closed], ||, binary_operation[member[._closing], &&, call[_asynchConsumer.isAsynchConsumerRunning, parameter[]]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["checkNotClosed"]]]
else begin[{]
None
end[}]
if[call[_consumerKey.isClosedDueToDelete, parameter[]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["checkNotClosed"], literal["SISessionDroppedException - deleted"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DESTINATION_DELETED_ERROR_CWSIP00221"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getDestination, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getMessageProcessor, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getMessagingEngineName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SISessionDroppedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[_consumerKey.isClosedDueToReceiveExclusive, parameter[]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["checkNotClosed"], literal["SISessionDroppedException - receive Exclusive"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DESTINATION_EXCLUSIVE_ERROR_CWSIP00222"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getDestination, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getMessageProcessor, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getMessagingEngineName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SISessionDroppedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[_consumerKey.isClosedDueToLocalizationUnreachable, parameter[]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["checkNotClosed"], literal["SISessionDroppedException - localisation unreachable"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DESTINATION_UNREACHABLE_ERROR_CWSIP00223"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getDestination, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getMessageProcessor, postfix_operators=[], prefix_operators=[], qualifier=_consumerDispatcher, selectors=[MethodInvocation(arguments=[], member=getMessagingEngineName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SISessionDroppedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[SISessionUnavailableException], e]
call[SibTr.exception, parameter[member[.tc], member[.e]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["checkNotClosed"], literal["consumer closed"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[checkNotClosed] operator[SEP] operator[SEP] Keyword[throws] identifier[SISessionUnavailableException] {
Keyword[if] operator[SEP] operator[SEP] identifier[_closed] operator[SEP] operator[||] operator[SEP] identifier[_closing] operator[&&] operator[!] operator[SEP] identifier[_asynchConsumer] operator[SEP] identifier[isAsynchConsumerRunning] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_consumerKey] operator[SEP] identifier[isClosedDueToDelete] 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] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SISessionDroppedException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_consumerDispatcher] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[_consumerDispatcher] operator[SEP] identifier[getMessageProcessor] operator[SEP] operator[SEP] operator[SEP] identifier[getMessagingEngineName] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_consumerKey] operator[SEP] identifier[isClosedDueToReceiveExclusive] 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] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SISessionDroppedException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_consumerDispatcher] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[_consumerDispatcher] operator[SEP] identifier[getMessageProcessor] operator[SEP] operator[SEP] operator[SEP] identifier[getMessagingEngineName] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_consumerKey] operator[SEP] identifier[isClosedDueToLocalizationUnreachable] 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] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SISessionDroppedException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_consumerDispatcher] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[_consumerDispatcher] operator[SEP] identifier[getMessageProcessor] operator[SEP] operator[SEP] operator[SEP] identifier[getMessagingEngineName] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SISessionUnavailableException] identifier[e] operator[=] Keyword[new] identifier[SISessionUnavailableException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_consumerDispatcher] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[_messageProcessor] operator[SEP] identifier[getMessagingEngineName] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
public boolean executeJs(final String js) {
try {
browserPage.performBrowserPageAction(
BrowserPageAction.getActionByteBufferForExecuteJS(js));
return true;
} catch (final UnsupportedEncodingException e) {
// NOP
}
return false;
} | class class_name[name] begin[{]
method[executeJs, return_type[type[boolean]], modifier[public], parameter[js]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=js, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getActionByteBufferForExecuteJS, postfix_operators=[], prefix_operators=[], qualifier=BrowserPageAction, selectors=[], type_arguments=None)], member=performBrowserPageAction, postfix_operators=[], prefix_operators=[], qualifier=browserPage, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[executeJs] operator[SEP] Keyword[final] identifier[String] identifier[js] operator[SEP] {
Keyword[try] {
identifier[browserPage] operator[SEP] identifier[performBrowserPageAction] operator[SEP] identifier[BrowserPageAction] operator[SEP] identifier[getActionByteBufferForExecuteJS] operator[SEP] identifier[js] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Collection<ComponentBuilder> getComponentBuilders() {
final Collection<ComponentBuilder> result = new ArrayList<>();
result.addAll(_filterComponentBuilders);
result.addAll(_transformerComponentBuilders);
result.addAll(_analyzerComponentBuilders);
return result;
} | class class_name[name] begin[{]
method[getComponentBuilders, return_type[type[Collection]], modifier[public], parameter[]] begin[{]
local_variable[type[Collection], result]
call[result.addAll, parameter[member[._filterComponentBuilders]]]
call[result.addAll, parameter[member[._transformerComponentBuilders]]]
call[result.addAll, parameter[member[._analyzerComponentBuilders]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[ComponentBuilder] operator[>] identifier[getComponentBuilders] operator[SEP] operator[SEP] {
Keyword[final] identifier[Collection] operator[<] identifier[ComponentBuilder] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[_filterComponentBuilders] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[_transformerComponentBuilders] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[_analyzerComponentBuilders] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static synchronized BoBManager getInstanceFor(XMPPConnection connection) {
BoBManager bobManager = INSTANCES.get(connection);
if (bobManager == null) {
bobManager = new BoBManager(connection);
INSTANCES.put(connection, bobManager);
}
return bobManager;
} | class class_name[name] begin[{]
method[getInstanceFor, return_type[type[BoBManager]], modifier[synchronized public static], parameter[connection]] begin[{]
local_variable[type[BoBManager], bobManager]
if[binary_operation[member[.bobManager], ==, literal[null]]] begin[{]
assign[member[.bobManager], ClassCreator(arguments=[MemberReference(member=connection, 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=BoBManager, sub_type=None))]
call[INSTANCES.put, parameter[member[.connection], member[.bobManager]]]
else begin[{]
None
end[}]
return[member[.bobManager]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] identifier[BoBManager] identifier[getInstanceFor] operator[SEP] identifier[XMPPConnection] identifier[connection] operator[SEP] {
identifier[BoBManager] identifier[bobManager] operator[=] identifier[INSTANCES] operator[SEP] identifier[get] operator[SEP] identifier[connection] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bobManager] operator[==] Other[null] operator[SEP] {
identifier[bobManager] operator[=] Keyword[new] identifier[BoBManager] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[INSTANCES] operator[SEP] identifier[put] operator[SEP] identifier[connection] , identifier[bobManager] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bobManager] operator[SEP]
}
|
@Override
public void init(Configuration conf) {
String rootName = conf.get(ConfigConstants.CONF_DELIMITED_ROOT_NAME,
DEFAULT_ROOT_NAME);
rootStart = '<' + rootName + '>';
rootEnd = "</" + rootName + '>';
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[conf]] begin[{]
local_variable[type[String], rootName]
assign[member[.rootStart], binary_operation[binary_operation[literal['<'], +, member[.rootName]], +, literal['>']]]
assign[member[.rootEnd], binary_operation[binary_operation[literal["</"], +, member[.rootName]], +, literal['>']]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[Configuration] identifier[conf] operator[SEP] {
identifier[String] identifier[rootName] operator[=] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[ConfigConstants] operator[SEP] identifier[CONF_DELIMITED_ROOT_NAME] , identifier[DEFAULT_ROOT_NAME] operator[SEP] operator[SEP] identifier[rootStart] operator[=] literal[String] operator[+] identifier[rootName] operator[+] literal[String] operator[SEP] identifier[rootEnd] operator[=] literal[String] operator[+] identifier[rootName] operator[+] literal[String] operator[SEP]
}
|
public FlowStep updateFlowStep(FlowStep flowStepParam)
{
if(flowStepParam != null && this.serviceTicket != null)
{
flowStepParam.setServiceTicket(this.serviceTicket);
}
return new FlowStep(this.postJson(
flowStepParam, WS.Path.FlowStep.Version1.flowStepUpdate()));
} | class class_name[name] begin[{]
method[updateFlowStep, return_type[type[FlowStep]], modifier[public], parameter[flowStepParam]] begin[{]
if[binary_operation[binary_operation[member[.flowStepParam], !=, literal[null]], &&, binary_operation[THIS[member[None.serviceTicket]], !=, literal[null]]]] begin[{]
call[flowStepParam.setServiceTicket, parameter[THIS[member[None.serviceTicket]]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=flowStepParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=flowStepUpdate, postfix_operators=[], prefix_operators=[], qualifier=WS.Path.FlowStep.Version1, selectors=[], type_arguments=None)], member=postJson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FlowStep, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[FlowStep] identifier[updateFlowStep] operator[SEP] identifier[FlowStep] identifier[flowStepParam] operator[SEP] {
Keyword[if] operator[SEP] identifier[flowStepParam] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[serviceTicket] operator[!=] Other[null] operator[SEP] {
identifier[flowStepParam] operator[SEP] identifier[setServiceTicket] operator[SEP] Keyword[this] operator[SEP] identifier[serviceTicket] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[FlowStep] operator[SEP] Keyword[this] operator[SEP] identifier[postJson] operator[SEP] identifier[flowStepParam] , identifier[WS] operator[SEP] identifier[Path] operator[SEP] identifier[FlowStep] operator[SEP] identifier[Version1] operator[SEP] identifier[flowStepUpdate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public Iterable<ConstraintViolation<?>> convert(final ValidationResultInterface psource,
final E pbean) {
if (psource == null) {
return null;
}
return psource.getValidationErrorSet().stream()
.map(violation -> ConstraintViolationImpl.forBeanValidation( //
null, //
Collections.emptyMap(), //
Collections.emptyMap(), //
violation.getMessage(), //
(Class<E>) (pbean == null ? null : pbean.getClass()), //
pbean, //
null, //
null, //
PathImpl.createPathFromString(violation.getPropertyPath()), //
null, //
null, //
null))
.collect(Collectors.toList());
} | class class_name[name] begin[{]
method[convert, return_type[type[Iterable]], modifier[public], parameter[psource, pbean]] begin[{]
if[binary_operation[member[.psource], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[psource.getValidationErrorSet, parameter[]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Iterable] operator[<] identifier[ConstraintViolation] operator[<] operator[?] operator[>] operator[>] identifier[convert] operator[SEP] Keyword[final] identifier[ValidationResultInterface] identifier[psource] , Keyword[final] identifier[E] identifier[pbean] operator[SEP] {
Keyword[if] operator[SEP] identifier[psource] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[psource] operator[SEP] identifier[getValidationErrorSet] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[violation] operator[->] identifier[ConstraintViolationImpl] operator[SEP] identifier[forBeanValidation] operator[SEP] Other[null] , identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] , identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] , identifier[violation] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , operator[SEP] identifier[Class] operator[<] identifier[E] operator[>] operator[SEP] operator[SEP] identifier[pbean] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[pbean] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] , identifier[pbean] , Other[null] , Other[null] , identifier[PathImpl] operator[SEP] identifier[createPathFromString] operator[SEP] identifier[violation] operator[SEP] identifier[getPropertyPath] operator[SEP] operator[SEP] operator[SEP] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void removeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (exists)
{
int bufSize = (int)(raf.length() - origSize);
byte[] buf = new byte[bufSize];
raf.seek(origSize);
if (raf.read(buf) != buf.length)
{
throw new IOException("Error encountered while removing " + "id3v2 tag.");
}
raf.setLength(bufSize);
raf.seek(0);
raf.write(buf);
exists = false;
}
} | class class_name[name] begin[{]
method[removeTag, return_type[void], modifier[public], parameter[raf]] begin[{]
if[member[.exists]] begin[{]
local_variable[type[int], bufSize]
local_variable[type[byte], buf]
call[raf.seek, parameter[member[.origSize]]]
if[binary_operation[call[raf.read, parameter[member[.buf]]], !=, member[buf.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error encountered while removing "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id3v2 tag."), operator=+)], 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[}]
call[raf.setLength, parameter[member[.bufSize]]]
call[raf.seek, parameter[literal[0]]]
call[raf.write, parameter[member[.buf]]]
assign[member[.exists], literal[false]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeTag] operator[SEP] identifier[RandomAccessFile] identifier[raf] operator[SEP] Keyword[throws] identifier[FileNotFoundException] , identifier[IOException] {
Keyword[if] operator[SEP] identifier[exists] operator[SEP] {
Keyword[int] identifier[bufSize] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[raf] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[origSize] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[bufSize] operator[SEP] operator[SEP] identifier[raf] operator[SEP] identifier[seek] operator[SEP] identifier[origSize] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[raf] operator[SEP] identifier[read] operator[SEP] identifier[buf] operator[SEP] operator[!=] identifier[buf] operator[SEP] identifier[length] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[raf] operator[SEP] identifier[setLength] operator[SEP] identifier[bufSize] operator[SEP] operator[SEP] identifier[raf] operator[SEP] identifier[seek] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[raf] operator[SEP] identifier[write] operator[SEP] identifier[buf] operator[SEP] operator[SEP] identifier[exists] operator[=] literal[boolean] operator[SEP]
}
}
|
public static byte[] compress(String s, Charset encoding)
throws IOException
{
byte[] data = s.getBytes(encoding);
return compress(data);
} | class class_name[name] begin[{]
method[compress, return_type[type[byte]], modifier[public static], parameter[s, encoding]] begin[{]
local_variable[type[byte], data]
return[call[.compress, parameter[member[.data]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[compress] operator[SEP] identifier[String] identifier[s] , identifier[Charset] identifier[encoding] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[s] operator[SEP] identifier[getBytes] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] Keyword[return] identifier[compress] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
|
public static double sum(final double[] v1) {
double acc = 0.;
for(int row = 0; row < v1.length; row++) {
acc += v1[row];
}
return acc;
} | class class_name[name] begin[{]
method[sum, return_type[type[double]], modifier[public static], parameter[v1]] begin[{]
local_variable[type[double], acc]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=acc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=row, 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=length, postfix_operators=[], prefix_operators=[], qualifier=v1, 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[.acc]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[sum] operator[SEP] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[v1] operator[SEP] {
Keyword[double] identifier[acc] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[row] operator[=] Other[0] operator[SEP] identifier[row] operator[<] identifier[v1] operator[SEP] identifier[length] operator[SEP] identifier[row] operator[++] operator[SEP] {
identifier[acc] operator[+=] identifier[v1] operator[SEP] identifier[row] operator[SEP] operator[SEP]
}
Keyword[return] identifier[acc] operator[SEP]
}
|
public static ECKey signedMessageToKey(String message, String signatureBase64) throws SignatureException {
byte[] signatureEncoded;
try {
signatureEncoded = Base64.decode(signatureBase64);
} catch (RuntimeException e) {
// This is what you get back from Bouncy Castle if base64 doesn't decode :(
throw new SignatureException("Could not decode base64", e);
}
// Parse the signature bytes into r/s and the selector value.
if (signatureEncoded.length < 65)
throw new SignatureException("Signature truncated, expected 65 bytes and got " + signatureEncoded.length);
int header = signatureEncoded[0] & 0xFF;
// The header byte: 0x1B = first key with even y, 0x1C = first key with odd y,
// 0x1D = second key with even y, 0x1E = second key with odd y
if (header < 27 || header > 34)
throw new SignatureException("Header byte out of range: " + header);
BigInteger r = new BigInteger(1, Arrays.copyOfRange(signatureEncoded, 1, 33));
BigInteger s = new BigInteger(1, Arrays.copyOfRange(signatureEncoded, 33, 65));
ECDSASignature sig = new ECDSASignature(r, s);
byte[] messageBytes = formatMessageForSigning(message);
// Note that the C++ code doesn't actually seem to specify any character encoding. Presumably it's whatever
// JSON-SPIRIT hands back. Assume UTF-8 for now.
Sha256Hash messageHash = Sha256Hash.twiceOf(messageBytes);
boolean compressed = false;
if (header >= 31) {
compressed = true;
header -= 4;
}
int recId = header - 27;
ECKey key = ECKey.recoverFromSignature(recId, sig, messageHash, compressed);
if (key == null)
throw new SignatureException("Could not recover public key from signature");
return key;
} | class class_name[name] begin[{]
method[signedMessageToKey, return_type[type[ECKey]], modifier[public static], parameter[message, signatureBase64]] begin[{]
local_variable[type[byte], signatureEncoded]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=signatureEncoded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=signatureBase64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not decode base64"), 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=SignatureException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[signatureEncoded.length], <, literal[65]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Signature truncated, expected 65 bytes and got "), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=signatureEncoded, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SignatureException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], header]
if[binary_operation[binary_operation[member[.header], <, literal[27]], ||, binary_operation[member[.header], >, literal[34]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Header byte out of range: "), operandr=MemberReference(member=header, 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=SignatureException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[BigInteger], r]
local_variable[type[BigInteger], s]
local_variable[type[ECDSASignature], sig]
local_variable[type[byte], messageBytes]
local_variable[type[Sha256Hash], messageHash]
local_variable[type[boolean], compressed]
if[binary_operation[member[.header], >=, literal[31]]] begin[{]
assign[member[.compressed], literal[true]]
assign[member[.header], literal[4]]
else begin[{]
None
end[}]
local_variable[type[int], recId]
local_variable[type[ECKey], key]
if[binary_operation[member[.key], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not recover public key from signature")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SignatureException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.key]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ECKey] identifier[signedMessageToKey] operator[SEP] identifier[String] identifier[message] , identifier[String] identifier[signatureBase64] operator[SEP] Keyword[throws] identifier[SignatureException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[signatureEncoded] operator[SEP] Keyword[try] {
identifier[signatureEncoded] operator[=] identifier[Base64] operator[SEP] identifier[decode] operator[SEP] identifier[signatureBase64] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SignatureException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[signatureEncoded] operator[SEP] identifier[length] operator[<] Other[65] operator[SEP] Keyword[throw] Keyword[new] identifier[SignatureException] operator[SEP] literal[String] operator[+] identifier[signatureEncoded] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[header] operator[=] identifier[signatureEncoded] operator[SEP] Other[0] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[if] operator[SEP] identifier[header] operator[<] Other[27] operator[||] identifier[header] operator[>] Other[34] operator[SEP] Keyword[throw] Keyword[new] identifier[SignatureException] operator[SEP] literal[String] operator[+] identifier[header] operator[SEP] operator[SEP] identifier[BigInteger] identifier[r] operator[=] Keyword[new] identifier[BigInteger] operator[SEP] Other[1] , identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[signatureEncoded] , Other[1] , Other[33] operator[SEP] operator[SEP] operator[SEP] identifier[BigInteger] identifier[s] operator[=] Keyword[new] identifier[BigInteger] operator[SEP] Other[1] , identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[signatureEncoded] , Other[33] , Other[65] operator[SEP] operator[SEP] operator[SEP] identifier[ECDSASignature] identifier[sig] operator[=] Keyword[new] identifier[ECDSASignature] operator[SEP] identifier[r] , identifier[s] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[messageBytes] operator[=] identifier[formatMessageForSigning] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[Sha256Hash] identifier[messageHash] operator[=] identifier[Sha256Hash] operator[SEP] identifier[twiceOf] operator[SEP] identifier[messageBytes] operator[SEP] operator[SEP] Keyword[boolean] identifier[compressed] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[header] operator[>=] Other[31] operator[SEP] {
identifier[compressed] operator[=] literal[boolean] operator[SEP] identifier[header] operator[-=] Other[4] operator[SEP]
}
Keyword[int] identifier[recId] operator[=] identifier[header] operator[-] Other[27] operator[SEP] identifier[ECKey] identifier[key] operator[=] identifier[ECKey] operator[SEP] identifier[recoverFromSignature] operator[SEP] identifier[recId] , identifier[sig] , identifier[messageHash] , identifier[compressed] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[SignatureException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[key] operator[SEP]
}
|
public com.google.api.ads.admanager.axis.v201808.MobileDeviceSubmodelTargeting getMobileDeviceSubmodelSegment() {
return mobileDeviceSubmodelSegment;
} | class class_name[name] begin[{]
method[getMobileDeviceSubmodelSegment, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.mobileDeviceSubmodelSegment]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[MobileDeviceSubmodelTargeting] identifier[getMobileDeviceSubmodelSegment] operator[SEP] operator[SEP] {
Keyword[return] identifier[mobileDeviceSubmodelSegment] operator[SEP]
}
|
public void set(final int i, final int j, final int val) {
p[(j - i + editDistance + 1) * rowLength + j] = val;
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[i, j, val]] begin[{]
assign[member[.p], member[.val]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[set] operator[SEP] Keyword[final] Keyword[int] identifier[i] , Keyword[final] Keyword[int] identifier[j] , Keyword[final] Keyword[int] identifier[val] operator[SEP] {
identifier[p] operator[SEP] operator[SEP] identifier[j] operator[-] identifier[i] operator[+] identifier[editDistance] operator[+] Other[1] operator[SEP] operator[*] identifier[rowLength] operator[+] identifier[j] operator[SEP] operator[=] identifier[val] operator[SEP]
}
|
@Override
public void notifyForeignWatch(byte[] key, String serverId)
{
ClusterServiceKraken proxy = _podKraken.getProxy(serverId);
if (proxy != null) {
proxy.notifyLocalWatch(_table.getKey(), key);
}
} | class class_name[name] begin[{]
method[notifyForeignWatch, return_type[void], modifier[public], parameter[key, serverId]] begin[{]
local_variable[type[ClusterServiceKraken], proxy]
if[binary_operation[member[.proxy], !=, literal[null]]] begin[{]
call[proxy.notifyLocalWatch, parameter[call[_table.getKey, parameter[]], member[.key]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[notifyForeignWatch] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] , identifier[String] identifier[serverId] operator[SEP] {
identifier[ClusterServiceKraken] identifier[proxy] operator[=] identifier[_podKraken] operator[SEP] identifier[getProxy] operator[SEP] identifier[serverId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proxy] operator[!=] Other[null] operator[SEP] {
identifier[proxy] operator[SEP] identifier[notifyLocalWatch] operator[SEP] identifier[_table] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[key] operator[SEP] operator[SEP]
}
}
|
public static PaxDate of(int prolepticYear, int month, int dayOfMonth) {
YEAR.checkValidValue(prolepticYear);
PaxChronology.MONTH_OF_YEAR_RANGE.checkValidValue(month, MONTH_OF_YEAR);
PaxChronology.DAY_OF_MONTH_RANGE.checkValidValue(dayOfMonth, DAY_OF_MONTH);
if (month == MONTHS_IN_YEAR + 1 && !PaxChronology.INSTANCE.isLeapYear(prolepticYear)) {
throw new DateTimeException("Invalid month 14 as " + prolepticYear + "is not a leap year");
}
if (dayOfMonth > DAYS_IN_WEEK && month == MONTHS_IN_YEAR && PaxChronology.INSTANCE.isLeapYear(prolepticYear)) {
throw new DateTimeException("Invalid date during Pax as " + prolepticYear + " is a leap year");
}
return new PaxDate(prolepticYear, month, dayOfMonth);
} | class class_name[name] begin[{]
method[of, return_type[type[PaxDate]], modifier[public static], parameter[prolepticYear, month, dayOfMonth]] begin[{]
call[YEAR.checkValidValue, parameter[member[.prolepticYear]]]
call[PaxChronology.MONTH_OF_YEAR_RANGE.checkValidValue, parameter[member[.month], member[.MONTH_OF_YEAR]]]
call[PaxChronology.DAY_OF_MONTH_RANGE.checkValidValue, parameter[member[.dayOfMonth], member[.DAY_OF_MONTH]]]
if[binary_operation[binary_operation[member[.month], ==, binary_operation[member[.MONTHS_IN_YEAR], +, literal[1]]], &&, call[PaxChronology.INSTANCE.isLeapYear, parameter[member[.prolepticYear]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid month 14 as "), operandr=MemberReference(member=prolepticYear, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="is not a leap year"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.dayOfMonth], >, member[.DAYS_IN_WEEK]], &&, binary_operation[member[.month], ==, member[.MONTHS_IN_YEAR]]], &&, call[PaxChronology.INSTANCE.isLeapYear, parameter[member[.prolepticYear]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid date during Pax as "), operandr=MemberReference(member=prolepticYear, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is a leap year"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=prolepticYear, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=month, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dayOfMonth, 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=PaxDate, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PaxDate] identifier[of] operator[SEP] Keyword[int] identifier[prolepticYear] , Keyword[int] identifier[month] , Keyword[int] identifier[dayOfMonth] operator[SEP] {
identifier[YEAR] operator[SEP] identifier[checkValidValue] operator[SEP] identifier[prolepticYear] operator[SEP] operator[SEP] identifier[PaxChronology] operator[SEP] identifier[MONTH_OF_YEAR_RANGE] operator[SEP] identifier[checkValidValue] operator[SEP] identifier[month] , identifier[MONTH_OF_YEAR] operator[SEP] operator[SEP] identifier[PaxChronology] operator[SEP] identifier[DAY_OF_MONTH_RANGE] operator[SEP] identifier[checkValidValue] operator[SEP] identifier[dayOfMonth] , identifier[DAY_OF_MONTH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[month] operator[==] identifier[MONTHS_IN_YEAR] operator[+] Other[1] operator[&&] operator[!] identifier[PaxChronology] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[isLeapYear] operator[SEP] identifier[prolepticYear] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DateTimeException] operator[SEP] literal[String] operator[+] identifier[prolepticYear] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dayOfMonth] operator[>] identifier[DAYS_IN_WEEK] operator[&&] identifier[month] operator[==] identifier[MONTHS_IN_YEAR] operator[&&] identifier[PaxChronology] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[isLeapYear] operator[SEP] identifier[prolepticYear] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DateTimeException] operator[SEP] literal[String] operator[+] identifier[prolepticYear] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[PaxDate] operator[SEP] identifier[prolepticYear] , identifier[month] , identifier[dayOfMonth] operator[SEP] operator[SEP]
}
|
public static final Atom[] cloneAtomArray(Atom[] ca) {
Atom[] newCA = new Atom[ca.length];
List<Chain> model = new ArrayList<Chain>();
int apos = -1;
for (Atom a : ca) {
apos++;
Group parentG = a.getGroup();
Chain parentC = parentG.getChain();
Chain newChain = null;
for (Chain c : model) {
if (c.getName().equals(parentC.getName())) {
newChain = c;
break;
}
}
if (newChain == null) {
newChain = new ChainImpl();
newChain.setId(parentC.getId());
newChain.setName(parentC.getName());
model.add(newChain);
}
Group parentN = (Group) parentG.clone();
newCA[apos] = parentN.getAtom(a.getName());
try {
// if the group doesn't exist yet, this produces a StructureException
newChain.getGroupByPDB(parentN.getResidueNumber());
} catch (StructureException e) {
// the group doesn't exist yet in the newChain, let's add it
newChain.addGroup(parentN);
}
}
return newCA;
} | class class_name[name] begin[{]
method[cloneAtomArray, return_type[type[Atom]], modifier[final public static], parameter[ca]] begin[{]
local_variable[type[Atom], newCA]
local_variable[type[List], model]
local_variable[type[int], apos]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=apos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getGroup, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=parentG)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getChain, postfix_operators=[], prefix_operators=[], qualifier=parentG, selectors=[], type_arguments=None), name=parentC)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Chain, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=newChain)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Chain, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=parentC, 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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newChain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Chain, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=newChain, 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=newChain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChainImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=parentC, selectors=[], type_arguments=None)], member=setId, postfix_operators=[], prefix_operators=[], qualifier=newChain, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=parentC, selectors=[], type_arguments=None)], member=setName, postfix_operators=[], prefix_operators=[], qualifier=newChain, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newChain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=clone, postfix_operators=[], prefix_operators=[], qualifier=parentG, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), name=parentN)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newCA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=apos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None)], member=getAtom, postfix_operators=[], prefix_operators=[], qualifier=parentN, selectors=[], type_arguments=None)), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=parentN, selectors=[], type_arguments=None)], member=getGroupByPDB, postfix_operators=[], prefix_operators=[], qualifier=newChain, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parentN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addGroup, postfix_operators=[], prefix_operators=[], qualifier=newChain, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['StructureException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=ca, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Atom, sub_type=None))), label=None)
return[member[.newCA]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[Atom] operator[SEP] operator[SEP] identifier[cloneAtomArray] operator[SEP] identifier[Atom] operator[SEP] operator[SEP] identifier[ca] operator[SEP] {
identifier[Atom] operator[SEP] operator[SEP] identifier[newCA] operator[=] Keyword[new] identifier[Atom] operator[SEP] identifier[ca] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Chain] operator[>] identifier[model] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Chain] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[apos] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[Atom] identifier[a] operator[:] identifier[ca] operator[SEP] {
identifier[apos] operator[++] operator[SEP] identifier[Group] identifier[parentG] operator[=] identifier[a] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] identifier[Chain] identifier[parentC] operator[=] identifier[parentG] operator[SEP] identifier[getChain] operator[SEP] operator[SEP] operator[SEP] identifier[Chain] identifier[newChain] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[Chain] identifier[c] operator[:] identifier[model] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[parentC] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[newChain] operator[=] identifier[c] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[newChain] operator[==] Other[null] operator[SEP] {
identifier[newChain] operator[=] Keyword[new] identifier[ChainImpl] operator[SEP] operator[SEP] operator[SEP] identifier[newChain] operator[SEP] identifier[setId] operator[SEP] identifier[parentC] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[newChain] operator[SEP] identifier[setName] operator[SEP] identifier[parentC] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[add] operator[SEP] identifier[newChain] operator[SEP] operator[SEP]
}
identifier[Group] identifier[parentN] operator[=] operator[SEP] identifier[Group] operator[SEP] identifier[parentG] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[newCA] operator[SEP] identifier[apos] operator[SEP] operator[=] identifier[parentN] operator[SEP] identifier[getAtom] operator[SEP] identifier[a] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[newChain] operator[SEP] identifier[getGroupByPDB] operator[SEP] identifier[parentN] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[StructureException] identifier[e] operator[SEP] {
identifier[newChain] operator[SEP] identifier[addGroup] operator[SEP] identifier[parentN] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[newCA] operator[SEP]
}
|
public JBBPTextWriter SetTabSpaces(final int numberOfSpacesPerTab) {
if (numberOfSpacesPerTab <= 0) {
throw new IllegalArgumentException("Tab must contains positive number of space chars [" + numberOfSpacesPerTab + ']');
}
final int currentIdentSteps = this.indent / this.spacesInTab;
this.spacesInTab = numberOfSpacesPerTab;
this.indent = currentIdentSteps * this.spacesInTab;
return this;
} | class class_name[name] begin[{]
method[SetTabSpaces, return_type[type[JBBPTextWriter]], modifier[public], parameter[numberOfSpacesPerTab]] begin[{]
if[binary_operation[member[.numberOfSpacesPerTab], <=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Tab must contains positive number of space chars ["), operandr=MemberReference(member=numberOfSpacesPerTab, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], currentIdentSteps]
assign[THIS[member[None.spacesInTab]], member[.numberOfSpacesPerTab]]
assign[THIS[member[None.indent]], binary_operation[member[.currentIdentSteps], *, THIS[member[None.spacesInTab]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JBBPTextWriter] identifier[SetTabSpaces] operator[SEP] Keyword[final] Keyword[int] identifier[numberOfSpacesPerTab] operator[SEP] {
Keyword[if] operator[SEP] identifier[numberOfSpacesPerTab] operator[<=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[numberOfSpacesPerTab] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[currentIdentSteps] operator[=] Keyword[this] operator[SEP] identifier[indent] operator[/] Keyword[this] operator[SEP] identifier[spacesInTab] operator[SEP] Keyword[this] operator[SEP] identifier[spacesInTab] operator[=] identifier[numberOfSpacesPerTab] operator[SEP] Keyword[this] operator[SEP] identifier[indent] operator[=] identifier[currentIdentSteps] operator[*] Keyword[this] operator[SEP] identifier[spacesInTab] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Subscription pause( Subscription subscription ) {
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add( "pause", String.valueOf( true ) );
return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
} | class class_name[name] begin[{]
method[pause, return_type[type[Subscription]], modifier[public], parameter[subscription]] begin[{]
local_variable[type[ParameterMap], params]
call[params.add, parameter[literal["pause"], call[String.valueOf, parameter[literal[true]]]]]
return[call[RestfulUtils.update, parameter[member[SubscriptionService.PATH], member[.subscription], member[.params], literal[false], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Subscription, sub_type=None)), SuperMemberReference(member=httpClient, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])]]]
end[}]
END[}] | Keyword[public] identifier[Subscription] identifier[pause] operator[SEP] identifier[Subscription] identifier[subscription] operator[SEP] {
identifier[ParameterMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[ParameterMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[RestfulUtils] operator[SEP] identifier[update] operator[SEP] identifier[SubscriptionService] operator[SEP] identifier[PATH] , identifier[subscription] , identifier[params] , literal[boolean] , identifier[Subscription] operator[SEP] Keyword[class] , Keyword[super] operator[SEP] identifier[httpClient] operator[SEP] operator[SEP]
}
|
public ApiResponse<List<CorporationAssetsNamesResponse>> postCorporationsCorporationIdAssetsNamesWithHttpInfo(
Integer corporationId, List<Long> requestBody, String datasource, String token) throws ApiException {
com.squareup.okhttp.Call call = postCorporationsCorporationIdAssetsNamesValidateBeforeCall(corporationId,
requestBody, datasource, token, null);
Type localVarReturnType = new TypeToken<List<CorporationAssetsNamesResponse>>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[postCorporationsCorporationIdAssetsNamesWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[corporationId, requestBody, datasource, token]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[List] operator[<] identifier[CorporationAssetsNamesResponse] operator[>] operator[>] identifier[postCorporationsCorporationIdAssetsNamesWithHttpInfo] operator[SEP] identifier[Integer] identifier[corporationId] , identifier[List] operator[<] identifier[Long] operator[>] identifier[requestBody] , identifier[String] identifier[datasource] , identifier[String] identifier[token] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[postCorporationsCorporationIdAssetsNamesValidateBeforeCall] operator[SEP] identifier[corporationId] , identifier[requestBody] , identifier[datasource] , identifier[token] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[List] operator[<] identifier[CorporationAssetsNamesResponse] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
static boolean isGreaterThanOrEqualToDuration(Unit unit,
long position1, long position2, int duration) {
return unit.addToPosition(position1, duration + 1) - 1 >= position2;
} | class class_name[name] begin[{]
method[isGreaterThanOrEqualToDuration, return_type[type[boolean]], modifier[static], parameter[unit, position1, position2, duration]] begin[{]
return[binary_operation[binary_operation[call[unit.addToPosition, parameter[member[.position1], binary_operation[member[.duration], +, literal[1]]]], -, literal[1]], >=, member[.position2]]]
end[}]
END[}] | Keyword[static] Keyword[boolean] identifier[isGreaterThanOrEqualToDuration] operator[SEP] identifier[Unit] identifier[unit] , Keyword[long] identifier[position1] , Keyword[long] identifier[position2] , Keyword[int] identifier[duration] operator[SEP] {
Keyword[return] identifier[unit] operator[SEP] identifier[addToPosition] operator[SEP] identifier[position1] , identifier[duration] operator[+] Other[1] operator[SEP] operator[-] Other[1] operator[>=] identifier[position2] operator[SEP]
}
|
@Override
protected void parseSplitSampleData(StudyEntry variant, VariantFileMetadata fileMetadata, String[] fields,
String reference, String[] alternateAlleles)
throws NonStandardCompliantSampleField {
// Nothing to do
variant.setSamplesPosition(Collections.emptyMap());
} | class class_name[name] begin[{]
method[parseSplitSampleData, return_type[void], modifier[protected], parameter[variant, fileMetadata, fields, reference, alternateAlleles]] begin[{]
call[variant.setSamplesPosition, parameter[call[Collections.emptyMap, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[parseSplitSampleData] operator[SEP] identifier[StudyEntry] identifier[variant] , identifier[VariantFileMetadata] identifier[fileMetadata] , identifier[String] operator[SEP] operator[SEP] identifier[fields] , identifier[String] identifier[reference] , identifier[String] operator[SEP] operator[SEP] identifier[alternateAlleles] operator[SEP] Keyword[throws] identifier[NonStandardCompliantSampleField] {
identifier[variant] operator[SEP] identifier[setSamplesPosition] operator[SEP] identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void runTasks()
{
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
ThreadPoolBase pool = _pool;
Thread thread = this;
Outbox outbox = outbox();
boolean isWake = false;
setName(_name);
while (! _isClose) {
RunnableItem taskItem = pool.poll(isWake);
isWake = false;
if (taskItem != null) {
try {
_launcher.onChildIdleEnd();
outbox.open();
do {
// if the task is available, run it in the proper context
thread.setContextClassLoader(taskItem.getClassLoader());
taskItem.getTask().run();
outbox.flushAndExecuteAll();
} while ((taskItem = pool.poll(false)) != null);
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
} finally {
try {
outbox.close();
} catch (Throwable e) {
e.printStackTrace();
}
_launcher.onChildIdleBegin();
thread.setContextClassLoader(systemClassLoader);
if (! thread.getName().equals(_name)) {
setName(_name);
}
}
}
else if (_launcher.isIdleExpire()) {
return;
}
else if (park()) {
//thread.onWakeThread();
isWake = true;
}
else {
return;
}
}
} | class class_name[name] begin[{]
method[runTasks, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[ClassLoader], systemClassLoader]
local_variable[type[ThreadPoolBase], pool]
local_variable[type[Thread], thread]
local_variable[type[Outbox], outbox]
local_variable[type[boolean], isWake]
call[.setName, parameter[member[._name]]]
while[member[._isClose]] begin[{]
local_variable[type[RunnableItem], taskItem]
assign[member[.isWake], literal[false]]
if[binary_operation[member[.taskItem], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=onChildIdleEnd, postfix_operators=[], prefix_operators=[], qualifier=_launcher, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=outbox, selectors=[], type_arguments=None), label=None), DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=[], prefix_operators=[], qualifier=taskItem, selectors=[], type_arguments=None)], member=setContextClassLoader, postfix_operators=[], prefix_operators=[], qualifier=thread, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getTask, postfix_operators=[], prefix_operators=[], qualifier=taskItem, selectors=[MethodInvocation(arguments=[], member=run, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flushAndExecuteAll, postfix_operators=[], prefix_operators=[], qualifier=outbox, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=taskItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=poll, postfix_operators=[], prefix_operators=[], qualifier=pool, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=outbox, 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=['Throwable']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[], member=onChildIdleBegin, postfix_operators=[], prefix_operators=[], qualifier=_launcher, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=systemClassLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContextClassLoader, postfix_operators=[], prefix_operators=[], qualifier=thread, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=['!'], qualifier=thread, selectors=[MethodInvocation(arguments=[MemberReference(member=_name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=_name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
else begin[{]
if[call[_launcher.isIdleExpire, parameter[]]] begin[{]
return[None]
else begin[{]
if[call[.park, parameter[]]] begin[{]
assign[member[.isWake], literal[true]]
else begin[{]
return[None]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[runTasks] operator[SEP] operator[SEP] {
identifier[ClassLoader] identifier[systemClassLoader] operator[=] identifier[ClassLoader] operator[SEP] identifier[getSystemClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[ThreadPoolBase] identifier[pool] operator[=] identifier[_pool] operator[SEP] identifier[Thread] identifier[thread] operator[=] Keyword[this] operator[SEP] identifier[Outbox] identifier[outbox] operator[=] identifier[outbox] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isWake] operator[=] literal[boolean] operator[SEP] identifier[setName] operator[SEP] identifier[_name] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[_isClose] operator[SEP] {
identifier[RunnableItem] identifier[taskItem] operator[=] identifier[pool] operator[SEP] identifier[poll] operator[SEP] identifier[isWake] operator[SEP] operator[SEP] identifier[isWake] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[taskItem] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[_launcher] operator[SEP] identifier[onChildIdleEnd] operator[SEP] operator[SEP] operator[SEP] identifier[outbox] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] Keyword[do] {
identifier[thread] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[taskItem] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[taskItem] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] identifier[outbox] operator[SEP] identifier[flushAndExecuteAll] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[SEP] identifier[taskItem] operator[=] identifier[pool] operator[SEP] identifier[poll] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[outbox] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_launcher] operator[SEP] identifier[onChildIdleBegin] operator[SEP] operator[SEP] operator[SEP] identifier[thread] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[systemClassLoader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[thread] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[_name] operator[SEP] operator[SEP] {
identifier[setName] operator[SEP] identifier[_name] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[_launcher] operator[SEP] identifier[isIdleExpire] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[park] operator[SEP] operator[SEP] operator[SEP] {
identifier[isWake] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP]
}
}
}
|
public static boolean parametersInRange( double[] parameters, double[]... ranges ) {
for( int i = 0; i < ranges.length; i++ ) {
if (!NumericsUtilities.isBetween(parameters[i], ranges[i])) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[parametersInRange, return_type[type[boolean]], modifier[public static], parameter[parameters, ranges]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=ranges, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isBetween, postfix_operators=[], prefix_operators=['!'], qualifier=NumericsUtilities, 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=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=ranges, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[parametersInRange] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[parameters] , Keyword[double] operator[SEP] operator[SEP] operator[...] identifier[ranges] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ranges] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[NumericsUtilities] operator[SEP] identifier[isBetween] operator[SEP] identifier[parameters] operator[SEP] identifier[i] operator[SEP] , identifier[ranges] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Embedded
public AValue getValueItem() {
if ((avalue==null) && (value!=null)) {
if (type==null) {
avalue=SQLValueConverter.convertToAValue(vc.getXsdType(value), value);
} else if (value instanceof LangString) {
avalue=SQLValueConverter.convertToAValue(type, ((LangString) value).getValue());
} else if (value instanceof org.openprovenance.prov.model.QualifiedName) {
avalue=SQLValueConverter.convertToAValue(type, (QualifiedName) value);
} else {
avalue=SQLValueConverter.convertToAValue(type, vc.convertToJava(type, (String)value));
}
}
return avalue;
} | class class_name[name] begin[{]
method[getValueItem, return_type[type[AValue]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.avalue], ==, literal[null]], &&, binary_operation[member[.value], !=, literal[null]]]] begin[{]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
assign[member[.avalue], call[SQLValueConverter.convertToAValue, parameter[call[vc.getXsdType, parameter[member[.value]]], member[.value]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[LangString]]] begin[{]
assign[member[.avalue], call[SQLValueConverter.convertToAValue, parameter[member[.type], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LangString, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[org]]] begin[{]
assign[member[.avalue], call[SQLValueConverter.convertToAValue, parameter[member[.type], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=QualifiedName, sub_type=None))]]]
else begin[{]
assign[member[.avalue], call[SQLValueConverter.convertToAValue, parameter[member[.type], call[vc.convertToJava, parameter[member[.type], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]]]]
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.avalue]]
end[}]
END[}] | annotation[@] identifier[Embedded] Keyword[public] identifier[AValue] identifier[getValueItem] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[avalue] operator[==] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
identifier[avalue] operator[=] identifier[SQLValueConverter] operator[SEP] identifier[convertToAValue] operator[SEP] identifier[vc] operator[SEP] identifier[getXsdType] operator[SEP] identifier[value] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[LangString] operator[SEP] {
identifier[avalue] operator[=] identifier[SQLValueConverter] operator[SEP] identifier[convertToAValue] operator[SEP] identifier[type] , operator[SEP] operator[SEP] identifier[LangString] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[org] operator[SEP] identifier[openprovenance] operator[SEP] identifier[prov] operator[SEP] identifier[model] operator[SEP] identifier[QualifiedName] operator[SEP] {
identifier[avalue] operator[=] identifier[SQLValueConverter] operator[SEP] identifier[convertToAValue] operator[SEP] identifier[type] , operator[SEP] identifier[QualifiedName] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[avalue] operator[=] identifier[SQLValueConverter] operator[SEP] identifier[convertToAValue] operator[SEP] identifier[type] , identifier[vc] operator[SEP] identifier[convertToJava] operator[SEP] identifier[type] , operator[SEP] identifier[String] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[avalue] operator[SEP]
}
|
private static FactorComparator<Executor> getNumberOfAssignedFlowComparator(final int weight) {
return FactorComparator
.create(NUMOFASSIGNEDFLOW_COMPARATOR_NAME, weight, new Comparator<Executor>() {
@Override
public int compare(final Executor o1, final Executor o2) {
final ExecutorInfo stat1 = o1.getExecutorInfo();
final ExecutorInfo stat2 = o2.getExecutorInfo();
final Integer result = 0;
if (statisticsObjectCheck(stat1, stat2, NUMOFASSIGNEDFLOW_COMPARATOR_NAME)) {
return result;
}
return ((Integer) stat1.getRemainingFlowCapacity())
.compareTo(stat2.getRemainingFlowCapacity());
}
});
} | class class_name[name] begin[{]
method[getNumberOfAssignedFlowComparator, return_type[type[FactorComparator]], modifier[private static], parameter[weight]] begin[{]
return[call[FactorComparator.create, parameter[member[.NUMOFASSIGNEDFLOW_COMPARATOR_NAME], member[.weight], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getExecutorInfo, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[], type_arguments=None), name=stat1)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ExecutorInfo, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getExecutorInfo, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None), name=stat2)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ExecutorInfo, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=result)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=stat1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stat2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NUMOFASSIGNEDFLOW_COMPARATOR_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=statisticsObjectCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getRemainingFlowCapacity, postfix_operators=[], prefix_operators=[], qualifier=stat1, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=o1, type=ReferenceType(arguments=None, dimensions=[], name=Executor, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=o2, type=ReferenceType(arguments=None, dimensions=[], name=Executor, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), 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=Executor, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[FactorComparator] operator[<] identifier[Executor] operator[>] identifier[getNumberOfAssignedFlowComparator] operator[SEP] Keyword[final] Keyword[int] identifier[weight] operator[SEP] {
Keyword[return] identifier[FactorComparator] operator[SEP] identifier[create] operator[SEP] identifier[NUMOFASSIGNEDFLOW_COMPARATOR_NAME] , identifier[weight] , Keyword[new] identifier[Comparator] operator[<] identifier[Executor] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] Keyword[final] identifier[Executor] identifier[o1] , Keyword[final] identifier[Executor] identifier[o2] operator[SEP] {
Keyword[final] identifier[ExecutorInfo] identifier[stat1] operator[=] identifier[o1] operator[SEP] identifier[getExecutorInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ExecutorInfo] identifier[stat2] operator[=] identifier[o2] operator[SEP] identifier[getExecutorInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Integer] identifier[result] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[statisticsObjectCheck] operator[SEP] identifier[stat1] , identifier[stat2] , identifier[NUMOFASSIGNEDFLOW_COMPARATOR_NAME] operator[SEP] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
Keyword[return] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[stat1] operator[SEP] identifier[getRemainingFlowCapacity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[stat2] operator[SEP] identifier[getRemainingFlowCapacity] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static String escapeJava(final String text, final JavaEscapeLevel level) {
if (level == null) {
throw new IllegalArgumentException("The 'level' argument cannot be null");
}
return JavaEscapeUtil.escape(text, level);
} | class class_name[name] begin[{]
method[escapeJava, return_type[type[String]], modifier[public static], parameter[text, level]] begin[{]
if[binary_operation[member[.level], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The 'level' argument cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[JavaEscapeUtil.escape, parameter[member[.text], member[.level]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[escapeJava] operator[SEP] Keyword[final] identifier[String] identifier[text] , Keyword[final] identifier[JavaEscapeLevel] identifier[level] operator[SEP] {
Keyword[if] operator[SEP] identifier[level] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[JavaEscapeUtil] operator[SEP] identifier[escape] operator[SEP] identifier[text] , identifier[level] operator[SEP] operator[SEP]
}
|
public static String getSoftwareModuleName(final String caption, final String name) {
return new StringBuilder()
.append(DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText(getFormattedName(name)))
.append(DIV_DESCRIPTION_END).toString();
} | class class_name[name] begin[{]
method[getSoftwareModuleName, return_type[type[String]], modifier[public static], parameter[caption, name]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=DIV_DESCRIPTION_START, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=caption, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" : "), operator=+), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFormattedName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getBoldHTMLText, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=DIV_DESCRIPTION_END, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getSoftwareModuleName] operator[SEP] Keyword[final] identifier[String] identifier[caption] , Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[return] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[DIV_DESCRIPTION_START] operator[+] identifier[caption] operator[+] literal[String] operator[+] identifier[getBoldHTMLText] operator[SEP] identifier[getFormattedName] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[DIV_DESCRIPTION_END] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@CanIgnoreReturnValue // TODO(kak): Consider removing this
public <E extends T> E max(@Nullable E a, @Nullable E b, @Nullable E c, E... rest) {
E maxSoFar = max(max(a, b), c);
for (E r : rest) {
maxSoFar = max(maxSoFar, r);
}
return maxSoFar;
} | class class_name[name] begin[{]
method[max, return_type[type[E]], modifier[public], parameter[a, b, c, rest]] begin[{]
local_variable[type[E], maxSoFar]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxSoFar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=maxSoFar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
return[member[.maxSoFar]]
end[}]
END[}] | annotation[@] identifier[CanIgnoreReturnValue] Keyword[public] operator[<] identifier[E] Keyword[extends] identifier[T] operator[>] identifier[E] identifier[max] operator[SEP] annotation[@] identifier[Nullable] identifier[E] identifier[a] , annotation[@] identifier[Nullable] identifier[E] identifier[b] , annotation[@] identifier[Nullable] identifier[E] identifier[c] , identifier[E] operator[...] identifier[rest] operator[SEP] {
identifier[E] identifier[maxSoFar] operator[=] identifier[max] operator[SEP] identifier[max] operator[SEP] identifier[a] , identifier[b] operator[SEP] , identifier[c] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[E] identifier[r] operator[:] identifier[rest] operator[SEP] {
identifier[maxSoFar] operator[=] identifier[max] operator[SEP] identifier[maxSoFar] , identifier[r] operator[SEP] operator[SEP]
}
Keyword[return] identifier[maxSoFar] operator[SEP]
}
|
public void start() {
input.messageHandler(new Handler<Object>() {
@Override
public void handle(Object message) {
output.send(message);
pumped++;
}
});
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
call[input.messageHandler, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=pumped, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=message, type=ReferenceType(arguments=None, dimensions=[], name=Object, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Handler, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[messageHandler] operator[SEP] Keyword[new] identifier[Handler] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[Object] identifier[message] operator[SEP] {
identifier[output] operator[SEP] identifier[send] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[pumped] operator[++] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private boolean invalidateByHas(SchemaTableTree schemaTableTree) {
for (HasContainer hasContainer : schemaTableTree.hasContainers) {
if (!hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_SQLG_SCHEMA) && !hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_GLOBAL_UNIQUE_INDEX)) {
if (hasContainer.getKey().equals(label.getAccessor())) {
Preconditions.checkState(false, "label hasContainers should have been removed by now.");
} else if (hasContainer.getKey().equals(T.id.getAccessor())) {
if (hasContainer.getBiPredicate().equals(Compare.eq)) {
Object value = hasContainer.getValue();
SchemaTable hasContainerLabelSchemaTable = getIDContainerSchemaTable(schemaTableTree, value);
if (!hasContainerLabelSchemaTable.equals(schemaTableTree.getSchemaTable())) {
return true;
}
} else if (hasContainer.getBiPredicate().equals(Contains.within)) {
Collection<?> c = (Collection<?>) hasContainer.getPredicate().getValue();
Iterator<?> it = c.iterator();
Collection<Object> ok = new LinkedList<>();
while (it.hasNext()) {
Object value = it.next();
SchemaTable hasContainerLabelSchemaTable = getIDContainerSchemaTable(schemaTableTree, value);
if (hasContainerLabelSchemaTable.equals(schemaTableTree.getSchemaTable())) {
ok.add(value);
}
}
if (ok.isEmpty()) {
return true;
}
((P<Collection<Object>>) (hasContainer.getPredicate())).setValue(ok);
}
} else {
if (hasContainer.getBiPredicate() instanceof FullText && ((FullText) hasContainer.getBiPredicate()).getQuery() != null) {
return false;
}
//check if the hasContainer is for a property that exists, if not remove this node from the query tree
if (!this.getFilteredAllTables().get(schemaTableTree.getSchemaTable().toString()).containsKey(hasContainer.getKey())) {
if (!Existence.NULL.equals(hasContainer.getBiPredicate())) {
return true;
}
}
//Check if it is a Contains.within with a empty list of values
if (hasEmptyWithin(hasContainer)) {
return true;
}
}
} else {
throw new IllegalStateException();
}
}
return false;
} | class class_name[name] begin[{]
method[invalidateByHas, return_type[type[boolean]], modifier[private], parameter[schemaTableTree]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=['!'], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MemberReference(member=TOPOLOGY_SELECTION_SQLG_SCHEMA, postfix_operators=[], prefix_operators=[], qualifier=TopologyStrategy, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=['!'], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MemberReference(member=TOPOLOGY_SELECTION_GLOBAL_UNIQUE_INDEX, postfix_operators=[], prefix_operators=[], qualifier=TopologyStrategy, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAccessor, postfix_operators=[], prefix_operators=[], qualifier=label, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAccessor, postfix_operators=[], prefix_operators=[], qualifier=T.id, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBiPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=FullText, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[], member=getBiPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FullText, sub_type=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), 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)])), IfStatement(condition=This(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getFilteredAllTables, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSchemaTable, postfix_operators=[], prefix_operators=[], qualifier=schemaTableTree, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBiPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=Existence.NULL, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=hasContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasEmptyWithin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getBiPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MemberReference(member=eq, postfix_operators=[], prefix_operators=[], qualifier=Compare, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[], member=getBiPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[MemberReference(member=within, postfix_operators=[], prefix_operators=[], qualifier=Contains, selectors=[])], 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Collection, sub_type=None)), name=c)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Collection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Iterator, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None)), name=ok)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=schemaTableTree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIDContainerSchemaTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=hasContainerLabelSchemaTable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SchemaTable, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSchemaTable, postfix_operators=[], prefix_operators=[], qualifier=schemaTableTree, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=hasContainerLabelSchemaTable, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ok, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=ok, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), StatementExpression(expression=Cast(expression=MethodInvocation(arguments=[], member=getPredicate, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Collection, sub_type=None))], dimensions=[], name=P, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=hasContainer, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=schemaTableTree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIDContainerSchemaTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=hasContainerLabelSchemaTable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SchemaTable, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSchemaTable, postfix_operators=[], prefix_operators=[], qualifier=schemaTableTree, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=hasContainerLabelSchemaTable, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="label hasContainers should have been removed by now.")], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=hasContainers, postfix_operators=[], prefix_operators=[], qualifier=schemaTableTree, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=hasContainer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HasContainer, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[boolean] identifier[invalidateByHas] operator[SEP] identifier[SchemaTableTree] identifier[schemaTableTree] operator[SEP] {
Keyword[for] operator[SEP] identifier[HasContainer] identifier[hasContainer] operator[:] identifier[schemaTableTree] operator[SEP] identifier[hasContainers] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[hasContainer] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[TopologyStrategy] operator[SEP] identifier[TOPOLOGY_SELECTION_SQLG_SCHEMA] operator[SEP] operator[&&] operator[!] identifier[hasContainer] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[TopologyStrategy] operator[SEP] identifier[TOPOLOGY_SELECTION_GLOBAL_UNIQUE_INDEX] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[label] operator[SEP] identifier[getAccessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] literal[boolean] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[T] operator[SEP] identifier[id] operator[SEP] identifier[getAccessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getBiPredicate] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Compare] operator[SEP] identifier[eq] operator[SEP] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[hasContainer] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[SchemaTable] identifier[hasContainerLabelSchemaTable] operator[=] identifier[getIDContainerSchemaTable] operator[SEP] identifier[schemaTableTree] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[hasContainerLabelSchemaTable] operator[SEP] identifier[equals] operator[SEP] identifier[schemaTableTree] operator[SEP] identifier[getSchemaTable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getBiPredicate] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Contains] operator[SEP] identifier[within] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] operator[?] operator[>] identifier[c] operator[=] operator[SEP] identifier[Collection] operator[<] operator[?] operator[>] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getPredicate] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] operator[?] operator[>] identifier[it] operator[=] identifier[c] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[Object] operator[>] identifier[ok] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[SchemaTable] identifier[hasContainerLabelSchemaTable] operator[=] identifier[getIDContainerSchemaTable] operator[SEP] identifier[schemaTableTree] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasContainerLabelSchemaTable] operator[SEP] identifier[equals] operator[SEP] identifier[schemaTableTree] operator[SEP] identifier[getSchemaTable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[ok] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[ok] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
} operator[SEP] operator[SEP] identifier[P] operator[<] identifier[Collection] operator[<] identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getPredicate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[ok] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getBiPredicate] operator[SEP] operator[SEP] Keyword[instanceof] identifier[FullText] operator[&&] operator[SEP] operator[SEP] identifier[FullText] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getBiPredicate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[getFilteredAllTables] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[schemaTableTree] operator[SEP] identifier[getSchemaTable] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Existence] operator[SEP] identifier[NULL] operator[SEP] identifier[equals] operator[SEP] identifier[hasContainer] operator[SEP] identifier[getBiPredicate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[hasEmptyWithin] operator[SEP] identifier[hasContainer] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public SIMPRequestedValueMessageInfo getRequestedValueMessageInfo() throws SIMPRuntimeOperationFailedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRequestedValueMessageInfo");
SIMPRequestedValueMessageInfo requestedValueMessageInfo = null;
try
{
TickRange tickRange = getTickRange();
synchronized(tickRange)
{
if (State.VALUE.toString().equals(getState(tickRange)))
{
// This RemoteMessageRequest is in state request so lets get the info
requestedValueMessageInfo = new RequestedValueMessageInfo((AIValueTick)tickRange.value);
}
}
}
catch(SIMPException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestedValueMessageInfo",
"1:456:1.34",
this);
SIMPRuntimeOperationFailedException e1 =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"RemoteMessageRequest.getRequestedValueMessageInfo",
"1:464:1.34",
e,
_aiStream.getStreamId()},
null), e);
SibTr.exception(tc, e1);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", e1);
throw e1;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRequestedValueMessageInfo", requestedValueMessageInfo);
return requestedValueMessageInfo;
} | class class_name[name] begin[{]
method[getRequestedValueMessageInfo, return_type[type[SIMPRequestedValueMessageInfo]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getRequestedValueMessageInfo"]]]
else begin[{]
None
end[}]
local_variable[type[SIMPRequestedValueMessageInfo], requestedValueMessageInfo]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTickRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=tickRange)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TickRange, sub_type=None)), SynchronizedStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=State.VALUE, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=tickRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getState, postfix_operators=[], prefix_operators=[], qualifier=, 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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=requestedValueMessageInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=tickRange, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AIValueTick, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RequestedValueMessageInfo, sub_type=None))), label=None)]))], label=None, lock=MemberReference(member=tickRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestedValueMessageInfo"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:456:1.34"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0003"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RemoteMessageRequest.getRequestedValueMessageInfo"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:464:1.34"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getStreamId, postfix_operators=[], prefix_operators=[], qualifier=_aiStream, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SIMPRuntimeOperationFailedException, sub_type=None)), name=e1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SIMPRuntimeOperationFailedException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getRequestedValueMessageInfo"), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SIMPException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["getRequestedValueMessageInfo"], member[.requestedValueMessageInfo]]]
else begin[{]
None
end[}]
return[member[.requestedValueMessageInfo]]
end[}]
END[}] | Keyword[public] identifier[SIMPRequestedValueMessageInfo] identifier[getRequestedValueMessageInfo] operator[SEP] operator[SEP] Keyword[throws] identifier[SIMPRuntimeOperationFailedException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[SIMPRequestedValueMessageInfo] identifier[requestedValueMessageInfo] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[TickRange] identifier[tickRange] operator[=] identifier[getTickRange] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[tickRange] operator[SEP] {
Keyword[if] operator[SEP] identifier[State] operator[SEP] identifier[VALUE] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[getState] operator[SEP] identifier[tickRange] operator[SEP] operator[SEP] operator[SEP] {
identifier[requestedValueMessageInfo] operator[=] Keyword[new] identifier[RequestedValueMessageInfo] operator[SEP] operator[SEP] identifier[AIValueTick] operator[SEP] identifier[tickRange] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[SIMPException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SIMPRuntimeOperationFailedException] identifier[e1] operator[=] Keyword[new] identifier[SIMPRuntimeOperationFailedException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e] , identifier[_aiStream] operator[SEP] identifier[getStreamId] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e1] operator[SEP] operator[SEP] Keyword[throw] identifier[e1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[requestedValueMessageInfo] operator[SEP] operator[SEP] Keyword[return] identifier[requestedValueMessageInfo] operator[SEP]
}
|
private Map getUsers() throws NamingException {
String filter = "(" + roleNameRDN + "=*)";
HashMap users = new HashMap();
NamingEnumeration results = this.search(roleBase, filter, new String[]{roleMemberRDN});
while (results != null && results.hasMore()) {
SearchResult roleResult = (SearchResult) results.next();
String roleResultName = roleResult.getName();
if ("".equals(roleResultName)) {
continue;
}
String roleResultValue = (roleResultName.split("="))[1];
Attributes roleAttrs = roleResult.getAttributes();
Attribute roleAttr = roleAttrs.get(roleMemberRDN);
NamingEnumeration valueEnum = roleAttr.getAll();
while (valueEnum != null && valueEnum.hasMore()) {
String value = (String) valueEnum.next();
String name;
if (value.endsWith("," + userBase)) {
name = value.substring(0, value.length() - userBase.length() - 1);
name = name.split("=")[1];
} else {
log.debug("found unrecognized DN: " + value);
continue;
}
if (users.containsKey(name)) {
HashSet roles = (HashSet) users.get(name);
roles.add(roleResultValue);
} else {
HashSet roles = new HashSet();
roles.add(roleResultValue);
users.put(name, roles);
}
}
}
return users;
} | class class_name[name] begin[{]
method[getUsers, return_type[type[Map]], modifier[private], parameter[]] begin[{]
local_variable[type[String], filter]
local_variable[type[HashMap], users]
local_variable[type[NamingEnumeration], results]
while[binary_operation[binary_operation[member[.results], !=, literal[null]], &&, call[results.hasMore, parameter[]]]] begin[{]
local_variable[type[SearchResult], roleResult]
local_variable[type[String], roleResultName]
if[literal[""]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[String], roleResultValue]
local_variable[type[Attributes], roleAttrs]
local_variable[type[Attribute], roleAttr]
local_variable[type[NamingEnumeration], valueEnum]
while[binary_operation[binary_operation[member[.valueEnum], !=, literal[null]], &&, call[valueEnum.hasMore, parameter[]]]] begin[{]
local_variable[type[String], value]
local_variable[type[String], name]
if[call[value.endsWith, parameter[binary_operation[literal[","], +, member[.userBase]]]]] begin[{]
assign[member[.name], call[value.substring, parameter[literal[0], binary_operation[binary_operation[call[value.length, parameter[]], -, call[userBase.length, parameter[]]], -, literal[1]]]]]
assign[member[.name], call[name.split, parameter[literal["="]]]]
else begin[{]
call[log.debug, parameter[binary_operation[literal["found unrecognized DN: "], +, member[.value]]]]
ContinueStatement(goto=None, label=None)
end[}]
if[call[users.containsKey, parameter[member[.name]]]] begin[{]
local_variable[type[HashSet], roles]
call[roles.add, parameter[member[.roleResultValue]]]
else begin[{]
local_variable[type[HashSet], roles]
call[roles.add, parameter[member[.roleResultValue]]]
call[users.put, parameter[member[.name], member[.roles]]]
end[}]
end[}]
end[}]
return[member[.users]]
end[}]
END[}] | Keyword[private] identifier[Map] identifier[getUsers] operator[SEP] operator[SEP] Keyword[throws] identifier[NamingException] {
identifier[String] identifier[filter] operator[=] literal[String] operator[+] identifier[roleNameRDN] operator[+] literal[String] operator[SEP] identifier[HashMap] identifier[users] operator[=] Keyword[new] identifier[HashMap] operator[SEP] operator[SEP] operator[SEP] identifier[NamingEnumeration] identifier[results] operator[=] Keyword[this] operator[SEP] identifier[search] operator[SEP] identifier[roleBase] , identifier[filter] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[roleMemberRDN]
} operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[results] operator[!=] Other[null] operator[&&] identifier[results] operator[SEP] identifier[hasMore] operator[SEP] operator[SEP] operator[SEP] {
identifier[SearchResult] identifier[roleResult] operator[=] operator[SEP] identifier[SearchResult] operator[SEP] identifier[results] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[roleResultName] operator[=] identifier[roleResult] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[roleResultName] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] identifier[roleResultValue] operator[=] operator[SEP] identifier[roleResultName] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[Attributes] identifier[roleAttrs] operator[=] identifier[roleResult] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[Attribute] identifier[roleAttr] operator[=] identifier[roleAttrs] operator[SEP] identifier[get] operator[SEP] identifier[roleMemberRDN] operator[SEP] operator[SEP] identifier[NamingEnumeration] identifier[valueEnum] operator[=] identifier[roleAttr] operator[SEP] identifier[getAll] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[valueEnum] operator[!=] Other[null] operator[&&] identifier[valueEnum] operator[SEP] identifier[hasMore] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[value] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[valueEnum] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[+] identifier[userBase] operator[SEP] operator[SEP] {
identifier[name] operator[=] identifier[value] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[userBase] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[users] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[HashSet] identifier[roles] operator[=] operator[SEP] identifier[HashSet] operator[SEP] identifier[users] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[roles] operator[SEP] identifier[add] operator[SEP] identifier[roleResultValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[HashSet] identifier[roles] operator[=] Keyword[new] identifier[HashSet] operator[SEP] operator[SEP] operator[SEP] identifier[roles] operator[SEP] identifier[add] operator[SEP] identifier[roleResultValue] operator[SEP] operator[SEP] identifier[users] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[roles] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[users] operator[SEP]
}
|
@Override protected Response serve() {
if( src_key == null ) return RequestServer._http404.serve();
Vec v = src_key.anyVec();
if (v.isEnum()) {
map = Arrays.asList(v.domain()).indexOf(str);
} else if (v.masterVec() != null && v.masterVec().isEnum()) {
map = Arrays.asList(v.masterVec().domain()).indexOf(str);
} else {
map = -1;
}
return Response.done(this);
} | class class_name[name] begin[{]
method[serve, return_type[type[Response]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.src_key], ==, literal[null]]] begin[{]
return[call[RequestServer._http404.serve, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Vec], v]
if[call[v.isEnum, parameter[]]] begin[{]
assign[member[.map], call[Arrays.asList, parameter[call[v.domain, parameter[]]]]]
else begin[{]
if[binary_operation[binary_operation[call[v.masterVec, parameter[]], !=, literal[null]], &&, call[v.masterVec, parameter[]]]] begin[{]
assign[member[.map], call[Arrays.asList, parameter[call[v.masterVec, parameter[]]]]]
else begin[{]
assign[member[.map], literal[1]]
end[}]
end[}]
return[call[Response.done, parameter[THIS[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[Response] identifier[serve] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[src_key] operator[==] Other[null] operator[SEP] Keyword[return] identifier[RequestServer] operator[SEP] identifier[_http404] operator[SEP] identifier[serve] operator[SEP] operator[SEP] operator[SEP] identifier[Vec] identifier[v] operator[=] identifier[src_key] operator[SEP] identifier[anyVec] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v] operator[SEP] identifier[isEnum] operator[SEP] operator[SEP] operator[SEP] {
identifier[map] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[v] operator[SEP] identifier[domain] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] identifier[str] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[v] operator[SEP] identifier[masterVec] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[v] operator[SEP] identifier[masterVec] operator[SEP] operator[SEP] operator[SEP] identifier[isEnum] operator[SEP] operator[SEP] operator[SEP] {
identifier[map] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[v] operator[SEP] identifier[masterVec] operator[SEP] operator[SEP] operator[SEP] identifier[domain] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] identifier[str] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[map] operator[=] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[Response] operator[SEP] identifier[done] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
public Map<String, Link> resolveLinks(String requestUrl) {
String normalizedUrl = normalizeRequestUrl(requestUrl);
Map<String, Link> links = new LinkedHashMap<>();
links.put("self", new Link(normalizedUrl));
for (ExposableEndpoint<?> endpoint : this.endpoints) {
if (endpoint instanceof ExposableWebEndpoint) {
collectLinks(links, (ExposableWebEndpoint) endpoint, normalizedUrl);
}
else if (endpoint instanceof PathMappedEndpoint) {
String rootPath = ((PathMappedEndpoint) endpoint).getRootPath();
Link link = createLink(normalizedUrl, rootPath);
links.put(endpoint.getEndpointId().toLowerCaseString(), link);
}
}
return links;
} | class class_name[name] begin[{]
method[resolveLinks, return_type[type[Map]], modifier[public], parameter[requestUrl]] begin[{]
local_variable[type[String], normalizedUrl]
local_variable[type[Map], links]
call[links.put, parameter[literal["self"], ClassCreator(arguments=[MemberReference(member=normalizedUrl, 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=Link, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ExposableWebEndpoint, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=PathMappedEndpoint, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PathMappedEndpoint, sub_type=None)), name=rootPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=normalizedUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rootPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=link)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Link, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEndpointId, postfix_operators=[], prefix_operators=[], qualifier=endpoint, selectors=[MethodInvocation(arguments=[], member=toLowerCaseString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=links, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=links, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ExposableWebEndpoint, sub_type=None)), MemberReference(member=normalizedUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=collectLinks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=endpoints, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=endpoint)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ExposableEndpoint, sub_type=None))), label=None)
return[member[.links]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Link] operator[>] identifier[resolveLinks] operator[SEP] identifier[String] identifier[requestUrl] operator[SEP] {
identifier[String] identifier[normalizedUrl] operator[=] identifier[normalizeRequestUrl] operator[SEP] identifier[requestUrl] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Link] operator[>] identifier[links] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[links] operator[SEP] identifier[put] operator[SEP] literal[String] , Keyword[new] identifier[Link] operator[SEP] identifier[normalizedUrl] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExposableEndpoint] operator[<] operator[?] operator[>] identifier[endpoint] operator[:] Keyword[this] operator[SEP] identifier[endpoints] operator[SEP] {
Keyword[if] operator[SEP] identifier[endpoint] Keyword[instanceof] identifier[ExposableWebEndpoint] operator[SEP] {
identifier[collectLinks] operator[SEP] identifier[links] , operator[SEP] identifier[ExposableWebEndpoint] operator[SEP] identifier[endpoint] , identifier[normalizedUrl] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[endpoint] Keyword[instanceof] identifier[PathMappedEndpoint] operator[SEP] {
identifier[String] identifier[rootPath] operator[=] operator[SEP] operator[SEP] identifier[PathMappedEndpoint] operator[SEP] identifier[endpoint] operator[SEP] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] identifier[Link] identifier[link] operator[=] identifier[createLink] operator[SEP] identifier[normalizedUrl] , identifier[rootPath] operator[SEP] operator[SEP] identifier[links] operator[SEP] identifier[put] operator[SEP] identifier[endpoint] operator[SEP] identifier[getEndpointId] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCaseString] operator[SEP] operator[SEP] , identifier[link] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[links] operator[SEP]
}
|
private void resetActualRounding() {
if (roundingIncrementICU != null) {
BigDecimal byWidth = getMaximumFractionDigits() > 0 ?
BigDecimal.ONE.movePointLeft(getMaximumFractionDigits()) : BigDecimal.ONE;
if (roundingIncrementICU.compareTo(byWidth) >= 0) {
actualRoundingIncrementICU = roundingIncrementICU;
} else {
actualRoundingIncrementICU = byWidth.equals(BigDecimal.ONE) ? null : byWidth;
}
} else {
if (roundingMode == BigDecimal.ROUND_HALF_EVEN || isScientificNotation()) {
// This rounding fix is irrelevant if mode is ROUND_HALF_EVEN as DigitList
// does ROUND_HALF_EVEN for us. This rounding fix won't work at all for
// scientific notation.
actualRoundingIncrementICU = null;
} else {
if (getMaximumFractionDigits() > 0) {
actualRoundingIncrementICU = BigDecimal.ONE.movePointLeft(getMaximumFractionDigits());
} else {
actualRoundingIncrementICU = BigDecimal.ONE;
}
}
}
if (actualRoundingIncrementICU == null) {
setRoundingDouble(0.0d);
actualRoundingIncrement = null;
} else {
setRoundingDouble(actualRoundingIncrementICU.doubleValue());
actualRoundingIncrement = actualRoundingIncrementICU.toBigDecimal();
}
} | class class_name[name] begin[{]
method[resetActualRounding, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.roundingIncrementICU], !=, literal[null]]] begin[{]
local_variable[type[BigDecimal], byWidth]
if[binary_operation[call[roundingIncrementICU.compareTo, parameter[member[.byWidth]]], >=, literal[0]]] begin[{]
assign[member[.actualRoundingIncrementICU], member[.roundingIncrementICU]]
else begin[{]
assign[member[.actualRoundingIncrementICU], TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=ONE, postfix_operators=[], prefix_operators=[], qualifier=BigDecimal, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=byWidth, selectors=[], type_arguments=None), if_false=MemberReference(member=byWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.roundingMode], ==, member[BigDecimal.ROUND_HALF_EVEN]], ||, call[.isScientificNotation, parameter[]]]] begin[{]
assign[member[.actualRoundingIncrementICU], literal[null]]
else begin[{]
if[binary_operation[call[.getMaximumFractionDigits, parameter[]], >, literal[0]]] begin[{]
assign[member[.actualRoundingIncrementICU], call[BigDecimal.ONE.movePointLeft, parameter[call[.getMaximumFractionDigits, parameter[]]]]]
else begin[{]
assign[member[.actualRoundingIncrementICU], member[BigDecimal.ONE]]
end[}]
end[}]
end[}]
if[binary_operation[member[.actualRoundingIncrementICU], ==, literal[null]]] begin[{]
call[.setRoundingDouble, parameter[literal[0.0d]]]
assign[member[.actualRoundingIncrement], literal[null]]
else begin[{]
call[.setRoundingDouble, parameter[call[actualRoundingIncrementICU.doubleValue, parameter[]]]]
assign[member[.actualRoundingIncrement], call[actualRoundingIncrementICU.toBigDecimal, parameter[]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[resetActualRounding] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[roundingIncrementICU] operator[!=] Other[null] operator[SEP] {
identifier[BigDecimal] identifier[byWidth] operator[=] identifier[getMaximumFractionDigits] operator[SEP] operator[SEP] operator[>] Other[0] operator[?] identifier[BigDecimal] operator[SEP] identifier[ONE] operator[SEP] identifier[movePointLeft] operator[SEP] identifier[getMaximumFractionDigits] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[BigDecimal] operator[SEP] identifier[ONE] operator[SEP] Keyword[if] operator[SEP] identifier[roundingIncrementICU] operator[SEP] identifier[compareTo] operator[SEP] identifier[byWidth] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[actualRoundingIncrementICU] operator[=] identifier[roundingIncrementICU] operator[SEP]
}
Keyword[else] {
identifier[actualRoundingIncrementICU] operator[=] identifier[byWidth] operator[SEP] identifier[equals] operator[SEP] identifier[BigDecimal] operator[SEP] identifier[ONE] operator[SEP] operator[?] Other[null] operator[:] identifier[byWidth] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[roundingMode] operator[==] identifier[BigDecimal] operator[SEP] identifier[ROUND_HALF_EVEN] operator[||] identifier[isScientificNotation] operator[SEP] operator[SEP] operator[SEP] {
identifier[actualRoundingIncrementICU] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[getMaximumFractionDigits] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[actualRoundingIncrementICU] operator[=] identifier[BigDecimal] operator[SEP] identifier[ONE] operator[SEP] identifier[movePointLeft] operator[SEP] identifier[getMaximumFractionDigits] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[actualRoundingIncrementICU] operator[=] identifier[BigDecimal] operator[SEP] identifier[ONE] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[actualRoundingIncrementICU] operator[==] Other[null] operator[SEP] {
identifier[setRoundingDouble] operator[SEP] literal[Float] operator[SEP] operator[SEP] identifier[actualRoundingIncrement] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[setRoundingDouble] operator[SEP] identifier[actualRoundingIncrementICU] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[actualRoundingIncrement] operator[=] identifier[actualRoundingIncrementICU] operator[SEP] identifier[toBigDecimal] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Boolean billingAccount_canTransferSecurityDeposit_POST(String billingAccount, String billingAccountDestination) throws IOException {
String qPath = "/telephony/{billingAccount}/canTransferSecurityDeposit";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "billingAccountDestination", billingAccountDestination);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, Boolean.class);
} | class class_name[name] begin[{]
method[billingAccount_canTransferSecurityDeposit_POST, return_type[type[Boolean]], modifier[public], parameter[billingAccount, billingAccountDestination]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[HashMap], o]
call[.addBody, parameter[member[.o], literal["billingAccountDestination"], member[.billingAccountDestination]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Boolean, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Boolean] identifier[billingAccount_canTransferSecurityDeposit_POST] operator[SEP] identifier[String] identifier[billingAccount] , identifier[String] identifier[billingAccountDestination] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[billingAccount] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[billingAccountDestination] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static JsonObject jsonFromMultimap(MultiMap attributes) {
JsonObject json = new JsonObject();
if (attributes != null) {
for (Map.Entry<String, String> e: attributes.entries()) {
json.put(e.getKey(), e.getValue());
}
}
return json;
} | class class_name[name] begin[{]
method[jsonFromMultimap, return_type[type[JsonObject]], modifier[public static], parameter[attributes]] begin[{]
local_variable[type[JsonObject], json]
if[binary_operation[member[.attributes], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=json, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entries, postfix_operators=[], prefix_operators=[], qualifier=attributes, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
else begin[{]
None
end[}]
return[member[.json]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JsonObject] identifier[jsonFromMultimap] operator[SEP] identifier[MultiMap] identifier[attributes] operator[SEP] {
identifier[JsonObject] identifier[json] operator[=] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributes] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[e] operator[:] identifier[attributes] operator[SEP] identifier[entries] operator[SEP] operator[SEP] operator[SEP] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[json] operator[SEP]
}
|
public void marshall(DocumentClassifierInputDataConfig documentClassifierInputDataConfig, ProtocolMarshaller protocolMarshaller) {
if (documentClassifierInputDataConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(documentClassifierInputDataConfig.getS3Uri(), S3URI_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[documentClassifierInputDataConfig, protocolMarshaller]] begin[{]
if[binary_operation[member[.documentClassifierInputDataConfig], ==, 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=getS3Uri, postfix_operators=[], prefix_operators=[], qualifier=documentClassifierInputDataConfig, selectors=[], type_arguments=None), MemberReference(member=S3URI_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[DocumentClassifierInputDataConfig] identifier[documentClassifierInputDataConfig] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[documentClassifierInputDataConfig] 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[documentClassifierInputDataConfig] operator[SEP] identifier[getS3Uri] operator[SEP] operator[SEP] , identifier[S3URI_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
@InterfaceAudience.Public
public QueryEnumerator run() throws CouchbaseLiteException {
waitForRows();
if (rows == null) {
return null;
} else {
// Have to return a copy because the enumeration has to start at item #0 every time
return new QueryEnumerator(rows);
}
} | class class_name[name] begin[{]
method[run, return_type[type[QueryEnumerator]], modifier[public], parameter[]] begin[{]
call[.waitForRows, parameter[]]
if[binary_operation[member[.rows], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=rows, 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=QueryEnumerator, sub_type=None))]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[InterfaceAudience] operator[SEP] identifier[Public] Keyword[public] identifier[QueryEnumerator] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[CouchbaseLiteException] {
identifier[waitForRows] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rows] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[QueryEnumerator] operator[SEP] identifier[rows] operator[SEP] operator[SEP]
}
}
|
public void plusMinutes(long delta)
{
if (delta != 0)
{
long result = getMinute() + delta;
setMinute((int) Math.floorMod(result, 60));
plusHours(Math.floorDiv(result, 60));
}
} | class class_name[name] begin[{]
method[plusMinutes, return_type[void], modifier[public], parameter[delta]] begin[{]
if[binary_operation[member[.delta], !=, literal[0]]] begin[{]
local_variable[type[long], result]
call[.setMinute, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60)], member=floorMod, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]]
call[.plusHours, parameter[call[Math.floorDiv, parameter[member[.result], literal[60]]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[plusMinutes] operator[SEP] Keyword[long] identifier[delta] operator[SEP] {
Keyword[if] operator[SEP] identifier[delta] operator[!=] Other[0] operator[SEP] {
Keyword[long] identifier[result] operator[=] identifier[getMinute] operator[SEP] operator[SEP] operator[+] identifier[delta] operator[SEP] identifier[setMinute] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floorMod] operator[SEP] identifier[result] , Other[60] operator[SEP] operator[SEP] operator[SEP] identifier[plusHours] operator[SEP] identifier[Math] operator[SEP] identifier[floorDiv] operator[SEP] identifier[result] , Other[60] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
computeSVUID = (access & Opcodes.ACC_INTERFACE) == 0;
if (computeSVUID) {
this.name = name;
this.access = access;
this.interfaces = new String[interfaces.length];
System.arraycopy(interfaces, 0, this.interfaces, 0,
interfaces.length);
}
super.visit(version, access, name, signature, superName, interfaces);
} | class class_name[name] begin[{]
method[visit, return_type[void], modifier[public], parameter[version, access, name, signature, superName, interfaces]] begin[{]
assign[member[.computeSVUID], binary_operation[binary_operation[member[.access], &, member[Opcodes.ACC_INTERFACE]], ==, literal[0]]]
if[member[.computeSVUID]] begin[{]
assign[THIS[member[None.name]], member[.name]]
assign[THIS[member[None.access]], member[.access]]
assign[THIS[member[None.interfaces]], ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=interfaces, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
call[System.arraycopy, parameter[member[.interfaces], literal[0], THIS[member[None.interfaces]], literal[0], member[interfaces.length]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=access, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=superName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interfaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visit, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visit] operator[SEP] Keyword[final] Keyword[int] identifier[version] , Keyword[final] Keyword[int] identifier[access] , Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[signature] , Keyword[final] identifier[String] identifier[superName] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[interfaces] operator[SEP] {
identifier[computeSVUID] operator[=] operator[SEP] identifier[access] operator[&] identifier[Opcodes] operator[SEP] identifier[ACC_INTERFACE] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[computeSVUID] operator[SEP] {
Keyword[this] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP] Keyword[this] operator[SEP] identifier[access] operator[=] identifier[access] operator[SEP] Keyword[this] operator[SEP] identifier[interfaces] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[interfaces] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[interfaces] , Other[0] , Keyword[this] operator[SEP] identifier[interfaces] , Other[0] , identifier[interfaces] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[visit] operator[SEP] identifier[version] , identifier[access] , identifier[name] , identifier[signature] , identifier[superName] , identifier[interfaces] operator[SEP] operator[SEP]
}
|
public static Date getLastRefreshDate(Bundle bundle) {
Validate.notNull(bundle, "bundle");
return getDate(bundle, LAST_REFRESH_DATE_KEY);
} | class class_name[name] begin[{]
method[getLastRefreshDate, return_type[type[Date]], modifier[public static], parameter[bundle]] begin[{]
call[Validate.notNull, parameter[member[.bundle], literal["bundle"]]]
return[call[.getDate, parameter[member[.bundle], member[.LAST_REFRESH_DATE_KEY]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Date] identifier[getLastRefreshDate] operator[SEP] identifier[Bundle] identifier[bundle] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[bundle] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[getDate] operator[SEP] identifier[bundle] , identifier[LAST_REFRESH_DATE_KEY] operator[SEP] operator[SEP]
}
|
@Override
public PathImpl getPath(String name)
{
if (_prefix != null && _pathPrefix == null)
_pathPrefix = _prefix.replace('.', '/');
if (_pathPrefix != null && ! name.startsWith(_pathPrefix))
return null;
if (name.startsWith("/"))
return _path.lookup("." + name);
else
return _path.lookup(name);
} | class class_name[name] begin[{]
method[getPath, return_type[type[PathImpl]], modifier[public], parameter[name]] begin[{]
if[binary_operation[binary_operation[member[._prefix], !=, literal[null]], &&, binary_operation[member[._pathPrefix], ==, literal[null]]]] begin[{]
assign[member[._pathPrefix], call[_prefix.replace, parameter[literal['.'], literal['/']]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[._pathPrefix], !=, literal[null]], &&, call[name.startsWith, parameter[member[._pathPrefix]]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[name.startsWith, parameter[literal["/"]]]] begin[{]
return[call[_path.lookup, parameter[binary_operation[literal["."], +, member[.name]]]]]
else begin[{]
return[call[_path.lookup, parameter[member[.name]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[PathImpl] identifier[getPath] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[_prefix] operator[!=] Other[null] operator[&&] identifier[_pathPrefix] operator[==] Other[null] operator[SEP] identifier[_pathPrefix] operator[=] identifier[_prefix] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_pathPrefix] operator[!=] Other[null] operator[&&] operator[!] identifier[name] operator[SEP] identifier[startsWith] operator[SEP] identifier[_pathPrefix] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[_path] operator[SEP] identifier[lookup] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[_path] operator[SEP] identifier[lookup] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
|
private static boolean verifyFile(Configuration conf,
FileSystem srcFs, FileSystem parityFs,
FileStatus stat, Path parityPath, Codec codec,
long blockOffset, Progressable reporter)
throws IOException, InterruptedException {
Path srcPath = stat.getPath();
LOG.info("Verify file: " + srcPath + " at offset: " + blockOffset);
int limit = (int) Math.min(stat.getBlockSize(), DEFAULT_VERIFY_LEN);
if (reporter == null) {
reporter = RaidUtils.NULL_PROGRESSABLE;
}
// try to decode.
Decoder decoder = new Decoder(conf, codec);
if (codec.isDirRaid) {
decoder.connectToStore(srcPath);
}
List<Long> errorOffsets = new ArrayList<Long>();
// first limit bytes
errorOffsets.add(blockOffset);
long left = Math.min(stat.getBlockSize(), stat.getLen() - blockOffset);
if (left > limit) {
// last limit bytes
errorOffsets.add(blockOffset + left - limit);
// random limit bytes.
errorOffsets.add(blockOffset +
rand.nextInt((int)(left - limit)));
}
byte[] buffer = new byte[limit];
FSDataInputStream is = srcFs.open(srcPath);
try {
for (long errorOffset : errorOffsets) {
is.seek(errorOffset);
is.read(buffer);
// calculate the oldCRC.
CRC32 oldCrc = new CRC32();
oldCrc.update(buffer);
CRC32 newCrc = new CRC32();
DecoderInputStream stream = decoder.new DecoderInputStream(
RaidUtils.NULL_PROGRESSABLE, limit, stat.getBlockSize(), errorOffset,
srcFs, srcPath, parityFs, parityPath, null, null, false);
try {
stream.read(buffer);
newCrc.update(buffer);
if (oldCrc.getValue() != newCrc.getValue()) {
LogUtils.logFileCheckMetrics(LOGRESULTS.FAILURE, codec, srcPath,
srcFs, errorOffset, limit, null, reporter);
LOG.error("mismatch crc, old " + oldCrc.getValue() +
", new " + newCrc.getValue() + ", for file: " + srcPath
+ " at offset " + errorOffset + ", read limit " + limit);
return false;
}
} finally {
reporter.progress();
if (stream != null) {
stream.close();
}
}
}
return true;
} finally {
is.close();
}
} | class class_name[name] begin[{]
method[verifyFile, return_type[type[boolean]], modifier[private static], parameter[conf, srcFs, parityFs, stat, parityPath, codec, blockOffset, reporter]] begin[{]
local_variable[type[Path], srcPath]
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[literal["Verify file: "], +, member[.srcPath]], +, literal[" at offset: "]], +, member[.blockOffset]]]]
local_variable[type[int], limit]
if[binary_operation[member[.reporter], ==, literal[null]]] begin[{]
assign[member[.reporter], member[RaidUtils.NULL_PROGRESSABLE]]
else begin[{]
None
end[}]
local_variable[type[Decoder], decoder]
if[member[codec.isDirRaid]] begin[{]
call[decoder.connectToStore, parameter[member[.srcPath]]]
else begin[{]
None
end[}]
local_variable[type[List], errorOffsets]
call[errorOffsets.add, parameter[member[.blockOffset]]]
local_variable[type[long], left]
if[binary_operation[member[.left], >, member[.limit]]] begin[{]
call[errorOffsets.add, parameter[binary_operation[binary_operation[member[.blockOffset], +, member[.left]], -, member[.limit]]]]
call[errorOffsets.add, parameter[binary_operation[member[.blockOffset], +, call[rand.nextInt, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), type=BasicType(dimensions=[], name=int))]]]]]
else begin[{]
None
end[}]
local_variable[type[byte], buffer]
local_variable[type[FSDataInputStream], is]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=errorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=seek, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CRC32, sub_type=None)), name=oldCrc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CRC32, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=oldCrc, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CRC32, sub_type=None)), name=newCrc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CRC32, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=InnerClassCreator(arguments=[MemberReference(member=NULL_PROGRESSABLE, postfix_operators=[], prefix_operators=[], qualifier=RaidUtils, selectors=[]), MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBlockSize, postfix_operators=[], prefix_operators=[], qualifier=stat, selectors=[], type_arguments=None), MemberReference(member=errorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=srcFs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=srcPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parityFs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parityPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=decoder, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DecoderInputStream, sub_type=None)), name=stream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DecoderInputStream, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=newCrc, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=oldCrc, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=newCrc, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FAILURE, postfix_operators=[], prefix_operators=[], qualifier=LOGRESULTS, selectors=[]), MemberReference(member=codec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=srcPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=srcFs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=errorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=reporter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logFileCheckMetrics, postfix_operators=[], prefix_operators=[], qualifier=LogUtils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mismatch crc, old "), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=oldCrc, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", new "), operator=+), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=newCrc, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", for file: "), operator=+), operandr=MemberReference(member=srcPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" at offset "), operator=+), operandr=MemberReference(member=errorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", read limit "), operator=+), operandr=MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=progress, postfix_operators=[], prefix_operators=[], qualifier=reporter, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=errorOffsets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=errorOffset)], modifiers=set(), type=BasicType(dimensions=[], name=long))), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[verifyFile] operator[SEP] identifier[Configuration] identifier[conf] , identifier[FileSystem] identifier[srcFs] , identifier[FileSystem] identifier[parityFs] , identifier[FileStatus] identifier[stat] , identifier[Path] identifier[parityPath] , identifier[Codec] identifier[codec] , Keyword[long] identifier[blockOffset] , identifier[Progressable] identifier[reporter] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[Path] identifier[srcPath] operator[=] identifier[stat] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[srcPath] operator[+] literal[String] operator[+] identifier[blockOffset] operator[SEP] operator[SEP] Keyword[int] identifier[limit] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[stat] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] , identifier[DEFAULT_VERIFY_LEN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reporter] operator[==] Other[null] operator[SEP] {
identifier[reporter] operator[=] identifier[RaidUtils] operator[SEP] identifier[NULL_PROGRESSABLE] operator[SEP]
}
identifier[Decoder] identifier[decoder] operator[=] Keyword[new] identifier[Decoder] operator[SEP] identifier[conf] , identifier[codec] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[codec] operator[SEP] identifier[isDirRaid] operator[SEP] {
identifier[decoder] operator[SEP] identifier[connectToStore] operator[SEP] identifier[srcPath] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Long] operator[>] identifier[errorOffsets] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Long] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[errorOffsets] operator[SEP] identifier[add] operator[SEP] identifier[blockOffset] operator[SEP] operator[SEP] Keyword[long] identifier[left] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[stat] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] , identifier[stat] operator[SEP] identifier[getLen] operator[SEP] operator[SEP] operator[-] identifier[blockOffset] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[left] operator[>] identifier[limit] operator[SEP] {
identifier[errorOffsets] operator[SEP] identifier[add] operator[SEP] identifier[blockOffset] operator[+] identifier[left] operator[-] identifier[limit] operator[SEP] operator[SEP] identifier[errorOffsets] operator[SEP] identifier[add] operator[SEP] identifier[blockOffset] operator[+] identifier[rand] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[left] operator[-] identifier[limit] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[limit] operator[SEP] operator[SEP] identifier[FSDataInputStream] identifier[is] operator[=] identifier[srcFs] operator[SEP] identifier[open] operator[SEP] identifier[srcPath] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] Keyword[long] identifier[errorOffset] operator[:] identifier[errorOffsets] operator[SEP] {
identifier[is] operator[SEP] identifier[seek] operator[SEP] identifier[errorOffset] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] identifier[CRC32] identifier[oldCrc] operator[=] Keyword[new] identifier[CRC32] operator[SEP] operator[SEP] operator[SEP] identifier[oldCrc] operator[SEP] identifier[update] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] identifier[CRC32] identifier[newCrc] operator[=] Keyword[new] identifier[CRC32] operator[SEP] operator[SEP] operator[SEP] identifier[DecoderInputStream] identifier[stream] operator[=] identifier[decoder] operator[SEP] Keyword[new] identifier[DecoderInputStream] operator[SEP] identifier[RaidUtils] operator[SEP] identifier[NULL_PROGRESSABLE] , identifier[limit] , identifier[stat] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] , identifier[errorOffset] , identifier[srcFs] , identifier[srcPath] , identifier[parityFs] , identifier[parityPath] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP] Keyword[try] {
identifier[stream] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] identifier[newCrc] operator[SEP] identifier[update] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldCrc] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] identifier[newCrc] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[LogUtils] operator[SEP] identifier[logFileCheckMetrics] operator[SEP] identifier[LOGRESULTS] operator[SEP] identifier[FAILURE] , identifier[codec] , identifier[srcPath] , identifier[srcFs] , identifier[errorOffset] , identifier[limit] , Other[null] , identifier[reporter] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[oldCrc] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[newCrc] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[srcPath] operator[+] literal[String] operator[+] identifier[errorOffset] operator[+] literal[String] operator[+] identifier[limit] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[finally] {
identifier[reporter] operator[SEP] identifier[progress] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stream] operator[!=] Other[null] operator[SEP] {
identifier[stream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[finally] {
identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Kontonummer getKontonummer(String kontonummer) throws IllegalArgumentException {
validateSyntax(kontonummer);
validateChecksum(kontonummer);
return new Kontonummer(kontonummer);
} | class class_name[name] begin[{]
method[getKontonummer, return_type[type[Kontonummer]], modifier[public static], parameter[kontonummer]] begin[{]
call[.validateSyntax, parameter[member[.kontonummer]]]
call[.validateChecksum, parameter[member[.kontonummer]]]
return[ClassCreator(arguments=[MemberReference(member=kontonummer, 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=Kontonummer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Kontonummer] identifier[getKontonummer] operator[SEP] identifier[String] identifier[kontonummer] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
identifier[validateSyntax] operator[SEP] identifier[kontonummer] operator[SEP] operator[SEP] identifier[validateChecksum] operator[SEP] identifier[kontonummer] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Kontonummer] operator[SEP] identifier[kontonummer] operator[SEP] operator[SEP]
}
|
public static<E> Set<E> retainKeys(Counter<E> counter, Collection<E> matchKeys) {
Set<E> removed = new HashSet<E>();
for (E key : counter.keySet()) {
boolean matched = matchKeys.contains(key);
if (!matched) {
removed.add(key);
}
}
for (E key : removed) {
counter.remove(key);
}
return removed;
} | class class_name[name] begin[{]
method[retainKeys, return_type[type[Set]], modifier[public static], parameter[counter, matchKeys]] begin[{]
local_variable[type[Set], removed]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=matchKeys, selectors=[], type_arguments=None), name=matched)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=matched, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=removed, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=counter, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=counter, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=removed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
return[member[.removed]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[Set] operator[<] identifier[E] operator[>] identifier[retainKeys] operator[SEP] identifier[Counter] operator[<] identifier[E] operator[>] identifier[counter] , identifier[Collection] operator[<] identifier[E] operator[>] identifier[matchKeys] operator[SEP] {
identifier[Set] operator[<] identifier[E] operator[>] identifier[removed] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[E] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[E] identifier[key] operator[:] identifier[counter] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[matched] operator[=] identifier[matchKeys] operator[SEP] identifier[contains] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[matched] operator[SEP] {
identifier[removed] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[E] identifier[key] operator[:] identifier[removed] operator[SEP] {
identifier[counter] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[return] identifier[removed] operator[SEP]
}
|
public String keyToString(Object key) {
// This string should be in the format of:
// "<TYPE>:<KEY>" for internally supported types or "T:<KEY_CLASS>:<KEY>" for custom types
// e.g.:
// "S:my string key"
// "I:75"
// "D:5.34"
// "B:f"
// "T:com.myorg.MyType:STRING_GENERATED_BY_TRANSFORMER_FOR_MY_TYPE"
// First going to check if the key is a primitive or a String. Otherwise, check if it's a transformable.
// If none of those conditions are satisfied, we'll throw a CacheException.
// Using 'X' for Shorts and 'Y' for Bytes because 'S' is used for Strings and 'B' is being used for Booleans.
if (key instanceof byte[])
return "A:" + Base64.getEncoder().encodeToString((byte[]) key); //todo [anistor] need to profile Base64 versus simple hex encoding of the raw bytes
if (key instanceof String)
return "S:" + key;
else if (key instanceof Integer)
return "I:" + key;
else if (key instanceof Boolean)
return "B:" + key;
else if (key instanceof Long)
return "L:" + key;
else if (key instanceof Float)
return "F:" + key;
else if (key instanceof Double)
return "D:" + key;
else if (key instanceof Short)
return "X:" + key;
else if (key instanceof Byte)
return "Y:" + key;
else if (key instanceof Character)
return "C:" + key;
else if (key instanceof UUID)
return "U:" + key;
else {
Transformer t = getTransformer(key.getClass());
if (t != null) {
return "T:" + key.getClass().getName() + ":" + t.toString(key);
} else {
throw log.noTransformerForKey(key.getClass().getName());
}
}
} | class class_name[name] begin[{]
method[keyToString, return_type[type[String]], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.key], instanceof, type[byte]]] begin[{]
return[binary_operation[literal["A:"], +, call[Base64.getEncoder, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.key], instanceof, type[String]]] begin[{]
return[binary_operation[literal["S:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Integer]]] begin[{]
return[binary_operation[literal["I:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Boolean]]] begin[{]
return[binary_operation[literal["B:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Long]]] begin[{]
return[binary_operation[literal["L:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Float]]] begin[{]
return[binary_operation[literal["F:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Double]]] begin[{]
return[binary_operation[literal["D:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Short]]] begin[{]
return[binary_operation[literal["X:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Byte]]] begin[{]
return[binary_operation[literal["Y:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[Character]]] begin[{]
return[binary_operation[literal["C:"], +, member[.key]]]
else begin[{]
if[binary_operation[member[.key], instanceof, type[UUID]]] begin[{]
return[binary_operation[literal["U:"], +, member[.key]]]
else begin[{]
local_variable[type[Transformer], t]
if[binary_operation[member[.t], !=, literal[null]]] begin[{]
return[binary_operation[binary_operation[binary_operation[literal["T:"], +, call[key.getClass, parameter[]]], +, literal[":"]], +, call[t.toString, parameter[member[.key]]]]]
else begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=noTransformerForKey, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[keyToString] operator[SEP] identifier[Object] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[+] identifier[Base64] operator[SEP] identifier[getEncoder] operator[SEP] operator[SEP] operator[SEP] identifier[encodeToString] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[String] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Integer] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Boolean] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Long] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Float] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Double] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Short] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Byte] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Character] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[UUID] operator[SEP] Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] Keyword[else] {
identifier[Transformer] identifier[t] operator[=] identifier[getTransformer] operator[SEP] identifier[key] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[key] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[t] operator[SEP] identifier[toString] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[log] operator[SEP] identifier[noTransformerForKey] operator[SEP] identifier[key] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static ClassResolver softCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new SoftReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
} | class class_name[name] begin[{]
method[softCachingResolver, return_type[type[ClassResolver]], modifier[public static], parameter[classLoader]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=defaultClassLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassLoaderClassResolver, sub_type=None)), ClassCreator(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=[], name=Reference, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=None, name=SoftReferenceMap, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CachingClassResolver, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ClassResolver] identifier[softCachingResolver] operator[SEP] identifier[ClassLoader] identifier[classLoader] operator[SEP] {
Keyword[return] Keyword[new] identifier[CachingClassResolver] operator[SEP] Keyword[new] identifier[ClassLoaderClassResolver] operator[SEP] identifier[defaultClassLoader] operator[SEP] identifier[classLoader] operator[SEP] operator[SEP] , Keyword[new] identifier[SoftReferenceMap] operator[<] identifier[String] , identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Reference] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean recoverStorageDirs(StartupOption startOpt,
Map<StorageDirectory, StorageState> dataDirStates) throws IOException {
boolean isFormatted = false;
for (Iterator<StorageDirectory> it =
storage.dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
StorageState curState;
try {
curState = sd.analyzeStorage(startOpt);
isFormatted |= NNStorage.recoverDirectory(sd, startOpt, curState, true);
} catch (IOException ioe) {
sd.unlock();
throw ioe;
}
dataDirStates.put(sd,curState);
}
return isFormatted;
} | class class_name[name] begin[{]
method[recoverStorageDirs, return_type[type[boolean]], modifier[private], parameter[startOpt, dataDirStates]] begin[{]
local_variable[type[boolean], isFormatted]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=sd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StorageDirectory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=curState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StorageState, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=curState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=startOpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyzeStorage, postfix_operators=[], prefix_operators=[], qualifier=sd, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isFormatted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=|=, value=MethodInvocation(arguments=[MemberReference(member=sd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=startOpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=curState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=recoverDirectory, postfix_operators=[], prefix_operators=[], qualifier=NNStorage, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=sd, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=curState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=dataDirStates, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=dirIterator, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StorageDirectory, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[member[.isFormatted]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[recoverStorageDirs] operator[SEP] identifier[StartupOption] identifier[startOpt] , identifier[Map] operator[<] identifier[StorageDirectory] , identifier[StorageState] operator[>] identifier[dataDirStates] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[boolean] identifier[isFormatted] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[StorageDirectory] operator[>] identifier[it] operator[=] identifier[storage] operator[SEP] identifier[dirIterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[StorageDirectory] identifier[sd] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[StorageState] identifier[curState] operator[SEP] Keyword[try] {
identifier[curState] operator[=] identifier[sd] operator[SEP] identifier[analyzeStorage] operator[SEP] identifier[startOpt] operator[SEP] operator[SEP] identifier[isFormatted] operator[|=] identifier[NNStorage] operator[SEP] identifier[recoverDirectory] operator[SEP] identifier[sd] , identifier[startOpt] , identifier[curState] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
identifier[sd] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[ioe] operator[SEP]
}
identifier[dataDirStates] operator[SEP] identifier[put] operator[SEP] identifier[sd] , identifier[curState] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isFormatted] operator[SEP]
}
|
private ScenarioManager createScenarioManager(
Class<? extends Scenario> scenarioClass, String scenarioID,
String initialState, Properties properties) throws ShanksException {
// throws UnsupportedNetworkElementFieldException,
// TooManyConnectionException, UnsupportedScenarioStatusException,
// DuplicatedIDException, SecurityException, NoSuchMethodException,
// IllegalArgumentException, InstantiationException,
// IllegalAccessException, InvocationTargetException,
// DuplicatedPortrayalIDException, ScenarioNotFoundException {
Constructor<? extends Scenario> c;
Scenario s = null;
try {
c = scenarioClass
.getConstructor(new Class[] { String.class, String.class,
Properties.class, Logger.class });
s = c.newInstance(scenarioID, initialState, properties, this.getLogger());
} catch (SecurityException e) {
throw new ShanksException(e);
} catch (NoSuchMethodException e) {
throw new ShanksException(e);
} catch (IllegalArgumentException e) {
throw new ShanksException(e);
} catch (InstantiationException e) {
throw new ShanksException(e);
} catch (IllegalAccessException e) {
throw new ShanksException(e);
} catch (InvocationTargetException e) {
throw new ShanksException(e);
}
logger.fine("Scenario created");
ScenarioPortrayal sp = s.createScenarioPortrayal();
if (sp == null && !properties.get(Scenario.SIMULATION_GUI).equals(Scenario.NO_GUI)) {
logger.severe("ScenarioPortrayals is null");
logger.severe("Impossible to follow with the execution...");
throw new ShanksException("ScenarioPortrayals is null. Impossible to continue with the simulation...");
}
ScenarioManager sm = new ScenarioManager(s, sp, logger);
return sm;
} | class class_name[name] begin[{]
method[createScenarioManager, return_type[type[ScenarioManager]], modifier[private], parameter[scenarioClass, scenarioID, initialState, properties]] begin[{]
local_variable[type[Constructor], c]
local_variable[type[Scenario], s]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Logger, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None))], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=scenarioClass, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=scenarioID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=initialState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getLogger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=c, 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException'])), 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException'])), 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException'])), 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstantiationException'])), 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException'])), 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=ShanksException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException']))], finally_block=None, label=None, resources=None)
call[logger.fine, parameter[literal["Scenario created"]]]
local_variable[type[ScenarioPortrayal], sp]
if[binary_operation[binary_operation[member[.sp], ==, literal[null]], &&, call[properties.get, parameter[member[Scenario.SIMULATION_GUI]]]]] begin[{]
call[logger.severe, parameter[literal["ScenarioPortrayals is null"]]]
call[logger.severe, parameter[literal["Impossible to follow with the execution..."]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ScenarioPortrayals is null. Impossible to continue with the simulation...")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ShanksException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ScenarioManager], sm]
return[member[.sm]]
end[}]
END[}] | Keyword[private] identifier[ScenarioManager] identifier[createScenarioManager] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Scenario] operator[>] identifier[scenarioClass] , identifier[String] identifier[scenarioID] , identifier[String] identifier[initialState] , identifier[Properties] identifier[properties] operator[SEP] Keyword[throws] identifier[ShanksException] {
identifier[Constructor] operator[<] operator[?] Keyword[extends] identifier[Scenario] operator[>] identifier[c] operator[SEP] identifier[Scenario] identifier[s] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[c] operator[=] identifier[scenarioClass] operator[SEP] identifier[getConstructor] operator[SEP] Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] , identifier[Properties] operator[SEP] Keyword[class] , identifier[Logger] operator[SEP] Keyword[class]
} operator[SEP] operator[SEP] identifier[s] operator[=] identifier[c] operator[SEP] identifier[newInstance] operator[SEP] identifier[scenarioID] , identifier[initialState] , identifier[properties] , Keyword[this] operator[SEP] identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InstantiationException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ScenarioPortrayal] identifier[sp] operator[=] identifier[s] operator[SEP] identifier[createScenarioPortrayal] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sp] operator[==] Other[null] operator[&&] operator[!] identifier[properties] operator[SEP] identifier[get] operator[SEP] identifier[Scenario] operator[SEP] identifier[SIMULATION_GUI] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Scenario] operator[SEP] identifier[NO_GUI] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[severe] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[severe] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ShanksException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ScenarioManager] identifier[sm] operator[=] Keyword[new] identifier[ScenarioManager] operator[SEP] identifier[s] , identifier[sp] , identifier[logger] operator[SEP] operator[SEP] Keyword[return] identifier[sm] operator[SEP]
}
|
private static BiFunction<HttpClientResponse, Connection, Publisher<HttpResponse>> responseDelegate(final HttpRequest restRequest) {
return (reactorNettyResponse, reactorNettyConnection) ->
Mono.just(new ReactorNettyHttpResponse(reactorNettyResponse, reactorNettyConnection).withRequest(restRequest));
} | class class_name[name] begin[{]
method[responseDelegate, return_type[type[BiFunction]], modifier[private static], parameter[restRequest]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=reactorNettyResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=reactorNettyConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=restRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withRequest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ReactorNettyHttpResponse, sub_type=None))], member=just, postfix_operators=[], prefix_operators=[], qualifier=Mono, selectors=[], type_arguments=None), parameters=[InferredFormalParameter(name=reactorNettyResponse), InferredFormalParameter(name=reactorNettyConnection)])]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[BiFunction] operator[<] identifier[HttpClientResponse] , identifier[Connection] , identifier[Publisher] operator[<] identifier[HttpResponse] operator[>] operator[>] identifier[responseDelegate] operator[SEP] Keyword[final] identifier[HttpRequest] identifier[restRequest] operator[SEP] {
Keyword[return] operator[SEP] identifier[reactorNettyResponse] , identifier[reactorNettyConnection] operator[SEP] operator[->] identifier[Mono] operator[SEP] identifier[just] operator[SEP] Keyword[new] identifier[ReactorNettyHttpResponse] operator[SEP] identifier[reactorNettyResponse] , identifier[reactorNettyConnection] operator[SEP] operator[SEP] identifier[withRequest] operator[SEP] identifier[restRequest] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void addScope(String scope, int maxItemsInMemory) throws Exception {
CacheConfiguration scopeConfig = new CacheConfiguration(scope, maxItemsInMemory);
scopeManager.addCache(new Cache(scopeConfig));
} | class class_name[name] begin[{]
method[addScope, return_type[void], modifier[public], parameter[scope, maxItemsInMemory]] begin[{]
local_variable[type[CacheConfiguration], scopeConfig]
call[scopeManager.addCache, parameter[ClassCreator(arguments=[MemberReference(member=scopeConfig, 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=Cache, sub_type=None))]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addScope] operator[SEP] identifier[String] identifier[scope] , Keyword[int] identifier[maxItemsInMemory] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[CacheConfiguration] identifier[scopeConfig] operator[=] Keyword[new] identifier[CacheConfiguration] operator[SEP] identifier[scope] , identifier[maxItemsInMemory] operator[SEP] operator[SEP] identifier[scopeManager] operator[SEP] identifier[addCache] operator[SEP] Keyword[new] identifier[Cache] operator[SEP] identifier[scopeConfig] operator[SEP] operator[SEP] operator[SEP]
}
|
protected static int compareLexicographical(Itemset a, Itemset o) {
int i1 = a.iter(), i2 = o.iter();
while(a.iterValid(i1) && o.iterValid(i2)) {
int v1 = a.iterDim(i1), v2 = o.iterDim(i2);
if(v1 < v2) {
return -1;
}
if(v2 < v1) {
return +1;
}
i1 = a.iterAdvance(i1);
i2 = o.iterAdvance(i2);
}
return a.iterValid(i1) ? 1 : o.iterValid(i2) ? -1 : 0;
} | class class_name[name] begin[{]
method[compareLexicographical, return_type[type[int]], modifier[static protected], parameter[a, o]] begin[{]
local_variable[type[int], i1]
while[binary_operation[call[a.iterValid, parameter[member[.i1]]], &&, call[o.iterValid, parameter[member[.i2]]]]] begin[{]
local_variable[type[int], v1]
if[binary_operation[member[.v1], <, member[.v2]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
if[binary_operation[member[.v2], <, member[.v1]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
assign[member[.i1], call[a.iterAdvance, parameter[member[.i1]]]]
assign[member[.i2], call[o.iterAdvance, parameter[member[.i2]]]]
end[}]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=iterValid, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), if_false=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=iterValid, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[int] identifier[compareLexicographical] operator[SEP] identifier[Itemset] identifier[a] , identifier[Itemset] identifier[o] operator[SEP] {
Keyword[int] identifier[i1] operator[=] identifier[a] operator[SEP] identifier[iter] operator[SEP] operator[SEP] , identifier[i2] operator[=] identifier[o] operator[SEP] identifier[iter] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[a] operator[SEP] identifier[iterValid] operator[SEP] identifier[i1] operator[SEP] operator[&&] identifier[o] operator[SEP] identifier[iterValid] operator[SEP] identifier[i2] operator[SEP] operator[SEP] {
Keyword[int] identifier[v1] operator[=] identifier[a] operator[SEP] identifier[iterDim] operator[SEP] identifier[i1] operator[SEP] , identifier[v2] operator[=] identifier[o] operator[SEP] identifier[iterDim] operator[SEP] identifier[i2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v1] operator[<] identifier[v2] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[v2] operator[<] identifier[v1] operator[SEP] {
Keyword[return] operator[+] Other[1] operator[SEP]
}
identifier[i1] operator[=] identifier[a] operator[SEP] identifier[iterAdvance] operator[SEP] identifier[i1] operator[SEP] operator[SEP] identifier[i2] operator[=] identifier[o] operator[SEP] identifier[iterAdvance] operator[SEP] identifier[i2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[a] operator[SEP] identifier[iterValid] operator[SEP] identifier[i1] operator[SEP] operator[?] Other[1] operator[:] identifier[o] operator[SEP] identifier[iterValid] operator[SEP] identifier[i2] operator[SEP] operator[?] operator[-] Other[1] operator[:] Other[0] operator[SEP]
}
|
public static Vector3d normalizeSafe(Vector3d v) {
try {
return v.normalize();
} catch (ArithmeticException ex) {
return Vector3d.ZERO;
}
} | class class_name[name] begin[{]
method[normalizeSafe, return_type[type[Vector3d]], modifier[public static], parameter[v]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=normalize, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=ZERO, postfix_operators=[], prefix_operators=[], qualifier=Vector3d, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ArithmeticException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Vector3d] identifier[normalizeSafe] operator[SEP] identifier[Vector3d] identifier[v] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[v] operator[SEP] identifier[normalize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ArithmeticException] identifier[ex] operator[SEP] {
Keyword[return] identifier[Vector3d] operator[SEP] identifier[ZERO] operator[SEP]
}
}
|
private Expr generateQuantifierRanges(WyilFile.Expr.Quantifier expr, LocalEnvironment environment) {
Expr ranges = null;
Tuple<WyilFile.Decl.Variable> parameters = expr.getParameters();
for (int i = 0; i != parameters.size(); ++i) {
WyilFile.Decl.Variable var = parameters.get(i);
WyilFile.Expr.ArrayRange range = (WyilFile.Expr.ArrayRange) var.getInitialiser();
WyalFile.VariableDeclaration varDecl = environment.read(var);
Expr.VariableAccess varExpr = new Expr.VariableAccess(varDecl);
Expr startExpr = translateExpression(range.getFirstOperand(), null, environment);
Expr endExpr = translateExpression(range.getSecondOperand(), null, environment);
Expr lhs = new Expr.LessThanOrEqual(startExpr, varExpr);
Expr rhs = new Expr.LessThan(varExpr, endExpr);
ranges = and(ranges, and(lhs, rhs));
}
return ranges;
} | class class_name[name] begin[{]
method[generateQuantifierRanges, return_type[type[Expr]], modifier[private], parameter[expr, environment]] begin[{]
local_variable[type[Expr], ranges]
local_variable[type[Tuple], parameters]
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=parameters, selectors=[], type_arguments=None), name=var)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WyilFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=Decl, sub_type=ReferenceType(arguments=None, dimensions=None, name=Variable, sub_type=None)))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getInitialiser, postfix_operators=[], prefix_operators=[], qualifier=var, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=WyilFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=ArrayRange, sub_type=None)))), name=range)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WyilFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=ArrayRange, sub_type=None)))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=environment, selectors=[], type_arguments=None), name=varDecl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WyalFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=VariableDeclaration, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=varDecl, 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=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=VariableAccess, sub_type=None))), name=varExpr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=VariableAccess, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFirstOperand, postfix_operators=[], prefix_operators=[], qualifier=range, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=translateExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=startExpr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expr, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSecondOperand, postfix_operators=[], prefix_operators=[], qualifier=range, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=translateExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=endExpr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expr, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=startExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=varExpr, 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=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=LessThanOrEqual, sub_type=None))), name=lhs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expr, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=varExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endExpr, 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=Expr, sub_type=ReferenceType(arguments=None, dimensions=None, name=LessThan, sub_type=None))), name=rhs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expr, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ranges, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ranges, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=lhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=and, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=and, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[], type_arguments=None), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.ranges]]
end[}]
END[}] | Keyword[private] identifier[Expr] identifier[generateQuantifierRanges] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Expr] operator[SEP] identifier[Quantifier] identifier[expr] , identifier[LocalEnvironment] identifier[environment] operator[SEP] {
identifier[Expr] identifier[ranges] operator[=] Other[null] operator[SEP] identifier[Tuple] operator[<] identifier[WyilFile] operator[SEP] identifier[Decl] operator[SEP] identifier[Variable] operator[>] identifier[parameters] operator[=] identifier[expr] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[!=] identifier[parameters] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[WyilFile] operator[SEP] identifier[Decl] operator[SEP] identifier[Variable] identifier[var] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Expr] operator[SEP] identifier[ArrayRange] identifier[range] operator[=] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Expr] operator[SEP] identifier[ArrayRange] operator[SEP] identifier[var] operator[SEP] identifier[getInitialiser] operator[SEP] operator[SEP] operator[SEP] identifier[WyalFile] operator[SEP] identifier[VariableDeclaration] identifier[varDecl] operator[=] identifier[environment] operator[SEP] identifier[read] operator[SEP] identifier[var] operator[SEP] operator[SEP] identifier[Expr] operator[SEP] identifier[VariableAccess] identifier[varExpr] operator[=] Keyword[new] identifier[Expr] operator[SEP] identifier[VariableAccess] operator[SEP] identifier[varDecl] operator[SEP] operator[SEP] identifier[Expr] identifier[startExpr] operator[=] identifier[translateExpression] operator[SEP] identifier[range] operator[SEP] identifier[getFirstOperand] operator[SEP] operator[SEP] , Other[null] , identifier[environment] operator[SEP] operator[SEP] identifier[Expr] identifier[endExpr] operator[=] identifier[translateExpression] operator[SEP] identifier[range] operator[SEP] identifier[getSecondOperand] operator[SEP] operator[SEP] , Other[null] , identifier[environment] operator[SEP] operator[SEP] identifier[Expr] identifier[lhs] operator[=] Keyword[new] identifier[Expr] operator[SEP] identifier[LessThanOrEqual] operator[SEP] identifier[startExpr] , identifier[varExpr] operator[SEP] operator[SEP] identifier[Expr] identifier[rhs] operator[=] Keyword[new] identifier[Expr] operator[SEP] identifier[LessThan] operator[SEP] identifier[varExpr] , identifier[endExpr] operator[SEP] operator[SEP] identifier[ranges] operator[=] identifier[and] operator[SEP] identifier[ranges] , identifier[and] operator[SEP] identifier[lhs] , identifier[rhs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ranges] operator[SEP]
}
|
public static void cursorRowToContentValues(Cursor cursor, ContentValues values) {
String[] columns = cursor.getColumnNames();
int length = columns.length;
for (int i = 0; i < length; i++) {
if (cursor.getType(i) == Cursor.FIELD_TYPE_BLOB) {
values.put(columns[i], cursor.getBlob(i));
} else {
values.put(columns[i], cursor.getString(i));
}
}
} | class class_name[name] begin[{]
method[cursorRowToContentValues, return_type[void], modifier[public static], parameter[cursor, values]] begin[{]
local_variable[type[String], columns]
local_variable[type[int], length]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None), operandr=MemberReference(member=FIELD_TYPE_BLOB, postfix_operators=[], prefix_operators=[], qualifier=Cursor, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBlob, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[cursorRowToContentValues] operator[SEP] identifier[Cursor] identifier[cursor] , identifier[ContentValues] identifier[values] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[columns] operator[=] identifier[cursor] operator[SEP] identifier[getColumnNames] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[length] operator[=] identifier[columns] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[getType] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[Cursor] operator[SEP] identifier[FIELD_TYPE_BLOB] operator[SEP] {
identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[columns] operator[SEP] identifier[i] operator[SEP] , identifier[cursor] operator[SEP] identifier[getBlob] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[columns] operator[SEP] identifier[i] operator[SEP] , identifier[cursor] operator[SEP] identifier[getString] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void processRunnableOperations(
final Consumer<WorkflowSystem.OperationResult<DAT, RES, OP>> resultConsumer,
final List<OP> shouldrun,
final List<OP> shouldskip,
final DAT inputData
)
{
for (final OP operation : shouldrun) {
if (shouldskip.contains(operation)) {
continue;
}
pending.remove(operation);
workflowEngine.event(
WorkflowSystemEventType.WillRunOperation,
String.format("operation starting: %s", operation),
operation
);
final ListenableFuture<RES> submit = executorService.submit(() -> operation.apply(inputData));
inProcess.add(operation);
futures.add(submit);
FutureCallback<RES> callback = new FutureCallback<RES>() {
@Override
public void onSuccess(final RES successResult) {
workflowEngine.event(
WorkflowSystemEventType.OperationSuccess,
String.format("operation succeeded: %s", successResult),
successResult
);
assert successResult != null;
WorkflowSystem.OperationResult<DAT, RES, OP> result = result(successResult, operation);
resultConsumer.accept(result);
stateChangeQueue.add(successResult);
inProcess.remove(operation);
}
@Override
public void onFailure(final Throwable t) {
workflowEngine.event(
WorkflowSystemEventType.OperationFailed,
String.format("operation failed: %s", t),
t
);
WorkflowSystem.OperationResult<DAT, RES, OP> result = result(t, operation);
resultConsumer.accept(result);
StateObj newFailureState = operation.getFailureState(t);
if (null != newFailureState && newFailureState.getState().size() > 0) {
WorkflowSystem.OperationCompleted<DAT> objectOperationCompleted = WorkflowEngine.dummyResult(
newFailureState);
stateChangeQueue.add(objectOperationCompleted);
}
inProcess.remove(operation);
}
};
Futures.addCallback(submit, callback, manager);
}
} | class class_name[name] begin[{]
method[processRunnableOperations, return_type[void], modifier[private], parameter[resultConsumer, shouldrun, shouldskip, inputData]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=shouldskip, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=pending, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WillRunOperation, postfix_operators=[], prefix_operators=[], qualifier=WorkflowSystemEventType, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="operation starting: %s"), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=event, postfix_operators=[], prefix_operators=[], qualifier=workflowEngine, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=inputData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), parameters=[])], member=submit, postfix_operators=[], prefix_operators=[], qualifier=executorService, selectors=[], type_arguments=None), name=submit)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None))], dimensions=[], name=ListenableFuture, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=inProcess, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=submit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=OperationSuccess, postfix_operators=[], prefix_operators=[], qualifier=WorkflowSystemEventType, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="operation succeeded: %s"), MemberReference(member=successResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=successResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=event, postfix_operators=[], prefix_operators=[], qualifier=workflowEngine, selectors=[], type_arguments=None), label=None), AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=successResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=successResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WorkflowSystem, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DAT, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OP, sub_type=None))], dimensions=None, name=OperationResult, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=resultConsumer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=successResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=stateChangeQueue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=inProcess, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onSuccess, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=successResult, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=OperationFailed, postfix_operators=[], prefix_operators=[], qualifier=WorkflowSystemEventType, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="operation failed: %s"), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=event, postfix_operators=[], prefix_operators=[], qualifier=workflowEngine, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WorkflowSystem, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DAT, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OP, sub_type=None))], dimensions=None, name=OperationResult, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=resultConsumer, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFailureState, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), name=newFailureState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StateObj, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=newFailureState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getState, postfix_operators=[], prefix_operators=[], qualifier=newFailureState, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=newFailureState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=dummyResult, postfix_operators=[], prefix_operators=[], qualifier=WorkflowEngine, selectors=[], type_arguments=None), name=objectOperationCompleted)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WorkflowSystem, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DAT, sub_type=None))], dimensions=None, name=OperationCompleted, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=objectOperationCompleted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=stateChangeQueue, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=inProcess, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onFailure, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None))], dimensions=None, name=FutureCallback, sub_type=None)), name=callback)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RES, sub_type=None))], dimensions=[], name=FutureCallback, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=submit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=callback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=manager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCallback, postfix_operators=[], prefix_operators=[], qualifier=Futures, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=shouldrun, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=operation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=OP, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processRunnableOperations] operator[SEP] Keyword[final] identifier[Consumer] operator[<] identifier[WorkflowSystem] operator[SEP] identifier[OperationResult] operator[<] identifier[DAT] , identifier[RES] , identifier[OP] operator[>] operator[>] identifier[resultConsumer] , Keyword[final] identifier[List] operator[<] identifier[OP] operator[>] identifier[shouldrun] , Keyword[final] identifier[List] operator[<] identifier[OP] operator[>] identifier[shouldskip] , Keyword[final] identifier[DAT] identifier[inputData] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[OP] identifier[operation] operator[:] identifier[shouldrun] operator[SEP] {
Keyword[if] operator[SEP] identifier[shouldskip] operator[SEP] identifier[contains] operator[SEP] identifier[operation] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[pending] operator[SEP] identifier[remove] operator[SEP] identifier[operation] operator[SEP] operator[SEP] identifier[workflowEngine] operator[SEP] identifier[event] operator[SEP] identifier[WorkflowSystemEventType] operator[SEP] identifier[WillRunOperation] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[operation] operator[SEP] , identifier[operation] operator[SEP] operator[SEP] Keyword[final] identifier[ListenableFuture] operator[<] identifier[RES] operator[>] identifier[submit] operator[=] identifier[executorService] operator[SEP] identifier[submit] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[operation] operator[SEP] identifier[apply] operator[SEP] identifier[inputData] operator[SEP] operator[SEP] operator[SEP] identifier[inProcess] operator[SEP] identifier[add] operator[SEP] identifier[operation] operator[SEP] operator[SEP] identifier[futures] operator[SEP] identifier[add] operator[SEP] identifier[submit] operator[SEP] operator[SEP] identifier[FutureCallback] operator[<] identifier[RES] operator[>] identifier[callback] operator[=] Keyword[new] identifier[FutureCallback] operator[<] identifier[RES] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onSuccess] operator[SEP] Keyword[final] identifier[RES] identifier[successResult] operator[SEP] {
identifier[workflowEngine] operator[SEP] identifier[event] operator[SEP] identifier[WorkflowSystemEventType] operator[SEP] identifier[OperationSuccess] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[successResult] operator[SEP] , identifier[successResult] operator[SEP] operator[SEP] Keyword[assert] identifier[successResult] operator[!=] Other[null] operator[SEP] identifier[WorkflowSystem] operator[SEP] identifier[OperationResult] operator[<] identifier[DAT] , identifier[RES] , identifier[OP] operator[>] identifier[result] operator[=] identifier[result] operator[SEP] identifier[successResult] , identifier[operation] operator[SEP] operator[SEP] identifier[resultConsumer] operator[SEP] identifier[accept] operator[SEP] identifier[result] operator[SEP] operator[SEP] identifier[stateChangeQueue] operator[SEP] identifier[add] operator[SEP] identifier[successResult] operator[SEP] operator[SEP] identifier[inProcess] operator[SEP] identifier[remove] operator[SEP] identifier[operation] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onFailure] operator[SEP] Keyword[final] identifier[Throwable] identifier[t] operator[SEP] {
identifier[workflowEngine] operator[SEP] identifier[event] operator[SEP] identifier[WorkflowSystemEventType] operator[SEP] identifier[OperationFailed] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[t] operator[SEP] , identifier[t] operator[SEP] operator[SEP] identifier[WorkflowSystem] operator[SEP] identifier[OperationResult] operator[<] identifier[DAT] , identifier[RES] , identifier[OP] operator[>] identifier[result] operator[=] identifier[result] operator[SEP] identifier[t] , identifier[operation] operator[SEP] operator[SEP] identifier[resultConsumer] operator[SEP] identifier[accept] operator[SEP] identifier[result] operator[SEP] operator[SEP] identifier[StateObj] identifier[newFailureState] operator[=] identifier[operation] operator[SEP] identifier[getFailureState] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[newFailureState] operator[&&] identifier[newFailureState] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[WorkflowSystem] operator[SEP] identifier[OperationCompleted] operator[<] identifier[DAT] operator[>] identifier[objectOperationCompleted] operator[=] identifier[WorkflowEngine] operator[SEP] identifier[dummyResult] operator[SEP] identifier[newFailureState] operator[SEP] operator[SEP] identifier[stateChangeQueue] operator[SEP] identifier[add] operator[SEP] identifier[objectOperationCompleted] operator[SEP] operator[SEP]
}
identifier[inProcess] operator[SEP] identifier[remove] operator[SEP] identifier[operation] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[Futures] operator[SEP] identifier[addCallback] operator[SEP] identifier[submit] , identifier[callback] , identifier[manager] operator[SEP] operator[SEP]
}
}
|
public static Point2D_F64 computePoint( double t , EllipseRotated_F64 ellipse , Point2D_F64 output ) {
if( output == null )
output = new Point2D_F64();
double ct = Math.cos(t);
double st = Math.sin(t);
double cphi = Math.cos(ellipse.phi);
double sphi = Math.sin(ellipse.phi);
// coordinate in ellipse frame
double x = ellipse.a*ct;
double y = ellipse.b*st;
// put into global frame
output.x = ellipse.center.x + x*cphi - y*sphi;
output.y = ellipse.center.y + x*sphi + y*cphi;
return output;
} | class class_name[name] begin[{]
method[computePoint, return_type[type[Point2D_F64]], modifier[public static], parameter[t, ellipse, output]] begin[{]
if[binary_operation[member[.output], ==, literal[null]]] begin[{]
assign[member[.output], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Point2D_F64, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[double], ct]
local_variable[type[double], st]
local_variable[type[double], cphi]
local_variable[type[double], sphi]
local_variable[type[double], x]
local_variable[type[double], y]
assign[member[output.x], binary_operation[binary_operation[member[ellipse.center.x], +, binary_operation[member[.x], *, member[.cphi]]], -, binary_operation[member[.y], *, member[.sphi]]]]
assign[member[output.y], binary_operation[binary_operation[member[ellipse.center.y], +, binary_operation[member[.x], *, member[.sphi]]], +, binary_operation[member[.y], *, member[.cphi]]]]
return[member[.output]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Point2D_F64] identifier[computePoint] operator[SEP] Keyword[double] identifier[t] , identifier[EllipseRotated_F64] identifier[ellipse] , identifier[Point2D_F64] identifier[output] operator[SEP] {
Keyword[if] operator[SEP] identifier[output] operator[==] Other[null] operator[SEP] identifier[output] operator[=] Keyword[new] identifier[Point2D_F64] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[ct] operator[=] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[double] identifier[st] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[double] identifier[cphi] operator[=] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[ellipse] operator[SEP] identifier[phi] operator[SEP] operator[SEP] Keyword[double] identifier[sphi] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[ellipse] operator[SEP] identifier[phi] operator[SEP] operator[SEP] Keyword[double] identifier[x] operator[=] identifier[ellipse] operator[SEP] identifier[a] operator[*] identifier[ct] operator[SEP] Keyword[double] identifier[y] operator[=] identifier[ellipse] operator[SEP] identifier[b] operator[*] identifier[st] operator[SEP] identifier[output] operator[SEP] identifier[x] operator[=] identifier[ellipse] operator[SEP] identifier[center] operator[SEP] identifier[x] operator[+] identifier[x] operator[*] identifier[cphi] operator[-] identifier[y] operator[*] identifier[sphi] operator[SEP] identifier[output] operator[SEP] identifier[y] operator[=] identifier[ellipse] operator[SEP] identifier[center] operator[SEP] identifier[y] operator[+] identifier[x] operator[*] identifier[sphi] operator[+] identifier[y] operator[*] identifier[cphi] operator[SEP] Keyword[return] identifier[output] operator[SEP]
}
|
public static void printError(Object caller, String format, Object... args)
{
Object msg = String.format(format, args);
printError(caller,msg);
} | class class_name[name] begin[{]
method[printError, return_type[void], modifier[public static], parameter[caller, format, args]] begin[{]
local_variable[type[Object], msg]
call[.printError, parameter[member[.caller], member[.msg]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printError] operator[SEP] identifier[Object] identifier[caller] , identifier[String] identifier[format] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[Object] identifier[msg] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[format] , identifier[args] operator[SEP] operator[SEP] identifier[printError] operator[SEP] identifier[caller] , identifier[msg] operator[SEP] operator[SEP]
}
|
public void merge(final WroModel importedModel) {
Validate.notNull(importedModel, "imported model cannot be null!");
LOG.debug("merging importedModel: {}", importedModel);
for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) {
if (new WroModelInspector(this).getGroupNames().contains(groupName)) {
throw new WroRuntimeException("Duplicate group name detected: " + groupName);
}
final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName);
addGroup(importedGroup);
}
} | class class_name[name] begin[{]
method[merge, return_type[void], modifier[public], parameter[importedModel]] begin[{]
call[Validate.notNull, parameter[member[.importedModel], literal["imported model cannot be null!"]]]
call[LOG.debug, parameter[literal["merging importedModel: {}"], member[.importedModel]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getGroupNames, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=groupName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WroModelInspector, sub_type=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="Duplicate group name detected: "), operandr=MemberReference(member=groupName, 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=WroRuntimeException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=importedModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=groupName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getGroupByName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WroModelInspector, sub_type=None)), name=importedGroup)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=importedGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=ClassCreator(arguments=[MemberReference(member=importedModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getGroupNames, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WroModelInspector, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=groupName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[merge] operator[SEP] Keyword[final] identifier[WroModel] identifier[importedModel] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[importedModel] , literal[String] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[importedModel] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[groupName] operator[:] Keyword[new] identifier[WroModelInspector] operator[SEP] identifier[importedModel] operator[SEP] operator[SEP] identifier[getGroupNames] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[new] identifier[WroModelInspector] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[getGroupNames] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[groupName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WroRuntimeException] operator[SEP] literal[String] operator[+] identifier[groupName] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Group] identifier[importedGroup] operator[=] Keyword[new] identifier[WroModelInspector] operator[SEP] identifier[importedModel] operator[SEP] operator[SEP] identifier[getGroupByName] operator[SEP] identifier[groupName] operator[SEP] operator[SEP] identifier[addGroup] operator[SEP] identifier[importedGroup] operator[SEP] operator[SEP]
}
}
|
@Override
public void doAbortSessionRequestEvent(ClientAuthSession appSession, AbortSessionRequest asr)
throws InternalException, IllegalDiameterStateException, RouteException, OverloadException {
logger.info("Diameter Gq AuthorizationSessionFactory :: doAbortSessionRequestEvent :: appSession[{}], ASR[{}]", appSession, asr);
} | class class_name[name] begin[{]
method[doAbortSessionRequestEvent, return_type[void], modifier[public], parameter[appSession, asr]] begin[{]
call[logger.info, parameter[literal["Diameter Gq AuthorizationSessionFactory :: doAbortSessionRequestEvent :: appSession[{}], ASR[{}]"], member[.appSession], member[.asr]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doAbortSessionRequestEvent] operator[SEP] identifier[ClientAuthSession] identifier[appSession] , identifier[AbortSessionRequest] identifier[asr] operator[SEP] Keyword[throws] identifier[InternalException] , identifier[IllegalDiameterStateException] , identifier[RouteException] , identifier[OverloadException] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[appSession] , identifier[asr] operator[SEP] operator[SEP]
}
|
@GwtIncompatible("incompatible method")
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
final int precision) {
return append(seq, formatter, flags, width, precision, ' ', null);
} | class class_name[name] begin[{]
method[append, return_type[type[Formatter]], modifier[public static], parameter[seq, formatter, flags, width, precision]] begin[{]
return[call[.append, parameter[member[.seq], member[.formatter], member[.flags], member[.width], member[.precision], literal[' '], literal[null]]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[Formatter] identifier[append] operator[SEP] Keyword[final] identifier[CharSequence] identifier[seq] , Keyword[final] identifier[Formatter] identifier[formatter] , Keyword[final] Keyword[int] identifier[flags] , Keyword[final] Keyword[int] identifier[width] , Keyword[final] Keyword[int] identifier[precision] operator[SEP] {
Keyword[return] identifier[append] operator[SEP] identifier[seq] , identifier[formatter] , identifier[flags] , identifier[width] , identifier[precision] , literal[String] , Other[null] operator[SEP] operator[SEP]
}
|
public TCPPort createEndPoint() throws ChannelException {
TCPPort tcpPort = super.createEndPoint();
try {
this.asyncChannelGroup = findOrCreateACG();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "AioTCPChannel created completion port for inbound connections on host " + getConfig().getHostname() + ", port " + getConfig().getPort()
+ ", completionPort = " + this.asyncChannelGroup.getCompletionPort());
}
} catch (AsyncException ae) {
ChannelException ce = new ChannelException("Error creating async channel group ");
ce.initCause(ae);
throw ce;
}
return tcpPort;
} | class class_name[name] begin[{]
method[createEndPoint, return_type[type[TCPPort]], modifier[public], parameter[]] begin[{]
local_variable[type[TCPPort], tcpPort]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=asyncChannelGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[], member=findOrCreateACG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AioTCPChannel created completion port for inbound connections on host "), operandr=MethodInvocation(arguments=[], member=getConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getHostname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", port "), operator=+), operandr=MethodInvocation(arguments=[], member=getConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getPort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", completionPort = "), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=asyncChannelGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getCompletionPort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error creating async channel group ")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelException, sub_type=None)), name=ce)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=[], prefix_operators=[], qualifier=ce, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=ce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ae, types=['AsyncException']))], finally_block=None, label=None, resources=None)
return[member[.tcpPort]]
end[}]
END[}] | Keyword[public] identifier[TCPPort] identifier[createEndPoint] operator[SEP] operator[SEP] Keyword[throws] identifier[ChannelException] {
identifier[TCPPort] identifier[tcpPort] operator[=] Keyword[super] operator[SEP] identifier[createEndPoint] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[asyncChannelGroup] operator[=] identifier[findOrCreateACG] 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[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getHostname] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[asyncChannelGroup] operator[SEP] identifier[getCompletionPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[AsyncException] identifier[ae] operator[SEP] {
identifier[ChannelException] identifier[ce] operator[=] Keyword[new] identifier[ChannelException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ce] operator[SEP] identifier[initCause] operator[SEP] identifier[ae] operator[SEP] operator[SEP] Keyword[throw] identifier[ce] operator[SEP]
}
Keyword[return] identifier[tcpPort] operator[SEP]
}
|
public EventCounter snapshot(boolean reset) {
EventCounter s = new EventCounter();
if (reset) {
s.count.set(count.getAndSet(0));
} else {
s.count.set(count.get());
}
return s;
} | class class_name[name] begin[{]
method[snapshot, return_type[type[EventCounter]], modifier[public], parameter[reset]] begin[{]
local_variable[type[EventCounter], s]
if[member[.reset]] begin[{]
call[s.count.set, parameter[call[count.getAndSet, parameter[literal[0]]]]]
else begin[{]
call[s.count.set, parameter[call[count.get, parameter[]]]]
end[}]
return[member[.s]]
end[}]
END[}] | Keyword[public] identifier[EventCounter] identifier[snapshot] operator[SEP] Keyword[boolean] identifier[reset] operator[SEP] {
identifier[EventCounter] identifier[s] operator[=] Keyword[new] identifier[EventCounter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reset] operator[SEP] {
identifier[s] operator[SEP] identifier[count] operator[SEP] identifier[set] operator[SEP] identifier[count] operator[SEP] identifier[getAndSet] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[s] operator[SEP] identifier[count] operator[SEP] identifier[set] operator[SEP] identifier[count] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[s] operator[SEP]
}
|
public static ClientRequestContextBuilder of(RpcRequest request, String uri) {
return of(request, URI.create(requireNonNull(uri, "uri")));
} | class class_name[name] begin[{]
method[of, return_type[type[ClientRequestContextBuilder]], modifier[public static], parameter[request, uri]] begin[{]
return[call[.of, parameter[member[.request], call[URI.create, parameter[call[.requireNonNull, parameter[member[.uri], literal["uri"]]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ClientRequestContextBuilder] identifier[of] operator[SEP] identifier[RpcRequest] identifier[request] , identifier[String] identifier[uri] operator[SEP] {
Keyword[return] identifier[of] operator[SEP] identifier[request] , identifier[URI] operator[SEP] identifier[create] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[uri] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void eachByte(Path self, int bufferLen, @ClosureParams(value = FromString.class, options = "byte[],Integer") Closure closure) throws IOException {
BufferedInputStream is = newInputStream(self);
IOGroovyMethods.eachByte(is, bufferLen, closure);
} | class class_name[name] begin[{]
method[eachByte, return_type[void], modifier[public static], parameter[self, bufferLen, closure]] begin[{]
local_variable[type[BufferedInputStream], is]
call[IOGroovyMethods.eachByte, parameter[member[.is], member[.bufferLen], member[.closure]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[eachByte] operator[SEP] identifier[Path] identifier[self] , Keyword[int] identifier[bufferLen] , annotation[@] identifier[ClosureParams] operator[SEP] identifier[value] operator[=] identifier[FromString] operator[SEP] Keyword[class] , identifier[options] operator[=] literal[String] operator[SEP] identifier[Closure] identifier[closure] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[BufferedInputStream] identifier[is] operator[=] identifier[newInputStream] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[IOGroovyMethods] operator[SEP] identifier[eachByte] operator[SEP] identifier[is] , identifier[bufferLen] , identifier[closure] operator[SEP] operator[SEP]
}
|
public static String truncate(String string, int maxBytesLength,
String appendString) {
return string.getBytes().length > maxBytesLength ? truncate(string,
maxBytesLength - appendString.getBytes().length) + appendString
: string;
} | class class_name[name] begin[{]
method[truncate, return_type[type[String]], modifier[public static], parameter[string, maxBytesLength, appendString]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=string, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operandr=MemberReference(member=maxBytesLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=maxBytesLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=appendString, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operator=-)], member=truncate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=appendString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[truncate] operator[SEP] identifier[String] identifier[string] , Keyword[int] identifier[maxBytesLength] , identifier[String] identifier[appendString] operator[SEP] {
Keyword[return] identifier[string] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] identifier[maxBytesLength] operator[?] identifier[truncate] operator[SEP] identifier[string] , identifier[maxBytesLength] operator[-] identifier[appendString] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[+] identifier[appendString] operator[:] identifier[string] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static Iterator<Object> iterator(Object iterable) {
Assert.state(isIterable(iterable.getClass()));
return iterable.getClass().isArray() ? new ArrayIterator(iterable)
: ((Iterable<Object>) iterable).iterator();
} | class class_name[name] begin[{]
method[iterator, return_type[type[Iterator]], modifier[public static], parameter[iterable]] begin[{]
call[Assert.state, parameter[call[.isIterable, parameter[call[iterable.getClass, parameter[]]]]]]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=iterable, selectors=[MethodInvocation(arguments=[], member=isArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Cast(expression=MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Iterable, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=iterable, 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=ArrayIterator, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[Iterator] operator[<] identifier[Object] operator[>] identifier[iterator] operator[SEP] identifier[Object] identifier[iterable] operator[SEP] {
identifier[Assert] operator[SEP] identifier[state] operator[SEP] identifier[isIterable] operator[SEP] identifier[iterable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[iterable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[ArrayIterator] operator[SEP] identifier[iterable] operator[SEP] operator[:] operator[SEP] operator[SEP] identifier[Iterable] operator[<] identifier[Object] operator[>] operator[SEP] identifier[iterable] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
boolean shouldSuppressField(FieldDefinition fieldDef) {
if (!m_config.optimize) {
return false;
}
Set<String> suppressedFields = m_dbSuppressedFieldMap.get(fieldDef.getTableName());
return suppressedFields != null && suppressedFields.contains(fieldDef.getName());
} | class class_name[name] begin[{]
method[shouldSuppressField, return_type[type[boolean]], modifier[default], parameter[fieldDef]] begin[{]
if[member[m_config.optimize]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Set], suppressedFields]
return[binary_operation[binary_operation[member[.suppressedFields], !=, literal[null]], &&, call[suppressedFields.contains, parameter[call[fieldDef.getName, parameter[]]]]]]
end[}]
END[}] | Keyword[boolean] identifier[shouldSuppressField] operator[SEP] identifier[FieldDefinition] identifier[fieldDef] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[m_config] operator[SEP] identifier[optimize] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[suppressedFields] operator[=] identifier[m_dbSuppressedFieldMap] operator[SEP] identifier[get] operator[SEP] identifier[fieldDef] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[suppressedFields] operator[!=] Other[null] operator[&&] identifier[suppressedFields] operator[SEP] identifier[contains] operator[SEP] identifier[fieldDef] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public HTTPClientConfiguration createHTTPClientConfiguration(ConfigurationHolder configurationHolder)
{
//get server values
String hostName=configurationHolder.getConfigurationValue(HTTPClientConfigurationConstants.HOST_NAME_PROPERTY_KEY);
if(hostName==null)
{
throw new FaxException("Host name not defined in property: "+HTTPClientConfigurationConstants.HOST_NAME_PROPERTY_KEY);
}
String value=configurationHolder.getConfigurationValue(HTTPClientConfigurationConstants.PORT_PROPERTY_KEY);
if(value==null)
{
value=String.valueOf(-1);
}
int port=Integer.parseInt(value);
boolean ssl=Boolean.parseBoolean(configurationHolder.getConfigurationValue(HTTPClientConfigurationConstants.SSL_PROPERTY_KEY));
//create configuration
CommonHTTPClientConfiguration configuration=new CommonHTTPClientConfiguration();
//set values
configuration.setHostName(hostName);
configuration.setPort(port);
configuration.setSSL(ssl);
//set methods
Enum<?>[] methodProperties=new Enum<?>[]{HTTPClientConfigurationConstants.SUBMIT_HTTP_METHOD_PROPERTY_KEY,
HTTPClientConfigurationConstants.SUSPEND_HTTP_METHOD_PROPERTY_KEY,
HTTPClientConfigurationConstants.RESUME_HTTP_METHOD_PROPERTY_KEY,
HTTPClientConfigurationConstants.CANCEL_HTTP_METHOD_PROPERTY_KEY,
HTTPClientConfigurationConstants.GET_STATUS_HTTP_METHOD_PROPERTY_KEY};
FaxActionType[] faxActionTypes=new FaxActionType[]{FaxActionType.SUBMIT_FAX_JOB,
FaxActionType.SUSPEND_FAX_JOB,
FaxActionType.RESUME_FAX_JOB,
FaxActionType.CANCEL_FAX_JOB,
FaxActionType.GET_FAX_JOB_STATUS};
HTTPMethod httpMethod=null;
for(int index=0;index<methodProperties.length;index++)
{
//set next method
value=configurationHolder.getConfigurationValue(methodProperties[index]);
httpMethod=HTTPMethod.POST;
if(value!=null)
{
httpMethod=HTTPMethod.valueOf(value);
}
configuration.setMethod(faxActionTypes[index],httpMethod);
}
return configuration;
} | class class_name[name] begin[{]
method[createHTTPClientConfiguration, return_type[type[HTTPClientConfiguration]], modifier[public], parameter[configurationHolder]] begin[{]
local_variable[type[String], hostName]
if[binary_operation[member[.hostName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Host name not defined in property: "), operandr=MemberReference(member=HOST_NAME_PROPERTY_KEY, postfix_operators=[], prefix_operators=[], qualifier=HTTPClientConfigurationConstants, 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)
else begin[{]
None
end[}]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
assign[member[.value], call[String.valueOf, parameter[literal[1]]]]
else begin[{]
None
end[}]
local_variable[type[int], port]
local_variable[type[boolean], ssl]
local_variable[type[CommonHTTPClientConfiguration], configuration]
call[configuration.setHostName, parameter[member[.hostName]]]
call[configuration.setPort, parameter[member[.port]]]
call[configuration.setSSL, parameter[member[.ssl]]]
local_variable[type[Enum], methodProperties]
local_variable[type[FaxActionType], faxActionTypes]
local_variable[type[HTTPMethod], httpMethod]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=methodProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getConfigurationValue, postfix_operators=[], prefix_operators=[], qualifier=configurationHolder, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=POST, postfix_operators=[], prefix_operators=[], qualifier=HTTPMethod, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=HTTPMethod, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=faxActionTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setMethod, postfix_operators=[], prefix_operators=[], qualifier=configuration, 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=methodProperties, 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=[MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.configuration]]
end[}]
END[}] | Keyword[public] identifier[HTTPClientConfiguration] identifier[createHTTPClientConfiguration] operator[SEP] identifier[ConfigurationHolder] identifier[configurationHolder] operator[SEP] {
identifier[String] identifier[hostName] operator[=] identifier[configurationHolder] operator[SEP] identifier[getConfigurationValue] operator[SEP] identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[HOST_NAME_PROPERTY_KEY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hostName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FaxException] operator[SEP] literal[String] operator[+] identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[HOST_NAME_PROPERTY_KEY] operator[SEP] operator[SEP]
}
identifier[String] identifier[value] operator[=] identifier[configurationHolder] operator[SEP] identifier[getConfigurationValue] operator[SEP] identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[PORT_PROPERTY_KEY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[int] identifier[port] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[boolean] identifier[ssl] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[configurationHolder] operator[SEP] identifier[getConfigurationValue] operator[SEP] identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[SSL_PROPERTY_KEY] operator[SEP] operator[SEP] operator[SEP] identifier[CommonHTTPClientConfiguration] identifier[configuration] operator[=] Keyword[new] identifier[CommonHTTPClientConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[configuration] operator[SEP] identifier[setHostName] operator[SEP] identifier[hostName] operator[SEP] operator[SEP] identifier[configuration] operator[SEP] identifier[setPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[configuration] operator[SEP] identifier[setSSL] operator[SEP] identifier[ssl] operator[SEP] operator[SEP] identifier[Enum] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[methodProperties] operator[=] Keyword[new] identifier[Enum] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] {
identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[SUBMIT_HTTP_METHOD_PROPERTY_KEY] , identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[SUSPEND_HTTP_METHOD_PROPERTY_KEY] , identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[RESUME_HTTP_METHOD_PROPERTY_KEY] , identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[CANCEL_HTTP_METHOD_PROPERTY_KEY] , identifier[HTTPClientConfigurationConstants] operator[SEP] identifier[GET_STATUS_HTTP_METHOD_PROPERTY_KEY]
} operator[SEP] identifier[FaxActionType] operator[SEP] operator[SEP] identifier[faxActionTypes] operator[=] Keyword[new] identifier[FaxActionType] operator[SEP] operator[SEP] {
identifier[FaxActionType] operator[SEP] identifier[SUBMIT_FAX_JOB] , identifier[FaxActionType] operator[SEP] identifier[SUSPEND_FAX_JOB] , identifier[FaxActionType] operator[SEP] identifier[RESUME_FAX_JOB] , identifier[FaxActionType] operator[SEP] identifier[CANCEL_FAX_JOB] , identifier[FaxActionType] operator[SEP] identifier[GET_FAX_JOB_STATUS]
} operator[SEP] identifier[HTTPMethod] identifier[httpMethod] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] identifier[index] operator[<] identifier[methodProperties] operator[SEP] identifier[length] operator[SEP] identifier[index] operator[++] operator[SEP] {
identifier[value] operator[=] identifier[configurationHolder] operator[SEP] identifier[getConfigurationValue] operator[SEP] identifier[methodProperties] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] identifier[httpMethod] operator[=] identifier[HTTPMethod] operator[SEP] identifier[POST] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[httpMethod] operator[=] identifier[HTTPMethod] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
identifier[configuration] operator[SEP] identifier[setMethod] operator[SEP] identifier[faxActionTypes] operator[SEP] identifier[index] operator[SEP] , identifier[httpMethod] operator[SEP] operator[SEP]
}
Keyword[return] identifier[configuration] operator[SEP]
}
|
public static Location fromBio( int start, int end, char strand )
{
int s= start - 1;
int e= end;
if( !( strand == '-' || strand == '+' || strand == '.' ))
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
if( strand == '-' )
{
//negate
s= - end;
e= - ( start - 1);
}
return new Location( s, e );
} | class class_name[name] begin[{]
method[fromBio, return_type[type[Location]], modifier[public static], parameter[start, end, strand]] begin[{]
local_variable[type[int], s]
local_variable[type[int], e]
if[binary_operation[binary_operation[binary_operation[member[.strand], ==, literal['-']], ||, binary_operation[member[.strand], ==, literal['+']]], ||, binary_operation[member[.strand], ==, literal['.']]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Strand must be '+', '-', or '.'")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.strand], ==, literal['-']]] begin[{]
assign[member[.s], member[.end]]
assign[member[.e], binary_operation[member[.start], -, literal[1]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=s, 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=Location, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Location] identifier[fromBio] operator[SEP] Keyword[int] identifier[start] , Keyword[int] identifier[end] , Keyword[char] identifier[strand] operator[SEP] {
Keyword[int] identifier[s] operator[=] identifier[start] operator[-] Other[1] operator[SEP] Keyword[int] identifier[e] operator[=] identifier[end] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[strand] operator[==] literal[String] operator[||] identifier[strand] operator[==] literal[String] operator[||] identifier[strand] operator[==] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[strand] operator[==] literal[String] operator[SEP] {
identifier[s] operator[=] operator[-] identifier[end] operator[SEP] identifier[e] operator[=] operator[-] operator[SEP] identifier[start] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Location] operator[SEP] identifier[s] , identifier[e] operator[SEP] operator[SEP]
}
|
public ProxyBuilder<T> dexCache(File dexCacheParent) {
dexCache = new File(dexCacheParent, "v" + Integer.toString(VERSION));
dexCache.mkdir();
return this;
} | class class_name[name] begin[{]
method[dexCache, return_type[type[ProxyBuilder]], modifier[public], parameter[dexCacheParent]] begin[{]
assign[member[.dexCache], ClassCreator(arguments=[MemberReference(member=dexCacheParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="v"), operandr=MethodInvocation(arguments=[MemberReference(member=VERSION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]
call[dexCache.mkdir, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ProxyBuilder] operator[<] identifier[T] operator[>] identifier[dexCache] operator[SEP] identifier[File] identifier[dexCacheParent] operator[SEP] {
identifier[dexCache] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[dexCacheParent] , literal[String] operator[+] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[VERSION] operator[SEP] operator[SEP] operator[SEP] identifier[dexCache] operator[SEP] identifier[mkdir] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
Map<String, Object> serialize() {
final Map<String, Object> map = super.serialize();
if (datePattern != null) {
map.put(JsonSchema.KEY_DATE_PATTERN, datePattern);
}
return map;
} | class class_name[name] begin[{]
method[serialize, return_type[type[Map]], modifier[default], parameter[]] begin[{]
local_variable[type[Map], map]
if[binary_operation[member[.datePattern], !=, literal[null]]] begin[{]
call[map.put, parameter[member[JsonSchema.KEY_DATE_PATTERN], member[.datePattern]]]
else begin[{]
None
end[}]
return[member[.map]]
end[}]
END[}] | annotation[@] identifier[Override] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[serialize] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[map] operator[=] Keyword[super] operator[SEP] identifier[serialize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[datePattern] operator[!=] Other[null] operator[SEP] {
identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[JsonSchema] operator[SEP] identifier[KEY_DATE_PATTERN] , identifier[datePattern] operator[SEP] operator[SEP]
}
Keyword[return] identifier[map] operator[SEP]
}
|
public boolean getFeature(String name) throws SAXNotRecognizedException,
SAXNotSupportedException {
if ("http://xml.org/sax/features/namespaces".equals(name)) {
return namespaces;
} else if ("http://xml.org/sax/features/namespace-prefixes"
.equals(name)) {
return namespacePrefixes;
} else {
return false;
}
} | class class_name[name] begin[{]
method[getFeature, return_type[type[boolean]], modifier[public], parameter[name]] begin[{]
if[literal["http://xml.org/sax/features/namespaces"]] begin[{]
return[member[.namespaces]]
else begin[{]
if[literal["http://xml.org/sax/features/namespace-prefixes"]] begin[{]
return[member[.namespacePrefixes]]
else begin[{]
return[literal[false]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[getFeature] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[SAXNotRecognizedException] , identifier[SAXNotSupportedException] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[namespaces] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[namespacePrefixes] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
private void alterColumn(AlterTableOptions alterTableOptions, Schema schema, ColumnInfo columnInfo,
AtomicBoolean updated)
{
if (!KuduDBDataHandler.hasColumn(schema, columnInfo.getColumnName()))
{
// add if column is not in schema
alterTableOptions.addNullableColumn(columnInfo.getColumnName(),
KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType()));
updated.set(true);
}
else
{
// check for type, drop and add if not consistent TODO: throw
// exception or override?
if (!schema.getColumn(columnInfo.getColumnName()).getType()
.equals(KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType())))
{
alterTableOptions.dropColumn(columnInfo.getColumnName());
alterTableOptions.addNullableColumn(columnInfo.getColumnName(),
KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType()));
updated.set(true);
}
}
} | class class_name[name] begin[{]
method[alterColumn, return_type[void], modifier[private], parameter[alterTableOptions, schema, columnInfo, updated]] begin[{]
if[call[KuduDBDataHandler.hasColumn, parameter[member[.schema], call[columnInfo.getColumnName, parameter[]]]]] begin[{]
call[alterTableOptions.addNullableColumn, parameter[call[columnInfo.getColumnName, parameter[]], call[KuduDBValidationClassMapper.getValidTypeForClass, parameter[call[columnInfo.getType, parameter[]]]]]]
call[updated.set, parameter[literal[true]]]
else begin[{]
if[call[schema.getColumn, parameter[call[columnInfo.getColumnName, parameter[]]]]] begin[{]
call[alterTableOptions.dropColumn, parameter[call[columnInfo.getColumnName, parameter[]]]]
call[alterTableOptions.addNullableColumn, parameter[call[columnInfo.getColumnName, parameter[]], call[KuduDBValidationClassMapper.getValidTypeForClass, parameter[call[columnInfo.getType, parameter[]]]]]]
call[updated.set, parameter[literal[true]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[alterColumn] operator[SEP] identifier[AlterTableOptions] identifier[alterTableOptions] , identifier[Schema] identifier[schema] , identifier[ColumnInfo] identifier[columnInfo] , identifier[AtomicBoolean] identifier[updated] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[KuduDBDataHandler] operator[SEP] identifier[hasColumn] operator[SEP] identifier[schema] , identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[alterTableOptions] operator[SEP] identifier[addNullableColumn] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , identifier[KuduDBValidationClassMapper] operator[SEP] identifier[getValidTypeForClass] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[updated] operator[SEP] identifier[set] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[schema] operator[SEP] identifier[getColumn] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[KuduDBValidationClassMapper] operator[SEP] identifier[getValidTypeForClass] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[alterTableOptions] operator[SEP] identifier[dropColumn] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[alterTableOptions] operator[SEP] identifier[addNullableColumn] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , identifier[KuduDBValidationClassMapper] operator[SEP] identifier[getValidTypeForClass] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[updated] operator[SEP] identifier[set] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
|
@SuppressWarnings("unchecked")
public static List<String> readStringListFromConfAsJson(String key, Configuration conf) {
String json = conf.get(key);
if (json == null) {
return null;
}
return Lists.<String>newArrayList(((JSONArray) JSONValue.parse(json)));
} | class class_name[name] begin[{]
method[readStringListFromConfAsJson, return_type[type[List]], modifier[public static], parameter[key, conf]] begin[{]
local_variable[type[String], json]
if[binary_operation[member[.json], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.Lists, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=JSONValue, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[readStringListFromConfAsJson] operator[SEP] identifier[String] identifier[key] , identifier[Configuration] identifier[conf] operator[SEP] {
identifier[String] identifier[json] operator[=] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[json] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[Lists] operator[SEP] operator[<] identifier[String] operator[>] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[JSONArray] operator[SEP] identifier[JSONValue] operator[SEP] identifier[parse] operator[SEP] identifier[json] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void copyResourceFile(String source, Path target) throws IOException {
InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
FileUtils.copyInputStreamToFile(resource, target.toFile());
} | class class_name[name] begin[{]
method[copyResourceFile, return_type[void], modifier[public static], parameter[source, target]] begin[{]
local_variable[type[InputStream], resource]
call[FileUtils.copyInputStreamToFile, parameter[member[.resource], call[target.toFile, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[copyResourceFile] operator[SEP] identifier[String] identifier[source] , identifier[Path] identifier[target] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStream] identifier[resource] operator[=] identifier[FsCrawlerUtil] operator[SEP] Keyword[class] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[source] operator[SEP] operator[SEP] identifier[FileUtils] operator[SEP] identifier[copyInputStreamToFile] operator[SEP] identifier[resource] , identifier[target] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private String getClassName(final TypeMirror t) {
String res = null;
if (t instanceof DeclaredType) {
final DeclaredType dt = (DeclaredType) t;
res = ((TypeElement) dt.asElement()).getQualifiedName().toString();
if (!dt.getTypeArguments().isEmpty()) {
res += "<";
boolean first = true;
for (final TypeMirror tm : dt.getTypeArguments()) {
if (first) {
first = false;
} else {
res += ",";
}
res += getClassName(tm);
}
res += ">";
}
} else if (t instanceof PrimitiveType) {
res = ((PrimitiveType) t).toString();
}
return res;
} | class class_name[name] begin[{]
method[getClassName, return_type[type[String]], modifier[private], parameter[t]] begin[{]
local_variable[type[String], res]
if[binary_operation[member[.t], instanceof, type[DeclaredType]]] begin[{]
local_variable[type[DeclaredType], dt]
assign[member[.res], Cast(expression=MethodInvocation(arguments=[], member=asElement, postfix_operators=[], prefix_operators=[], qualifier=dt, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=TypeElement, sub_type=None))]
if[call[dt.getTypeArguments, parameter[]]] begin[{]
assign[member[.res], literal["<"]]
local_variable[type[boolean], first]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=tm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getTypeArguments, postfix_operators=[], prefix_operators=[], qualifier=dt, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tm)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TypeMirror, sub_type=None))), label=None)
assign[member[.res], literal[">"]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.t], instanceof, type[PrimitiveType]]] begin[{]
assign[member[.res], Cast(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PrimitiveType, sub_type=None))]
else begin[{]
None
end[}]
end[}]
return[member[.res]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getClassName] operator[SEP] Keyword[final] identifier[TypeMirror] identifier[t] operator[SEP] {
identifier[String] identifier[res] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[DeclaredType] operator[SEP] {
Keyword[final] identifier[DeclaredType] identifier[dt] operator[=] operator[SEP] identifier[DeclaredType] operator[SEP] identifier[t] operator[SEP] identifier[res] operator[=] operator[SEP] operator[SEP] identifier[TypeElement] operator[SEP] identifier[dt] operator[SEP] identifier[asElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getQualifiedName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dt] operator[SEP] identifier[getTypeArguments] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[res] operator[+=] literal[String] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TypeMirror] identifier[tm] operator[:] identifier[dt] operator[SEP] identifier[getTypeArguments] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] {
identifier[first] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[res] operator[+=] literal[String] operator[SEP]
}
identifier[res] operator[+=] identifier[getClassName] operator[SEP] identifier[tm] operator[SEP] operator[SEP]
}
identifier[res] operator[+=] literal[String] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[PrimitiveType] operator[SEP] {
identifier[res] operator[=] operator[SEP] operator[SEP] identifier[PrimitiveType] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[res] operator[SEP]
}
|
public T[] generateRandomCandidate(Random rng)
{
T[] candidate = elements.clone();
List<T> list = Arrays.asList(candidate);
Collections.shuffle(list, rng);
return list.toArray(candidate);
} | class class_name[name] begin[{]
method[generateRandomCandidate, return_type[type[T]], modifier[public], parameter[rng]] begin[{]
local_variable[type[T], candidate]
local_variable[type[List], list]
call[Collections.shuffle, parameter[member[.list], member[.rng]]]
return[call[list.toArray, parameter[member[.candidate]]]]
end[}]
END[}] | Keyword[public] identifier[T] operator[SEP] operator[SEP] identifier[generateRandomCandidate] operator[SEP] identifier[Random] identifier[rng] operator[SEP] {
identifier[T] operator[SEP] operator[SEP] identifier[candidate] operator[=] identifier[elements] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[candidate] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[shuffle] operator[SEP] identifier[list] , identifier[rng] operator[SEP] operator[SEP] Keyword[return] identifier[list] operator[SEP] identifier[toArray] operator[SEP] identifier[candidate] operator[SEP] operator[SEP]
}
|
public static SpreadMap toSpreadMap(Object[] self) {
if (self == null)
throw new GroovyRuntimeException("Fail to convert Object[] to SpreadMap, because it is null.");
else if (self.length % 2 != 0)
throw new GroovyRuntimeException("Fail to convert Object[] to SpreadMap, because it's size is not even.");
else
return new SpreadMap(self);
} | class class_name[name] begin[{]
method[toSpreadMap, return_type[type[SpreadMap]], modifier[public static], parameter[self]] begin[{]
if[binary_operation[member[.self], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to convert Object[] to SpreadMap, because it is null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GroovyRuntimeException, sub_type=None)), label=None)
else begin[{]
if[binary_operation[binary_operation[member[self.length], %, literal[2]], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to convert Object[] to SpreadMap, because it's size is not even.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GroovyRuntimeException, sub_type=None)), label=None)
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=self, 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=SpreadMap, sub_type=None))]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SpreadMap] identifier[toSpreadMap] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[self] operator[SEP] {
Keyword[if] operator[SEP] identifier[self] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[GroovyRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[self] operator[SEP] identifier[length] operator[%] Other[2] operator[!=] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[GroovyRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] Keyword[return] Keyword[new] identifier[SpreadMap] operator[SEP] identifier[self] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.