code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static Loader csv(Reader reader, List<String> columns, List<String> dimensions, String timestampDimension) {
return new CSVLoader(reader, columns, dimensions, timestampDimension);
} | class class_name[name] begin[{]
method[csv, return_type[type[Loader]], modifier[public static], parameter[reader, columns, dimensions, timestampDimension]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dimensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timestampDimension, 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=CSVLoader, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Loader] identifier[csv] operator[SEP] identifier[Reader] identifier[reader] , identifier[List] operator[<] identifier[String] operator[>] identifier[columns] , identifier[List] operator[<] identifier[String] operator[>] identifier[dimensions] , identifier[String] identifier[timestampDimension] operator[SEP] {
Keyword[return] Keyword[new] identifier[CSVLoader] operator[SEP] identifier[reader] , identifier[columns] , identifier[dimensions] , identifier[timestampDimension] operator[SEP] operator[SEP]
}
|
public void startServer() throws InterruptedException {
RouteMatcher router = new RouteMatcher();
router.get("/v1.0", new DefaultHandler());
router.post("/v1.0/multitenant/experimental/metrics",
new HttpMultitenantMetricsIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v1.0/:tenantId/experimental/metrics",
new HttpMetricsIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v1.0/:tenantId/experimental/metrics/statsd",
new HttpAggregatedIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.get("/v2.0", new DefaultHandler());
router.post("/v2.0/:tenantId/ingest/multi",
new HttpMultitenantMetricsIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v2.0/:tenantId/ingest",
new HttpMetricsIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v2.0/:tenantId/ingest/aggregated",
new HttpAggregatedIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v2.0/:tenantId/ingest/aggregated/multi",
new HttpAggregatedMultiIngestionHandler(processor, timeout, ENABLE_PER_TENANT_METRICS));
router.post("/v2.0/:tenantId/events", getHttpEventsIngestionHandler());
final RouteMatcher finalRouter = router;
log.info("Starting metrics listener HTTP server on port {}", httpIngestPort);
ServerBootstrap server = new ServerBootstrap();
server.group(acceptorGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel channel) throws Exception {
setupPipeline(channel, finalRouter);
}
});
Channel channel = server.bind(new InetSocketAddress(httpIngestHost, httpIngestPort)).sync().channel();
allOpenChannels.add(channel);
//register the tracker MBean for JMX/jolokia
log.info("Registering tracker service");
Tracker.getInstance().register();
log.info("Token search improvements enabled: " + EXP_TOKEN_SEARCH_IMPROVEMENTS);
} | class class_name[name] begin[{]
method[startServer, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[RouteMatcher], router]
call[router.get, parameter[literal["/v1.0"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultHandler, sub_type=None))]]
call[router.post, parameter[literal["/v1.0/multitenant/experimental/metrics"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpMultitenantMetricsIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v1.0/:tenantId/experimental/metrics"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpMetricsIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v1.0/:tenantId/experimental/metrics/statsd"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpAggregatedIngestionHandler, sub_type=None))]]
call[router.get, parameter[literal["/v2.0"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultHandler, sub_type=None))]]
call[router.post, parameter[literal["/v2.0/:tenantId/ingest/multi"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpMultitenantMetricsIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v2.0/:tenantId/ingest"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpMetricsIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v2.0/:tenantId/ingest/aggregated"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpAggregatedIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v2.0/:tenantId/ingest/aggregated/multi"], ClassCreator(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENABLE_PER_TENANT_METRICS, 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=HttpAggregatedMultiIngestionHandler, sub_type=None))]]
call[router.post, parameter[literal["/v2.0/:tenantId/events"], call[.getHttpEventsIngestionHandler, parameter[]]]]
local_variable[type[RouteMatcher], finalRouter]
call[log.info, parameter[literal["Starting metrics listener HTTP server on port {}"], member[.httpIngestPort]]]
local_variable[type[ServerBootstrap], server]
call[server.group, parameter[member[.acceptorGroup], member[.workerGroup]]]
local_variable[type[Channel], channel]
call[allOpenChannels.add, parameter[member[.channel]]]
call[log.info, parameter[literal["Registering tracker service"]]]
call[Tracker.getInstance, parameter[]]
call[log.info, parameter[binary_operation[literal["Token search improvements enabled: "], +, member[.EXP_TOKEN_SEARCH_IMPROVEMENTS]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[startServer] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] {
identifier[RouteMatcher] identifier[router] operator[=] Keyword[new] identifier[RouteMatcher] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[get] operator[SEP] literal[String] , Keyword[new] identifier[DefaultHandler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpMultitenantMetricsIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpMetricsIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpAggregatedIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[get] operator[SEP] literal[String] , Keyword[new] identifier[DefaultHandler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpMultitenantMetricsIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpMetricsIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpAggregatedIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , Keyword[new] identifier[HttpAggregatedMultiIngestionHandler] operator[SEP] identifier[processor] , identifier[timeout] , identifier[ENABLE_PER_TENANT_METRICS] operator[SEP] operator[SEP] operator[SEP] identifier[router] operator[SEP] identifier[post] operator[SEP] literal[String] , identifier[getHttpEventsIngestionHandler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[RouteMatcher] identifier[finalRouter] operator[=] identifier[router] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[httpIngestPort] operator[SEP] operator[SEP] identifier[ServerBootstrap] identifier[server] operator[=] Keyword[new] identifier[ServerBootstrap] operator[SEP] operator[SEP] operator[SEP] identifier[server] operator[SEP] identifier[group] operator[SEP] identifier[acceptorGroup] , identifier[workerGroup] operator[SEP] operator[SEP] identifier[channel] operator[SEP] identifier[NioServerSocketChannel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[childHandler] operator[SEP] Keyword[new] identifier[ChannelInitializer] operator[<] identifier[SocketChannel] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[initChannel] operator[SEP] identifier[SocketChannel] identifier[channel] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[setupPipeline] operator[SEP] identifier[channel] , identifier[finalRouter] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[Channel] identifier[channel] operator[=] identifier[server] operator[SEP] identifier[bind] operator[SEP] Keyword[new] identifier[InetSocketAddress] operator[SEP] identifier[httpIngestHost] , identifier[httpIngestPort] operator[SEP] operator[SEP] operator[SEP] identifier[sync] operator[SEP] operator[SEP] operator[SEP] identifier[channel] operator[SEP] operator[SEP] operator[SEP] identifier[allOpenChannels] operator[SEP] identifier[add] operator[SEP] identifier[channel] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Tracker] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[register] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[EXP_TOKEN_SEARCH_IMPROVEMENTS] operator[SEP] operator[SEP]
}
|
public int readTag() throws IOException {
if (isAtEnd()) {
lastTag = 0;
return 0;
}
final int tag = readRawVarint32();
if (tag >>> WireFormat.TAG_TYPE_BITS == 0) {
// If we actually read zero, that's not a valid tag.
throw ProtobufException.invalidTag();
}
lastTag = tag;
return tag;
} | class class_name[name] begin[{]
method[readTag, return_type[type[int]], modifier[public], parameter[]] begin[{]
if[call[.isAtEnd, parameter[]]] begin[{]
assign[member[.lastTag], literal[0]]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[int], tag]
if[binary_operation[binary_operation[member[.tag], >>>, member[WireFormat.TAG_TYPE_BITS]], ==, literal[0]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=invalidTag, postfix_operators=[], prefix_operators=[], qualifier=ProtobufException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
assign[member[.lastTag], member[.tag]]
return[member[.tag]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[readTag] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[isAtEnd] operator[SEP] operator[SEP] operator[SEP] {
identifier[lastTag] operator[=] Other[0] operator[SEP] Keyword[return] Other[0] operator[SEP]
}
Keyword[final] Keyword[int] identifier[tag] operator[=] identifier[readRawVarint32] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[>] operator[>] operator[>] identifier[WireFormat] operator[SEP] identifier[TAG_TYPE_BITS] operator[==] Other[0] operator[SEP] {
Keyword[throw] identifier[ProtobufException] operator[SEP] identifier[invalidTag] operator[SEP] operator[SEP] operator[SEP]
}
identifier[lastTag] operator[=] identifier[tag] operator[SEP] Keyword[return] identifier[tag] operator[SEP]
}
|
boolean canRemoveItem( Name primaryTypeNameOfParent,
List<Name> mixinTypeNamesOfParent,
Name itemName,
boolean skipProtected ) {
// First look in the primary type for a matching property definition...
JcrNodeType primaryType = getNodeType(primaryTypeNameOfParent);
if (primaryType != null) {
for (JcrPropertyDefinition definition : primaryType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
// Then, look in the primary type for a matching child node definition...
if (primaryType != null) {
for (JcrNodeDefinition definition : primaryType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
// Then, look in the mixin types for a matching property definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrPropertyDefinition definition : mixinType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
}
// Then, look in the mixin types for a matching child node definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrNodeDefinition definition : mixinType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
}
// Nothing was found, so look for residual item definitions ...
if (!itemName.equals(JcrNodeType.RESIDUAL_NAME)) return canRemoveItem(primaryTypeNameOfParent, mixinTypeNamesOfParent,
JcrNodeType.RESIDUAL_NAME, skipProtected);
return false;
} | class class_name[name] begin[{]
method[canRemoveItem, return_type[type[boolean]], modifier[default], parameter[primaryTypeNameOfParent, mixinTypeNamesOfParent, itemName, skipProtected]] begin[{]
local_variable[type[JcrNodeType], primaryType]
if[binary_operation[member[.primaryType], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skipProtected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isProtected, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=isMandatory, postfix_operators=[], prefix_operators=['!'], qualifier=definition, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=itemName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allPropertyDefinitions, postfix_operators=[], prefix_operators=[], qualifier=primaryType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=definition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrPropertyDefinition, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.primaryType], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skipProtected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isProtected, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=isMandatory, postfix_operators=[], prefix_operators=['!'], qualifier=definition, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=itemName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allChildNodeDefinitions, postfix_operators=[], prefix_operators=[], qualifier=primaryType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=definition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrNodeDefinition, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.mixinTypeNamesOfParent], !=, literal[null]], &&, call[mixinTypeNamesOfParent.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mixinTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNodeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=mixinType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrNodeType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mixinType, 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=ContinueStatement(goto=None, label=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skipProtected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isProtected, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=isMandatory, postfix_operators=[], prefix_operators=['!'], qualifier=definition, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=itemName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allPropertyDefinitions, postfix_operators=[], prefix_operators=[], qualifier=mixinType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=definition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrPropertyDefinition, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mixinTypeNamesOfParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mixinTypeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Name, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.mixinTypeNamesOfParent], !=, literal[null]], &&, call[mixinTypeNamesOfParent.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mixinTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNodeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=mixinType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrNodeType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mixinType, 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=ContinueStatement(goto=None, label=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skipProtected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isProtected, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=isMandatory, postfix_operators=[], prefix_operators=['!'], qualifier=definition, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=itemName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allChildNodeDefinitions, postfix_operators=[], prefix_operators=[], qualifier=mixinType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=definition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JcrNodeDefinition, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mixinTypeNamesOfParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mixinTypeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Name, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[call[itemName.equals, parameter[member[JcrNodeType.RESIDUAL_NAME]]]] begin[{]
return[call[.canRemoveItem, parameter[member[.primaryTypeNameOfParent], member[.mixinTypeNamesOfParent], member[JcrNodeType.RESIDUAL_NAME], member[.skipProtected]]]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[boolean] identifier[canRemoveItem] operator[SEP] identifier[Name] identifier[primaryTypeNameOfParent] , identifier[List] operator[<] identifier[Name] operator[>] identifier[mixinTypeNamesOfParent] , identifier[Name] identifier[itemName] , Keyword[boolean] identifier[skipProtected] operator[SEP] {
identifier[JcrNodeType] identifier[primaryType] operator[=] identifier[getNodeType] operator[SEP] identifier[primaryTypeNameOfParent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[primaryType] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[JcrPropertyDefinition] identifier[definition] operator[:] identifier[primaryType] operator[SEP] identifier[allPropertyDefinitions] operator[SEP] identifier[itemName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[skipProtected] operator[&&] identifier[definition] operator[SEP] identifier[isProtected] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[return] operator[!] identifier[definition] operator[SEP] identifier[isMandatory] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[primaryType] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[JcrNodeDefinition] identifier[definition] operator[:] identifier[primaryType] operator[SEP] identifier[allChildNodeDefinitions] operator[SEP] identifier[itemName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[skipProtected] operator[&&] identifier[definition] operator[SEP] identifier[isProtected] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[return] operator[!] identifier[definition] operator[SEP] identifier[isMandatory] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[mixinTypeNamesOfParent] operator[!=] Other[null] operator[&&] operator[!] identifier[mixinTypeNamesOfParent] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Name] identifier[mixinTypeName] operator[:] identifier[mixinTypeNamesOfParent] operator[SEP] {
identifier[JcrNodeType] identifier[mixinType] operator[=] identifier[getNodeType] operator[SEP] identifier[mixinTypeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mixinType] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] Keyword[for] operator[SEP] identifier[JcrPropertyDefinition] identifier[definition] operator[:] identifier[mixinType] operator[SEP] identifier[allPropertyDefinitions] operator[SEP] identifier[itemName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[skipProtected] operator[&&] identifier[definition] operator[SEP] identifier[isProtected] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[return] operator[!] identifier[definition] operator[SEP] identifier[isMandatory] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[mixinTypeNamesOfParent] operator[!=] Other[null] operator[&&] operator[!] identifier[mixinTypeNamesOfParent] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Name] identifier[mixinTypeName] operator[:] identifier[mixinTypeNamesOfParent] operator[SEP] {
identifier[JcrNodeType] identifier[mixinType] operator[=] identifier[getNodeType] operator[SEP] identifier[mixinTypeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mixinType] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] Keyword[for] operator[SEP] identifier[JcrNodeDefinition] identifier[definition] operator[:] identifier[mixinType] operator[SEP] identifier[allChildNodeDefinitions] operator[SEP] identifier[itemName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[skipProtected] operator[&&] identifier[definition] operator[SEP] identifier[isProtected] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[return] operator[!] identifier[definition] operator[SEP] identifier[isMandatory] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[itemName] operator[SEP] identifier[equals] operator[SEP] identifier[JcrNodeType] operator[SEP] identifier[RESIDUAL_NAME] operator[SEP] operator[SEP] Keyword[return] identifier[canRemoveItem] operator[SEP] identifier[primaryTypeNameOfParent] , identifier[mixinTypeNamesOfParent] , identifier[JcrNodeType] operator[SEP] identifier[RESIDUAL_NAME] , identifier[skipProtected] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public int filterObject(CaptureSearchResult r) {
String httpCode = r.getHttpCode();
// only filter real 3XX http response codes:
if(httpCode.startsWith("3")) {
String redirect = r.getRedirectUrl();
if(redirect.compareTo("-") != 0) {
String urlKey = r.getUrlKey();
try {
String redirectKey = canonicalizer.urlStringToKey(redirect);
if((redirectKey != null) && (urlKey != null) &&
(redirectKey.compareTo(urlKey) == 0)) {
// only omit if same scheme:
String origScheme =
UrlOperations.urlToScheme(r.getOriginalUrl());
String redirScheme =
UrlOperations.urlToScheme(redirect);
if((origScheme != null) && (redirScheme != null) &&
(origScheme.compareTo(redirScheme) == 0)) {
return FILTER_EXCLUDE;
}
}
} catch (URIException e) {
// emit message (is that right?) and continue
LOGGER.info("Bad redirectURL:" + redirect +
" urlKey:"+ urlKey +
" date:"+ r.getCaptureTimestamp());
}
}
}
return FILTER_INCLUDE;
} | class class_name[name] begin[{]
method[filterObject, return_type[type[int]], modifier[public], parameter[r]] begin[{]
local_variable[type[String], httpCode]
if[call[httpCode.startsWith, parameter[literal["3"]]]] begin[{]
local_variable[type[String], redirect]
if[binary_operation[call[redirect.compareTo, parameter[literal["-"]]], !=, literal[0]]] begin[{]
local_variable[type[String], urlKey]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=redirect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=urlStringToKey, postfix_operators=[], prefix_operators=[], qualifier=canonicalizer, selectors=[], type_arguments=None), name=redirectKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=redirectKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=urlKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=urlKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=redirectKey, selectors=[], 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=[MethodInvocation(arguments=[], member=getOriginalUrl, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], member=urlToScheme, postfix_operators=[], prefix_operators=[], qualifier=UrlOperations, selectors=[], type_arguments=None), name=origScheme)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=redirect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=urlToScheme, postfix_operators=[], prefix_operators=[], qualifier=UrlOperations, selectors=[], type_arguments=None), name=redirScheme)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=origScheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=redirScheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=redirScheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=origScheme, selectors=[], 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=[ReturnStatement(expression=MemberReference(member=FILTER_EXCLUDE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad redirectURL:"), operandr=MemberReference(member=redirect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" urlKey:"), operator=+), operandr=MemberReference(member=urlKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" date:"), operator=+), operandr=MethodInvocation(arguments=[], member=getCaptureTimestamp, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URIException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.FILTER_INCLUDE]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[filterObject] operator[SEP] identifier[CaptureSearchResult] identifier[r] operator[SEP] {
identifier[String] identifier[httpCode] operator[=] identifier[r] operator[SEP] identifier[getHttpCode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpCode] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[redirect] operator[=] identifier[r] operator[SEP] identifier[getRedirectUrl] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[redirect] operator[SEP] identifier[compareTo] operator[SEP] literal[String] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[String] identifier[urlKey] operator[=] identifier[r] operator[SEP] identifier[getUrlKey] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[String] identifier[redirectKey] operator[=] identifier[canonicalizer] operator[SEP] identifier[urlStringToKey] operator[SEP] identifier[redirect] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[redirectKey] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[urlKey] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[redirectKey] operator[SEP] identifier[compareTo] operator[SEP] identifier[urlKey] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] {
identifier[String] identifier[origScheme] operator[=] identifier[UrlOperations] operator[SEP] identifier[urlToScheme] operator[SEP] identifier[r] operator[SEP] identifier[getOriginalUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[redirScheme] operator[=] identifier[UrlOperations] operator[SEP] identifier[urlToScheme] operator[SEP] identifier[redirect] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[origScheme] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[redirScheme] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[origScheme] operator[SEP] identifier[compareTo] operator[SEP] identifier[redirScheme] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] {
Keyword[return] identifier[FILTER_EXCLUDE] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[URIException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[redirect] operator[+] literal[String] operator[+] identifier[urlKey] operator[+] literal[String] operator[+] identifier[r] operator[SEP] identifier[getCaptureTimestamp] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[FILTER_INCLUDE] operator[SEP]
}
|
public static JobStatusCalculator errorOnLastNumJobsFailed(final String key,
final int numJobs,
final JobRepository jobRepository,
final JobMetaRepository jobMetaRepository,
final String managementContextPath
) {
return new JobStatusCalculator(
key, numJobs, numJobs - 1, jobRepository, jobMetaRepository, managementContextPath
);
} | class class_name[name] begin[{]
method[errorOnLastNumJobsFailed, return_type[type[JobStatusCalculator]], modifier[public static], parameter[key, numJobs, jobRepository, jobMetaRepository, managementContextPath]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=numJobs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=numJobs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=jobRepository, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jobMetaRepository, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=managementContextPath, 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=JobStatusCalculator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JobStatusCalculator] identifier[errorOnLastNumJobsFailed] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] Keyword[int] identifier[numJobs] , Keyword[final] identifier[JobRepository] identifier[jobRepository] , Keyword[final] identifier[JobMetaRepository] identifier[jobMetaRepository] , Keyword[final] identifier[String] identifier[managementContextPath] operator[SEP] {
Keyword[return] Keyword[new] identifier[JobStatusCalculator] operator[SEP] identifier[key] , identifier[numJobs] , identifier[numJobs] operator[-] Other[1] , identifier[jobRepository] , identifier[jobMetaRepository] , identifier[managementContextPath] operator[SEP] operator[SEP]
}
|
@Override
public void print(
ChronoDisplay context,
Appendable buffer,
AttributeQuery attributes
) throws IOException, ChronoException {
NumberSystem numsys = getNumberSystem(attributes);
TextWidth width = attributes.get(Attributes.TEXT_WIDTH, TextWidth.NARROW);
int minDigits;
switch (width) {
case NARROW:
minDigits = 1;
break;
case SHORT:
minDigits = 2;
break;
case ABBREVIATED:
minDigits = 3;
break;
default:
minDigits = 4;
}
char zeroChar = (
attributes.contains(Attributes.ZERO_DIGIT)
? attributes.get(Attributes.ZERO_DIGIT).charValue()
: (numsys.isDecimal() ? numsys.getDigits().charAt(0) : '0'));
this.print(context, buffer, attributes, numsys, zeroChar, minDigits, 10);
} | class class_name[name] begin[{]
method[print, return_type[void], modifier[public], parameter[context, buffer, attributes]] begin[{]
local_variable[type[NumberSystem], numsys]
local_variable[type[TextWidth], width]
local_variable[type[int], minDigits]
SwitchStatement(cases=[SwitchStatementCase(case=['NARROW'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDigits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SHORT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDigits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['ABBREVIATED'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDigits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDigits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)), label=None)])], expression=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
local_variable[type[char], zeroChar]
THIS[call[None.print, parameter[member[.context], member[.buffer], member[.attributes], member[.numsys], member[.zeroChar], member[.minDigits], literal[10]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[print] operator[SEP] identifier[ChronoDisplay] identifier[context] , identifier[Appendable] identifier[buffer] , identifier[AttributeQuery] identifier[attributes] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ChronoException] {
identifier[NumberSystem] identifier[numsys] operator[=] identifier[getNumberSystem] operator[SEP] identifier[attributes] operator[SEP] operator[SEP] identifier[TextWidth] identifier[width] operator[=] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[Attributes] operator[SEP] identifier[TEXT_WIDTH] , identifier[TextWidth] operator[SEP] identifier[NARROW] operator[SEP] operator[SEP] Keyword[int] identifier[minDigits] operator[SEP] Keyword[switch] operator[SEP] identifier[width] operator[SEP] {
Keyword[case] identifier[NARROW] operator[:] identifier[minDigits] operator[=] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[SHORT] operator[:] identifier[minDigits] operator[=] Other[2] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ABBREVIATED] operator[:] identifier[minDigits] operator[=] Other[3] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[minDigits] operator[=] Other[4] operator[SEP]
}
Keyword[char] identifier[zeroChar] operator[=] operator[SEP] identifier[attributes] operator[SEP] identifier[contains] operator[SEP] identifier[Attributes] operator[SEP] identifier[ZERO_DIGIT] operator[SEP] operator[?] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[Attributes] operator[SEP] identifier[ZERO_DIGIT] operator[SEP] operator[SEP] identifier[charValue] operator[SEP] operator[SEP] operator[:] operator[SEP] identifier[numsys] operator[SEP] identifier[isDecimal] operator[SEP] operator[SEP] operator[?] identifier[numsys] operator[SEP] identifier[getDigits] operator[SEP] operator[SEP] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[print] operator[SEP] identifier[context] , identifier[buffer] , identifier[attributes] , identifier[numsys] , identifier[zeroChar] , identifier[minDigits] , Other[10] operator[SEP] operator[SEP]
}
|
protected static String parse(String key) {
String value = (String) fetch(key);
return parseFoundKey(value);
} | class class_name[name] begin[{]
method[parse, return_type[type[String]], modifier[static protected], parameter[key]] begin[{]
local_variable[type[String], value]
return[call[.parseFoundKey, parameter[member[.value]]]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[String] identifier[parse] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[String] identifier[value] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[fetch] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[parseFoundKey] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public double weightedJaccardSimilarity(IntSet other) {
if (isEmpty() && other.isEmpty())
return 1D;
IntIterator itr = intersection(other).iterator();
double intersectionSum = 0D;
while (itr.hasNext())
intersectionSum += itr.next();
itr = symmetricDifference(other).iterator();
double symmetricDifferenceSum = 0D;
while (itr.hasNext())
symmetricDifferenceSum += itr.next();
return intersectionSum / (intersectionSum + symmetricDifferenceSum);
} | class class_name[name] begin[{]
method[weightedJaccardSimilarity, return_type[type[double]], modifier[public], parameter[other]] begin[{]
if[binary_operation[call[.isEmpty, parameter[]], &&, call[other.isEmpty, parameter[]]]] begin[{]
return[literal[1D]]
else begin[{]
None
end[}]
local_variable[type[IntIterator], itr]
local_variable[type[double], intersectionSum]
while[call[itr.hasNext, parameter[]]] begin[{]
assign[member[.intersectionSum], call[itr.next, parameter[]]]
end[}]
assign[member[.itr], call[.symmetricDifference, parameter[member[.other]]]]
local_variable[type[double], symmetricDifferenceSum]
while[call[itr.hasNext, parameter[]]] begin[{]
assign[member[.symmetricDifferenceSum], call[itr.next, parameter[]]]
end[}]
return[binary_operation[member[.intersectionSum], /, binary_operation[member[.intersectionSum], +, member[.symmetricDifferenceSum]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[weightedJaccardSimilarity] operator[SEP] identifier[IntSet] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[other] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[Float] operator[SEP] identifier[IntIterator] identifier[itr] operator[=] identifier[intersection] operator[SEP] identifier[other] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[intersectionSum] operator[=] literal[Float] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[intersectionSum] operator[+=] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[itr] operator[=] identifier[symmetricDifference] operator[SEP] identifier[other] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[symmetricDifferenceSum] operator[=] literal[Float] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[symmetricDifferenceSum] operator[+=] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[intersectionSum] operator[/] operator[SEP] identifier[intersectionSum] operator[+] identifier[symmetricDifferenceSum] operator[SEP] operator[SEP]
}
|
@Override
public DeleteBackupPlanResult deleteBackupPlan(DeleteBackupPlanRequest request) {
request = beforeClientExecution(request);
return executeDeleteBackupPlan(request);
} | class class_name[name] begin[{]
method[deleteBackupPlan, return_type[type[DeleteBackupPlanResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteBackupPlan, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteBackupPlanResult] identifier[deleteBackupPlan] operator[SEP] identifier[DeleteBackupPlanRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteBackupPlan] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected void sendNotification(
CmsObject userCms,
CmsUser recipient,
CmsProject workflowProject,
List<CmsResource> resources) {
try {
String linkHref = OpenCms.getLinkManager().getServerLink(
userCms,
"/system/workplace/commons/publish.jsp?"
+ CmsPublishService.PARAM_PUBLISH_PROJECT_ID
+ "="
+ workflowProject.getUuid()
+ "&"
+ CmsPublishService.PARAM_CONFIRM
+ "=true");
CmsWorkflowNotification notification = new CmsWorkflowNotification(
m_adminCms,
userCms,
recipient,
getNotificationResource(m_adminCms),
workflowProject,
resources,
linkHref);
notification.send();
} catch (Throwable e) {
LOG.error(e.getLocalizedMessage(), e);
}
} | class class_name[name] begin[{]
method[sendNotification, return_type[void], modifier[protected], parameter[userCms, recipient, workflowProject, resources]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLinkManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=userCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/system/workplace/commons/publish.jsp?"), operandr=MemberReference(member=PARAM_PUBLISH_PROJECT_ID, postfix_operators=[], prefix_operators=[], qualifier=CmsPublishService, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MethodInvocation(arguments=[], member=getUuid, postfix_operators=[], prefix_operators=[], qualifier=workflowProject, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&"), operator=+), operandr=MemberReference(member=PARAM_CONFIRM, postfix_operators=[], prefix_operators=[], qualifier=CmsPublishService, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=true"), operator=+)], member=getServerLink, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=linkHref)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=m_adminCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=userCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recipient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=m_adminCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNotificationResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=workflowProject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=linkHref, 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=CmsWorkflowNotification, sub_type=None)), name=notification)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsWorkflowNotification, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=send, postfix_operators=[], prefix_operators=[], qualifier=notification, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, 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)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[sendNotification] operator[SEP] identifier[CmsObject] identifier[userCms] , identifier[CmsUser] identifier[recipient] , identifier[CmsProject] identifier[workflowProject] , identifier[List] operator[<] identifier[CmsResource] operator[>] identifier[resources] operator[SEP] {
Keyword[try] {
identifier[String] identifier[linkHref] operator[=] identifier[OpenCms] operator[SEP] identifier[getLinkManager] operator[SEP] operator[SEP] operator[SEP] identifier[getServerLink] operator[SEP] identifier[userCms] , literal[String] operator[+] identifier[CmsPublishService] operator[SEP] identifier[PARAM_PUBLISH_PROJECT_ID] operator[+] literal[String] operator[+] identifier[workflowProject] operator[SEP] identifier[getUuid] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[CmsPublishService] operator[SEP] identifier[PARAM_CONFIRM] operator[+] literal[String] operator[SEP] operator[SEP] identifier[CmsWorkflowNotification] identifier[notification] operator[=] Keyword[new] identifier[CmsWorkflowNotification] operator[SEP] identifier[m_adminCms] , identifier[userCms] , identifier[recipient] , identifier[getNotificationResource] operator[SEP] identifier[m_adminCms] operator[SEP] , identifier[workflowProject] , identifier[resources] , identifier[linkHref] operator[SEP] operator[SEP] identifier[notification] operator[SEP] identifier[send] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static Props loadProps(final Props parent, final File... propFiles) {
try {
Props props = new Props(parent);
for (final File f : propFiles) {
if (f.isFile()) {
props = new Props(props, f);
}
}
return props;
} catch (final IOException e) {
throw new RuntimeException("Error loading properties.", e);
}
} | class class_name[name] begin[{]
method[loadProps, return_type[type[Props]], modifier[public static], parameter[parent, propFiles]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=parent, 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=Props, sub_type=None)), name=props)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Props, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isFile, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=Props, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=propFiles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error loading properties."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Props] identifier[loadProps] operator[SEP] Keyword[final] identifier[Props] identifier[parent] , Keyword[final] identifier[File] operator[...] identifier[propFiles] operator[SEP] {
Keyword[try] {
identifier[Props] identifier[props] operator[=] Keyword[new] identifier[Props] operator[SEP] identifier[parent] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[File] identifier[f] operator[:] identifier[propFiles] operator[SEP] {
Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[props] operator[=] Keyword[new] identifier[Props] operator[SEP] identifier[props] , identifier[f] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[props] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public final void mT__81() throws RecognitionException {
try {
int _type = T__81;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalSARL.g:67:7: ( '=>' )
// InternalSARL.g:67:9: '=>'
{
match("=>");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} | class class_name[name] begin[{]
method[mT__81, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=T__81, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=>")], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[mT__81] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[T__81] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public void consolidate(RemoveAttributeTransform preceding)
{
for(int i = 0; i < catIndexMap.length; i++)
catIndexMap[i] = preceding.catIndexMap[catIndexMap[i]];
for(int i = 0; i < numIndexMap.length; i++)
numIndexMap[i] = preceding.numIndexMap[numIndexMap[i]];
} | class class_name[name] begin[{]
method[consolidate, return_type[void], modifier[public], parameter[preceding]] begin[{]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=catIndexMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=catIndexMap, postfix_operators=[], prefix_operators=[], qualifier=preceding, selectors=[ArraySelector(index=MemberReference(member=catIndexMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))])), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=catIndexMap, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=numIndexMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=numIndexMap, postfix_operators=[], prefix_operators=[], qualifier=preceding, selectors=[ArraySelector(index=MemberReference(member=numIndexMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))])), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=numIndexMap, 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[void] identifier[consolidate] operator[SEP] identifier[RemoveAttributeTransform] identifier[preceding] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[catIndexMap] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[catIndexMap] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[preceding] operator[SEP] identifier[catIndexMap] operator[SEP] identifier[catIndexMap] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numIndexMap] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[numIndexMap] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[preceding] operator[SEP] identifier[numIndexMap] operator[SEP] identifier[numIndexMap] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
|
static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
} | class class_name[name] begin[{]
method[getRawType, return_type[type[Type]], modifier[static], parameter[genericType, typeVariableMap]] begin[{]
local_variable[type[Type], resolvedType]
if[binary_operation[member[.genericType], instanceof, type[TypeVariable]]] begin[{]
local_variable[type[TypeVariable], tv]
assign[member[.resolvedType], call[typeVariableMap.get, parameter[member[.tv]]]]
if[binary_operation[member[.resolvedType], ==, literal[null]]] begin[{]
assign[member[.resolvedType], call[.extractBoundForTypeVariable, parameter[member[.tv]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.resolvedType], instanceof, type[ParameterizedType]]] begin[{]
return[Cast(expression=MemberReference(member=resolvedType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ParameterizedType, sub_type=None))]
else begin[{]
return[member[.resolvedType]]
end[}]
end[}]
END[}] | Keyword[static] identifier[Type] identifier[getRawType] operator[SEP] identifier[Type] identifier[genericType] , identifier[Map] operator[<] identifier[TypeVariable] , identifier[Type] operator[>] identifier[typeVariableMap] operator[SEP] {
identifier[Type] identifier[resolvedType] operator[=] identifier[genericType] operator[SEP] Keyword[if] operator[SEP] identifier[genericType] Keyword[instanceof] identifier[TypeVariable] operator[SEP] {
identifier[TypeVariable] identifier[tv] operator[=] operator[SEP] identifier[TypeVariable] operator[SEP] identifier[genericType] operator[SEP] identifier[resolvedType] operator[=] identifier[typeVariableMap] operator[SEP] identifier[get] operator[SEP] identifier[tv] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolvedType] operator[==] Other[null] operator[SEP] {
identifier[resolvedType] operator[=] identifier[extractBoundForTypeVariable] operator[SEP] identifier[tv] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[resolvedType] Keyword[instanceof] identifier[ParameterizedType] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[resolvedType] operator[SEP] operator[SEP] identifier[getRawType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[resolvedType] operator[SEP]
}
}
|
public ServiceFuture<BatchConfigurationInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String batchConfigurationName, BatchConfigurationInner batchConfiguration, final ServiceCallback<BatchConfigurationInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, batchConfigurationName, batchConfiguration), serviceCallback);
} | class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, integrationAccountName, batchConfigurationName, batchConfiguration, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.integrationAccountName], member[.batchConfigurationName], member[.batchConfiguration]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[BatchConfigurationInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[integrationAccountName] , identifier[String] identifier[batchConfigurationName] , identifier[BatchConfigurationInner] identifier[batchConfiguration] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[BatchConfigurationInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[integrationAccountName] , identifier[batchConfigurationName] , identifier[batchConfiguration] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
String findSparkSubmit() {
String script = isWindows() ? "spark-submit.cmd" : "spark-submit";
return join(File.separator, builder.getSparkHome(), "bin", script);
} | class class_name[name] begin[{]
method[findSparkSubmit, return_type[type[String]], modifier[default], parameter[]] begin[{]
local_variable[type[String], script]
return[call[.join, parameter[member[File.separator], call[builder.getSparkHome, parameter[]], literal["bin"], member[.script]]]]
end[}]
END[}] | identifier[String] identifier[findSparkSubmit] operator[SEP] operator[SEP] {
identifier[String] identifier[script] operator[=] identifier[isWindows] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] Keyword[return] identifier[join] operator[SEP] identifier[File] operator[SEP] identifier[separator] , identifier[builder] operator[SEP] identifier[getSparkHome] operator[SEP] operator[SEP] , literal[String] , identifier[script] operator[SEP] operator[SEP]
}
|
public static PackageNameMappingWithPackagePattern fromPackage(String packagePattern)
{
PackageNameMapping packageNameMapping = new PackageNameMapping();
packageNameMapping.setPackagePattern(packagePattern);
return packageNameMapping;
} | class class_name[name] begin[{]
method[fromPackage, return_type[type[PackageNameMappingWithPackagePattern]], modifier[public static], parameter[packagePattern]] begin[{]
local_variable[type[PackageNameMapping], packageNameMapping]
call[packageNameMapping.setPackagePattern, parameter[member[.packagePattern]]]
return[member[.packageNameMapping]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PackageNameMappingWithPackagePattern] identifier[fromPackage] operator[SEP] identifier[String] identifier[packagePattern] operator[SEP] {
identifier[PackageNameMapping] identifier[packageNameMapping] operator[=] Keyword[new] identifier[PackageNameMapping] operator[SEP] operator[SEP] operator[SEP] identifier[packageNameMapping] operator[SEP] identifier[setPackagePattern] operator[SEP] identifier[packagePattern] operator[SEP] operator[SEP] Keyword[return] identifier[packageNameMapping] operator[SEP]
}
|
public static ExprBoolean toExprBoolean(Expression expr) {
if (expr instanceof ExprBoolean) return (ExprBoolean) expr;
if (expr instanceof Literal) {
Boolean bool = ((Literal) expr).getBoolean(null);
if (bool != null) return expr.getFactory().createLitBoolean(bool.booleanValue(), expr.getStart(), expr.getEnd());
// TODO throw new TemplateException("can't cast value to a boolean value");
}
return new CastBoolean(expr);
} | class class_name[name] begin[{]
method[toExprBoolean, return_type[type[ExprBoolean]], modifier[public static], parameter[expr]] begin[{]
if[binary_operation[member[.expr], instanceof, type[ExprBoolean]]] begin[{]
return[Cast(expression=MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ExprBoolean, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.expr], instanceof, type[Literal]]] begin[{]
local_variable[type[Boolean], bool]
if[binary_operation[member[.bool], !=, literal[null]]] begin[{]
return[call[expr.getFactory, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CastBoolean, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ExprBoolean] identifier[toExprBoolean] operator[SEP] identifier[Expression] identifier[expr] operator[SEP] {
Keyword[if] operator[SEP] identifier[expr] Keyword[instanceof] identifier[ExprBoolean] operator[SEP] Keyword[return] operator[SEP] identifier[ExprBoolean] operator[SEP] identifier[expr] operator[SEP] Keyword[if] operator[SEP] identifier[expr] Keyword[instanceof] identifier[Literal] operator[SEP] {
identifier[Boolean] identifier[bool] operator[=] operator[SEP] operator[SEP] identifier[Literal] operator[SEP] identifier[expr] operator[SEP] operator[SEP] identifier[getBoolean] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bool] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[expr] operator[SEP] identifier[getFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createLitBoolean] operator[SEP] identifier[bool] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] , identifier[expr] operator[SEP] identifier[getStart] operator[SEP] operator[SEP] , identifier[expr] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[CastBoolean] operator[SEP] identifier[expr] operator[SEP] operator[SEP]
}
|
public static <T> int indexOf(T[] array, T value) {
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
if (value == null) return i;
} else {
if (value != null && array[i].equals(value)) return i;
}
}
return -1;
} | class class_name[name] begin[{]
method[indexOf, return_type[type[int]], modifier[public static], parameter[array, value]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[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=ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=array, 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[1]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[int] identifier[indexOf] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[array] , identifier[T] identifier[value] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public Scte35TimeSignalScheduleActionSettings withScte35Descriptors(Scte35Descriptor... scte35Descriptors) {
if (this.scte35Descriptors == null) {
setScte35Descriptors(new java.util.ArrayList<Scte35Descriptor>(scte35Descriptors.length));
}
for (Scte35Descriptor ele : scte35Descriptors) {
this.scte35Descriptors.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withScte35Descriptors, return_type[type[Scte35TimeSignalScheduleActionSettings]], modifier[public], parameter[scte35Descriptors]] begin[{]
if[binary_operation[THIS[member[None.scte35Descriptors]], ==, literal[null]]] begin[{]
call[.setScte35Descriptors, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=scte35Descriptors, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Scte35Descriptor, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=scte35Descriptors, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=scte35Descriptors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Scte35Descriptor, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Scte35TimeSignalScheduleActionSettings] identifier[withScte35Descriptors] operator[SEP] identifier[Scte35Descriptor] operator[...] identifier[scte35Descriptors] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[scte35Descriptors] operator[==] Other[null] operator[SEP] {
identifier[setScte35Descriptors] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Scte35Descriptor] operator[>] operator[SEP] identifier[scte35Descriptors] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Scte35Descriptor] identifier[ele] operator[:] identifier[scte35Descriptors] operator[SEP] {
Keyword[this] operator[SEP] identifier[scte35Descriptors] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public IVarDef.Position getPosition()
{
if( position_ == null)
{
setPosition( new Position( getParent(), seqNum_));
}
return position_;
} | class class_name[name] begin[{]
method[getPosition, return_type[type[IVarDef]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.position_], ==, literal[null]]] begin[{]
call[.setPosition, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=seqNum_, 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=Position, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.position_]]
end[}]
END[}] | Keyword[public] identifier[IVarDef] operator[SEP] identifier[Position] identifier[getPosition] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[position_] operator[==] Other[null] operator[SEP] {
identifier[setPosition] operator[SEP] Keyword[new] identifier[Position] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , identifier[seqNum_] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[position_] operator[SEP]
}
|
public String getHeader(String name) {
Vector<String> v = getHeaders(name);
if (v == null) {
return null;
}
return v.firstElement();
} | class class_name[name] begin[{]
method[getHeader, return_type[type[String]], modifier[public], parameter[name]] begin[{]
local_variable[type[Vector], v]
if[binary_operation[member[.v], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[v.firstElement, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getHeader] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[Vector] operator[<] identifier[String] operator[>] identifier[v] operator[=] identifier[getHeaders] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[v] operator[SEP] identifier[firstElement] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> MutateInBuilder insert(String path, T fragment, SubdocOptionsBuilder optionsBuilder) {
asyncBuilder.insert(path, fragment, optionsBuilder);
return this;
} | class class_name[name] begin[{]
method[insert, return_type[type[MutateInBuilder]], modifier[public], parameter[path, fragment, optionsBuilder]] begin[{]
call[asyncBuilder.insert, parameter[member[.path], member[.fragment], member[.optionsBuilder]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[MutateInBuilder] identifier[insert] operator[SEP] identifier[String] identifier[path] , identifier[T] identifier[fragment] , identifier[SubdocOptionsBuilder] identifier[optionsBuilder] operator[SEP] {
identifier[asyncBuilder] operator[SEP] identifier[insert] operator[SEP] identifier[path] , identifier[fragment] , identifier[optionsBuilder] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private void internal_start(final long waitTime) throws RejectedExecutionException, CouldNotPerformException {
synchronized (lock) {
if (isActive()) {
logger.debug("Reject start, not interrupted or expired.");
return;
}
expired = false;
timerTask = GlobalScheduledExecutorService.schedule((Callable<Void>) () -> {
synchronized (lock) {
try {
logger.debug("Wait for timeout TimeOut interrupted.");
if (timerTask.isCancelled()) {
logger.debug("TimeOut was canceled.");
return null;
}
logger.debug("Expire...");
expired = true;
} finally {
timerTask = null;
}
}
try {
expired();
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Error during timeout handling!", ex), logger, LogLevel.WARN);
}
logger.debug("Worker finished.");
return null;
}, waitTime, TimeUnit.MILLISECONDS);
}
} | class class_name[name] begin[{]
method[internal_start, return_type[void], modifier[private], parameter[waitTime]] begin[{]
SYNCHRONIZED[member[.lock]] BEGIN[{]
if[call[.isActive, parameter[]]] begin[{]
call[logger.debug, parameter[literal["Reject start, not interrupted or expired."]]]
return[None]
else begin[{]
None
end[}]
assign[member[.expired], literal[false]]
assign[member[.timerTask], call[GlobalScheduledExecutorService.schedule, parameter[Cast(expression=LambdaExpression(body=[SynchronizedStatement(block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Wait for timeout TimeOut interrupted.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isCancelled, postfix_operators=[], prefix_operators=[], qualifier=timerTask, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TimeOut was canceled.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expire...")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=expired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=None, finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=timerTask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, resources=None)], label=None, lock=MemberReference(member=lock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=expired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error during timeout handling!"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CouldNotPerformException, sub_type=None)), MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=WARN, postfix_operators=[], prefix_operators=[], qualifier=LogLevel, selectors=[])], member=printHistory, postfix_operators=[], prefix_operators=[], qualifier=ExceptionPrinter, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Worker finished.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=[], name=Callable, sub_type=None)), member[.waitTime], member[TimeUnit.MILLISECONDS]]]]
END[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[internal_start] operator[SEP] Keyword[final] Keyword[long] identifier[waitTime] operator[SEP] Keyword[throws] identifier[RejectedExecutionException] , identifier[CouldNotPerformException] {
Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
Keyword[if] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[expired] operator[=] literal[boolean] operator[SEP] identifier[timerTask] operator[=] identifier[GlobalScheduledExecutorService] operator[SEP] identifier[schedule] operator[SEP] operator[SEP] identifier[Callable] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
Keyword[try] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[timerTask] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[expired] operator[=] literal[boolean] operator[SEP]
}
Keyword[finally] {
identifier[timerTask] operator[=] Other[null] operator[SEP]
}
}
Keyword[try] {
identifier[expired] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[ExceptionPrinter] operator[SEP] identifier[printHistory] operator[SEP] Keyword[new] identifier[CouldNotPerformException] operator[SEP] literal[String] , identifier[ex] operator[SEP] , identifier[logger] , identifier[LogLevel] operator[SEP] identifier[WARN] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} , identifier[waitTime] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
}
|
public static <T, U> ToLongBiFunction<T, U> toLongBiFunction(CheckedToLongBiFunction<T, U> function) {
return toLongBiFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION);
} | class class_name[name] begin[{]
method[toLongBiFunction, return_type[type[ToLongBiFunction]], modifier[public static], parameter[function]] begin[{]
return[call[.toLongBiFunction, parameter[member[.function], member[.THROWABLE_TO_RUNTIME_EXCEPTION]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[U] operator[>] identifier[ToLongBiFunction] operator[<] identifier[T] , identifier[U] operator[>] identifier[toLongBiFunction] operator[SEP] identifier[CheckedToLongBiFunction] operator[<] identifier[T] , identifier[U] operator[>] identifier[function] operator[SEP] {
Keyword[return] identifier[toLongBiFunction] operator[SEP] identifier[function] , identifier[THROWABLE_TO_RUNTIME_EXCEPTION] operator[SEP] operator[SEP]
}
|
private ImmutableList<ASTParameter> getParameters(List<? extends VariableElement> variableElements) {
ImmutableList.Builder<ASTParameter> astParameterBuilder = ImmutableList.builder();
for (VariableElement variables : variableElements) {
astParameterBuilder.add(getParameter(variables));
}
return astParameterBuilder.build();
} | class class_name[name] begin[{]
method[getParameters, return_type[type[ImmutableList]], modifier[private], parameter[variableElements]] begin[{]
local_variable[type[ImmutableList], astParameterBuilder]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=variables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=astParameterBuilder, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=variableElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=variables)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableElement, sub_type=None))), label=None)
return[call[astParameterBuilder.build, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[ImmutableList] operator[<] identifier[ASTParameter] operator[>] identifier[getParameters] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[VariableElement] operator[>] identifier[variableElements] operator[SEP] {
identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[ASTParameter] operator[>] identifier[astParameterBuilder] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[VariableElement] identifier[variables] operator[:] identifier[variableElements] operator[SEP] {
identifier[astParameterBuilder] operator[SEP] identifier[add] operator[SEP] identifier[getParameter] operator[SEP] identifier[variables] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[astParameterBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private String getIssuerHashHeader(final DmfTenantSecurityToken secruityToken, final String knownIssuerHashes) {
// there may be several knownIssuerHashes configured for the tenant
final List<String> knownHashes = splitMultiHashBySemicolon(knownIssuerHashes);
// iterate over the headers until we get a null header.
int iHeader = 1;
String foundHash;
while ((foundHash = secruityToken.getHeader(String.format(sslIssuerHashBasicHeader, iHeader))) != null) {
if (knownHashes.contains(foundHash.toLowerCase())) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Found matching ssl issuer hash at position {}", iHeader);
}
return foundHash.toLowerCase();
}
iHeader++;
}
LOG_SECURITY_AUTH.debug(
"Certifacte request but no matching hash found in headers {} for common name {} in request",
sslIssuerHashBasicHeader, secruityToken.getHeader(caCommonNameHeader));
return null;
} | class class_name[name] begin[{]
method[getIssuerHashHeader, return_type[type[String]], modifier[private], parameter[secruityToken, knownIssuerHashes]] begin[{]
local_variable[type[List], knownHashes]
local_variable[type[int], iHeader]
local_variable[type[String], foundHash]
while[binary_operation[assign[member[.foundHash], call[secruityToken.getHeader, parameter[call[String.format, parameter[member[.sslIssuerHashBasicHeader], member[.iHeader]]]]]], !=, literal[null]]] begin[{]
if[call[knownHashes.contains, parameter[call[foundHash.toLowerCase, parameter[]]]]] begin[{]
if[call[LOGGER.isTraceEnabled, parameter[]]] begin[{]
call[LOGGER.trace, parameter[literal["Found matching ssl issuer hash at position {}"], member[.iHeader]]]
else begin[{]
None
end[}]
return[call[foundHash.toLowerCase, parameter[]]]
else begin[{]
None
end[}]
member[.iHeader]
end[}]
call[LOG_SECURITY_AUTH.debug, parameter[literal["Certifacte request but no matching hash found in headers {} for common name {} in request"], member[.sslIssuerHashBasicHeader], call[secruityToken.getHeader, parameter[member[.caCommonNameHeader]]]]]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getIssuerHashHeader] operator[SEP] Keyword[final] identifier[DmfTenantSecurityToken] identifier[secruityToken] , Keyword[final] identifier[String] identifier[knownIssuerHashes] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[knownHashes] operator[=] identifier[splitMultiHashBySemicolon] operator[SEP] identifier[knownIssuerHashes] operator[SEP] operator[SEP] Keyword[int] identifier[iHeader] operator[=] Other[1] operator[SEP] identifier[String] identifier[foundHash] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[foundHash] operator[=] identifier[secruityToken] operator[SEP] identifier[getHeader] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[sslIssuerHashBasicHeader] , identifier[iHeader] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[knownHashes] operator[SEP] identifier[contains] operator[SEP] identifier[foundHash] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[iHeader] operator[SEP] operator[SEP]
}
Keyword[return] identifier[foundHash] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP]
}
identifier[iHeader] operator[++] operator[SEP]
}
identifier[LOG_SECURITY_AUTH] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[sslIssuerHashBasicHeader] , identifier[secruityToken] operator[SEP] identifier[getHeader] operator[SEP] identifier[caCommonNameHeader] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public DateTimeFormatterBuilder appendLocalizedOffset(TextStyle style) {
Jdk8Methods.requireNonNull(style, "style");
if (style != TextStyle.FULL && style != TextStyle.SHORT) {
throw new IllegalArgumentException("Style must be either full or short");
}
appendInternal(new LocalizedOffsetPrinterParser(style));
return this;
} | class class_name[name] begin[{]
method[appendLocalizedOffset, return_type[type[DateTimeFormatterBuilder]], modifier[public], parameter[style]] begin[{]
call[Jdk8Methods.requireNonNull, parameter[member[.style], literal["style"]]]
if[binary_operation[binary_operation[member[.style], !=, member[TextStyle.FULL]], &&, binary_operation[member[.style], !=, member[TextStyle.SHORT]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Style must be either full or short")], 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[}]
call[.appendInternal, parameter[ClassCreator(arguments=[MemberReference(member=style, 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=LocalizedOffsetPrinterParser, sub_type=None))]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DateTimeFormatterBuilder] identifier[appendLocalizedOffset] operator[SEP] identifier[TextStyle] identifier[style] operator[SEP] {
identifier[Jdk8Methods] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[style] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[style] operator[!=] identifier[TextStyle] operator[SEP] identifier[FULL] operator[&&] identifier[style] operator[!=] identifier[TextStyle] operator[SEP] identifier[SHORT] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[appendInternal] operator[SEP] Keyword[new] identifier[LocalizedOffsetPrinterParser] operator[SEP] identifier[style] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "_positionalAccuracy")
public JAXBElement<AbstractPositionalAccuracyType> create_PositionalAccuracy(AbstractPositionalAccuracyType value) {
return new JAXBElement<AbstractPositionalAccuracyType>(__PositionalAccuracy_QNAME, AbstractPositionalAccuracyType.class, null, value);
} | class class_name[name] begin[{]
method[create_PositionalAccuracy, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=__PositionalAccuracy_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AbstractPositionalAccuracyType, 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=AbstractPositionalAccuracyType, 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[AbstractPositionalAccuracyType] operator[>] identifier[create_PositionalAccuracy] operator[SEP] identifier[AbstractPositionalAccuracyType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[AbstractPositionalAccuracyType] operator[>] operator[SEP] identifier[__PositionalAccuracy_QNAME] , identifier[AbstractPositionalAccuracyType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
static void getNumDataBytesAndNumECBytesForBlockID(int numTotalBytes,
int numDataBytes,
int numRSBlocks,
int blockID,
int[] numDataBytesInBlock,
int[] numECBytesInBlock) throws WriterException {
if (blockID >= numRSBlocks) {
throw new WriterException("Block ID too large");
}
// numRsBlocksInGroup2 = 196 % 5 = 1
int numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
// numRsBlocksInGroup1 = 5 - 1 = 4
int numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
// numTotalBytesInGroup1 = 196 / 5 = 39
int numTotalBytesInGroup1 = numTotalBytes / numRSBlocks;
// numTotalBytesInGroup2 = 39 + 1 = 40
int numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
// numDataBytesInGroup1 = 66 / 5 = 13
int numDataBytesInGroup1 = numDataBytes / numRSBlocks;
// numDataBytesInGroup2 = 13 + 1 = 14
int numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
// numEcBytesInGroup1 = 39 - 13 = 26
int numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
// numEcBytesInGroup2 = 40 - 14 = 26
int numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
// Sanity checks.
// 26 = 26
if (numEcBytesInGroup1 != numEcBytesInGroup2) {
throw new WriterException("EC bytes mismatch");
}
// 5 = 4 + 1.
if (numRSBlocks != numRsBlocksInGroup1 + numRsBlocksInGroup2) {
throw new WriterException("RS blocks mismatch");
}
// 196 = (13 + 26) * 4 + (14 + 26) * 1
if (numTotalBytes !=
((numDataBytesInGroup1 + numEcBytesInGroup1) *
numRsBlocksInGroup1) +
((numDataBytesInGroup2 + numEcBytesInGroup2) *
numRsBlocksInGroup2)) {
throw new WriterException("Total bytes mismatch");
}
if (blockID < numRsBlocksInGroup1) {
numDataBytesInBlock[0] = numDataBytesInGroup1;
numECBytesInBlock[0] = numEcBytesInGroup1;
} else {
numDataBytesInBlock[0] = numDataBytesInGroup2;
numECBytesInBlock[0] = numEcBytesInGroup2;
}
} | class class_name[name] begin[{]
method[getNumDataBytesAndNumECBytesForBlockID, return_type[void], modifier[static], parameter[numTotalBytes, numDataBytes, numRSBlocks, blockID, numDataBytesInBlock, numECBytesInBlock]] begin[{]
if[binary_operation[member[.blockID], >=, member[.numRSBlocks]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Block ID too large")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriterException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], numRsBlocksInGroup2]
local_variable[type[int], numRsBlocksInGroup1]
local_variable[type[int], numTotalBytesInGroup1]
local_variable[type[int], numTotalBytesInGroup2]
local_variable[type[int], numDataBytesInGroup1]
local_variable[type[int], numDataBytesInGroup2]
local_variable[type[int], numEcBytesInGroup1]
local_variable[type[int], numEcBytesInGroup2]
if[binary_operation[member[.numEcBytesInGroup1], !=, member[.numEcBytesInGroup2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="EC bytes mismatch")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriterException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.numRSBlocks], !=, binary_operation[member[.numRsBlocksInGroup1], +, member[.numRsBlocksInGroup2]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RS blocks mismatch")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriterException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.numTotalBytes], !=, binary_operation[binary_operation[binary_operation[member[.numDataBytesInGroup1], +, member[.numEcBytesInGroup1]], *, member[.numRsBlocksInGroup1]], +, binary_operation[binary_operation[member[.numDataBytesInGroup2], +, member[.numEcBytesInGroup2]], *, member[.numRsBlocksInGroup2]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Total bytes mismatch")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriterException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.blockID], <, member[.numRsBlocksInGroup1]]] begin[{]
assign[member[.numDataBytesInBlock], member[.numDataBytesInGroup1]]
assign[member[.numECBytesInBlock], member[.numEcBytesInGroup1]]
else begin[{]
assign[member[.numDataBytesInBlock], member[.numDataBytesInGroup2]]
assign[member[.numECBytesInBlock], member[.numEcBytesInGroup2]]
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[getNumDataBytesAndNumECBytesForBlockID] operator[SEP] Keyword[int] identifier[numTotalBytes] , Keyword[int] identifier[numDataBytes] , Keyword[int] identifier[numRSBlocks] , Keyword[int] identifier[blockID] , Keyword[int] operator[SEP] operator[SEP] identifier[numDataBytesInBlock] , Keyword[int] operator[SEP] operator[SEP] identifier[numECBytesInBlock] operator[SEP] Keyword[throws] identifier[WriterException] {
Keyword[if] operator[SEP] identifier[blockID] operator[>=] identifier[numRSBlocks] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WriterException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[numRsBlocksInGroup2] operator[=] identifier[numTotalBytes] operator[%] identifier[numRSBlocks] operator[SEP] Keyword[int] identifier[numRsBlocksInGroup1] operator[=] identifier[numRSBlocks] operator[-] identifier[numRsBlocksInGroup2] operator[SEP] Keyword[int] identifier[numTotalBytesInGroup1] operator[=] identifier[numTotalBytes] operator[/] identifier[numRSBlocks] operator[SEP] Keyword[int] identifier[numTotalBytesInGroup2] operator[=] identifier[numTotalBytesInGroup1] operator[+] Other[1] operator[SEP] Keyword[int] identifier[numDataBytesInGroup1] operator[=] identifier[numDataBytes] operator[/] identifier[numRSBlocks] operator[SEP] Keyword[int] identifier[numDataBytesInGroup2] operator[=] identifier[numDataBytesInGroup1] operator[+] Other[1] operator[SEP] Keyword[int] identifier[numEcBytesInGroup1] operator[=] identifier[numTotalBytesInGroup1] operator[-] identifier[numDataBytesInGroup1] operator[SEP] Keyword[int] identifier[numEcBytesInGroup2] operator[=] identifier[numTotalBytesInGroup2] operator[-] identifier[numDataBytesInGroup2] operator[SEP] Keyword[if] operator[SEP] identifier[numEcBytesInGroup1] operator[!=] identifier[numEcBytesInGroup2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WriterException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[numRSBlocks] operator[!=] identifier[numRsBlocksInGroup1] operator[+] identifier[numRsBlocksInGroup2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WriterException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[numTotalBytes] operator[!=] operator[SEP] operator[SEP] identifier[numDataBytesInGroup1] operator[+] identifier[numEcBytesInGroup1] operator[SEP] operator[*] identifier[numRsBlocksInGroup1] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[numDataBytesInGroup2] operator[+] identifier[numEcBytesInGroup2] operator[SEP] operator[*] identifier[numRsBlocksInGroup2] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WriterException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[blockID] operator[<] identifier[numRsBlocksInGroup1] operator[SEP] {
identifier[numDataBytesInBlock] operator[SEP] Other[0] operator[SEP] operator[=] identifier[numDataBytesInGroup1] operator[SEP] identifier[numECBytesInBlock] operator[SEP] Other[0] operator[SEP] operator[=] identifier[numEcBytesInGroup1] operator[SEP]
}
Keyword[else] {
identifier[numDataBytesInBlock] operator[SEP] Other[0] operator[SEP] operator[=] identifier[numDataBytesInGroup2] operator[SEP] identifier[numECBytesInBlock] operator[SEP] Other[0] operator[SEP] operator[=] identifier[numEcBytesInGroup2] operator[SEP]
}
}
|
public static boolean matches(Pattern patternMatcher, Collection<Filter> filters, Extension extension)
{
if (matches(patternMatcher, extension.getId().getId(), extension.getDescription(), extension.getSummary(),
extension.getName(), ExtensionIdConverter.toStringList(extension.getExtensionFeatures()))) {
for (Filter filter : filters) {
if (!matches(filter, extension)) {
return false;
}
}
return true;
}
return false;
} | class class_name[name] begin[{]
method[matches, return_type[type[boolean]], modifier[public static], parameter[patternMatcher, filters, extension]] begin[{]
if[call[.matches, parameter[member[.patternMatcher], call[extension.getId, parameter[]], call[extension.getDescription, parameter[]], call[extension.getSummary, parameter[]], call[extension.getName, parameter[]], call[ExtensionIdConverter.toStringList, parameter[call[extension.getExtensionFeatures, parameter[]]]]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matches, 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=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Filter, sub_type=None))), label=None)
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[matches] operator[SEP] identifier[Pattern] identifier[patternMatcher] , identifier[Collection] operator[<] identifier[Filter] operator[>] identifier[filters] , identifier[Extension] identifier[extension] operator[SEP] {
Keyword[if] operator[SEP] identifier[matches] operator[SEP] identifier[patternMatcher] , identifier[extension] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[extension] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] , identifier[extension] operator[SEP] identifier[getSummary] operator[SEP] operator[SEP] , identifier[extension] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[ExtensionIdConverter] operator[SEP] identifier[toStringList] operator[SEP] identifier[extension] operator[SEP] identifier[getExtensionFeatures] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Filter] identifier[filter] operator[:] identifier[filters] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[matches] operator[SEP] identifier[filter] , identifier[extension] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setLaunchTemplateConfigs(java.util.Collection<FleetLaunchTemplateConfig> launchTemplateConfigs) {
if (launchTemplateConfigs == null) {
this.launchTemplateConfigs = null;
return;
}
this.launchTemplateConfigs = new com.amazonaws.internal.SdkInternalList<FleetLaunchTemplateConfig>(launchTemplateConfigs);
} | class class_name[name] begin[{]
method[setLaunchTemplateConfigs, return_type[void], modifier[public], parameter[launchTemplateConfigs]] begin[{]
if[binary_operation[member[.launchTemplateConfigs], ==, literal[null]]] begin[{]
assign[THIS[member[None.launchTemplateConfigs]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.launchTemplateConfigs]], ClassCreator(arguments=[MemberReference(member=launchTemplateConfigs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FleetLaunchTemplateConfig, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setLaunchTemplateConfigs] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[FleetLaunchTemplateConfig] operator[>] identifier[launchTemplateConfigs] operator[SEP] {
Keyword[if] operator[SEP] identifier[launchTemplateConfigs] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[launchTemplateConfigs] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[launchTemplateConfigs] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[FleetLaunchTemplateConfig] operator[>] operator[SEP] identifier[launchTemplateConfigs] operator[SEP] operator[SEP]
}
|
public static URL getVirtualURL(VirtualFile file) throws MalformedURLException {
try {
final URI uri = getVirtualURI(file);
final String scheme = uri.getScheme();
return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
@Override
public URL run() throws MalformedURLException{
if (VFS_PROTOCOL.equals(scheme)) {
return new URL(null, uri.toString(), VFS_URL_HANDLER);
} else if ("file".equals(scheme)) {
return new URL(null, uri.toString(), FILE_URL_HANDLER);
} else {
return uri.toURL();
}
}
});
} catch (URISyntaxException e) {
throw new MalformedURLException(e.getMessage());
} catch (PrivilegedActionException e) {
throw (MalformedURLException) e.getException();
}
} | class class_name[name] begin[{]
method[getVirtualURL, return_type[type[URL]], modifier[public static], parameter[file]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVirtualURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=uri)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getScheme, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), name=scheme)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=VFS_PROTOCOL, selectors=[], type_arguments=None), else_statement=IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="file"), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=toURL, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), MemberReference(member=FILE_URL_HANDLER, 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=URL, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), MemberReference(member=VFS_URL_HANDLER, 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=URL, sub_type=None)), label=None)]))], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None), throws=['MalformedURLException'], 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=URL, sub_type=None))], dimensions=None, name=PrivilegedExceptionAction, sub_type=None))], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=AccessController, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MalformedURLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException'])), CatchClause(block=[ThrowStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getException, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MalformedURLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['PrivilegedActionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[URL] identifier[getVirtualURL] operator[SEP] identifier[VirtualFile] identifier[file] operator[SEP] Keyword[throws] identifier[MalformedURLException] {
Keyword[try] {
Keyword[final] identifier[URI] identifier[uri] operator[=] identifier[getVirtualURI] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[scheme] operator[=] identifier[uri] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] Keyword[new] identifier[PrivilegedExceptionAction] operator[<] identifier[URL] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[URL] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[MalformedURLException] {
Keyword[if] operator[SEP] identifier[VFS_PROTOCOL] operator[SEP] identifier[equals] operator[SEP] identifier[scheme] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[URL] operator[SEP] Other[null] , identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[VFS_URL_HANDLER] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[scheme] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[URL] operator[SEP] Other[null] , identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[FILE_URL_HANDLER] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[uri] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MalformedURLException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PrivilegedActionException] identifier[e] operator[SEP] {
Keyword[throw] operator[SEP] identifier[MalformedURLException] operator[SEP] identifier[e] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void setInterGroupBond(int indOne,
int indTwo, int bondOrder) {
// Get the atom
Atom atomOne = allAtoms[indOne];
Atom atomTwo = allAtoms[indTwo];
// set the new bond
@SuppressWarnings("unused")
BondImpl bond = new BondImpl(atomOne, atomTwo, bondOrder);
} | class class_name[name] begin[{]
method[setInterGroupBond, return_type[void], modifier[public], parameter[indOne, indTwo, bondOrder]] begin[{]
local_variable[type[Atom], atomOne]
local_variable[type[Atom], atomTwo]
local_variable[type[BondImpl], bond]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setInterGroupBond] operator[SEP] Keyword[int] identifier[indOne] , Keyword[int] identifier[indTwo] , Keyword[int] identifier[bondOrder] operator[SEP] {
identifier[Atom] identifier[atomOne] operator[=] identifier[allAtoms] operator[SEP] identifier[indOne] operator[SEP] operator[SEP] identifier[Atom] identifier[atomTwo] operator[=] identifier[allAtoms] operator[SEP] identifier[indTwo] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[BondImpl] identifier[bond] operator[=] Keyword[new] identifier[BondImpl] operator[SEP] identifier[atomOne] , identifier[atomTwo] , identifier[bondOrder] operator[SEP] operator[SEP]
}
|
@VisibleForTesting
final synchronized ImmutableSet<String> getAttributeKeys() {
if (attributes == null) {
return ImmutableSet.of();
}
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
for (Table.Cell<String, String, Object> cell : attributes.cellSet()) {
builder.add(cell.getRowKey() + ':' + cell.getColumnKey());
}
return builder.build();
} | class class_name[name] begin[{]
method[getAttributeKeys, return_type[type[ImmutableSet]], modifier[synchronized final], parameter[]] begin[{]
if[binary_operation[member[.attributes], ==, literal[null]]] begin[{]
return[call[ImmutableSet.of, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[ImmutableSet], builder]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getRowKey, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':'), operator=+), operandr=MethodInvocation(arguments=[], member=getColumnKey, postfix_operators=[], prefix_operators=[], qualifier=cell, selectors=[], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=cellSet, postfix_operators=[], prefix_operators=[], qualifier=attributes, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cell)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Table, 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)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Cell, sub_type=None)))), label=None)
return[call[builder.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[VisibleForTesting] Keyword[final] Keyword[synchronized] identifier[ImmutableSet] operator[<] identifier[String] operator[>] identifier[getAttributeKeys] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[attributes] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[ImmutableSet] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ImmutableSet] operator[SEP] identifier[Builder] operator[<] identifier[String] operator[>] identifier[builder] operator[=] identifier[ImmutableSet] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Table] operator[SEP] identifier[Cell] operator[<] identifier[String] , identifier[String] , identifier[Object] operator[>] identifier[cell] operator[:] identifier[attributes] operator[SEP] identifier[cellSet] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[cell] operator[SEP] identifier[getRowKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[cell] operator[SEP] identifier[getColumnKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public DeploymentNode getDeploymentNodeWithName(String name) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A name must be specified.");
}
for (DeploymentNode deploymentNode : getChildren()) {
if (deploymentNode.getName().equals(name)) {
return deploymentNode;
}
}
return null;
} | class class_name[name] begin[{]
method[getDeploymentNodeWithName, return_type[type[DeploymentNode]], modifier[public], parameter[name]] begin[{]
if[binary_operation[binary_operation[member[.name], ==, literal[null]], ||, binary_operation[call[name.trim, parameter[]], ==, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A name must be specified.")], 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[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=deploymentNode, 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=[ReturnStatement(expression=MemberReference(member=deploymentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=deploymentNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DeploymentNode, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[DeploymentNode] identifier[getDeploymentNodeWithName] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[||] identifier[name] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[DeploymentNode] identifier[deploymentNode] operator[:] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[deploymentNode] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[deploymentNode] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public void apply() {
if (editing == null) {
return;
}
try {
editing.apply();
} catch (Exception ex) {
editing.commit(); // Fallback in case low api lever.
}
editing = null;
} | class class_name[name] begin[{]
method[apply, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.editing], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=apply, postfix_operators=[], prefix_operators=[], qualifier=editing, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=commit, postfix_operators=[], prefix_operators=[], qualifier=editing, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
assign[member[.editing], literal[null]]
end[}]
END[}] | annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[GINGERBREAD] operator[SEP] Keyword[public] Keyword[void] identifier[apply] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[editing] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[editing] operator[SEP] identifier[apply] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[editing] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
identifier[editing] operator[=] Other[null] operator[SEP]
}
|
public static Activity scanForActivity(Context context) {
if (context == null) return null;
if (context instanceof Activity) {
return (Activity) context;
} else if (context instanceof ContextWrapper) {
return scanForActivity(((ContextWrapper) context).getBaseContext());
}
return null;
} | class class_name[name] begin[{]
method[scanForActivity, return_type[type[Activity]], modifier[public static], parameter[context]] begin[{]
if[binary_operation[member[.context], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.context], instanceof, type[Activity]]] begin[{]
return[Cast(expression=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None))]
else begin[{]
if[binary_operation[member[.context], instanceof, type[ContextWrapper]]] begin[{]
return[call[.scanForActivity, parameter[Cast(expression=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ContextWrapper, sub_type=None))]]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Activity] identifier[scanForActivity] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] identifier[context] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[context] Keyword[instanceof] identifier[Activity] operator[SEP] {
Keyword[return] operator[SEP] identifier[Activity] operator[SEP] identifier[context] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[context] Keyword[instanceof] identifier[ContextWrapper] operator[SEP] {
Keyword[return] identifier[scanForActivity] operator[SEP] operator[SEP] operator[SEP] identifier[ContextWrapper] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[getBaseContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public QueueDefinition createQueueDefinition( String topicName , String consumerId , boolean temporary )
{
QueueDefinition def = new QueueDefinition();
def.setName(DestinationTools.getQueueNameForTopicConsumer(topicName, consumerId));
def.setTemporary(temporary);
copyAttributesTo(def);
return def;
} | class class_name[name] begin[{]
method[createQueueDefinition, return_type[type[QueueDefinition]], modifier[public], parameter[topicName, consumerId, temporary]] begin[{]
local_variable[type[QueueDefinition], def]
call[def.setName, parameter[call[DestinationTools.getQueueNameForTopicConsumer, parameter[member[.topicName], member[.consumerId]]]]]
call[def.setTemporary, parameter[member[.temporary]]]
call[.copyAttributesTo, parameter[member[.def]]]
return[member[.def]]
end[}]
END[}] | Keyword[public] identifier[QueueDefinition] identifier[createQueueDefinition] operator[SEP] identifier[String] identifier[topicName] , identifier[String] identifier[consumerId] , Keyword[boolean] identifier[temporary] operator[SEP] {
identifier[QueueDefinition] identifier[def] operator[=] Keyword[new] identifier[QueueDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[def] operator[SEP] identifier[setName] operator[SEP] identifier[DestinationTools] operator[SEP] identifier[getQueueNameForTopicConsumer] operator[SEP] identifier[topicName] , identifier[consumerId] operator[SEP] operator[SEP] operator[SEP] identifier[def] operator[SEP] identifier[setTemporary] operator[SEP] identifier[temporary] operator[SEP] operator[SEP] identifier[copyAttributesTo] operator[SEP] identifier[def] operator[SEP] operator[SEP] Keyword[return] identifier[def] operator[SEP]
}
|
private static int indexInUpperAlphaRange(final CharSequence sequence, final int start)
{
final int length = sequence.length();
if (start < 0 || start > length)
{
throw new IndexOutOfBoundsException();
}
for (int i = start; i < length; i++)
{
final char c = sequence.charAt(i);
if ('A' <= c && c <= 'Z')
{
return i;
}
}
return -1;
} | class class_name[name] begin[{]
method[indexInUpperAlphaRange, return_type[type[int]], modifier[private static], parameter[sequence, start]] begin[{]
local_variable[type[int], length]
if[binary_operation[binary_operation[member[.start], <, literal[0]], ||, binary_operation[member[.start], >, member[.length]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=sequence, selectors=[], type_arguments=None), name=c)], modifiers={'final'}, type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='A'), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='Z'), operator=<=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[1]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[indexInUpperAlphaRange] operator[SEP] Keyword[final] identifier[CharSequence] identifier[sequence] , Keyword[final] Keyword[int] identifier[start] operator[SEP] {
Keyword[final] Keyword[int] identifier[length] operator[=] identifier[sequence] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[start] operator[<] Other[0] operator[||] identifier[start] operator[>] identifier[length] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[start] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] Keyword[char] identifier[c] operator[=] identifier[sequence] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[<=] identifier[c] operator[&&] identifier[c] operator[<=] literal[String] operator[SEP] {
Keyword[return] identifier[i] operator[SEP]
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
static public File getFile(String fileLocation, boolean alwaysInCache) {
if (alwaysInCache) {
return getCacheFile(fileLocation);
} else {
File f = new File(fileLocation);
if (f.exists())
return f;
// now comes the tricky part to make sure we can open and write to it
try {
if (!simulateUnwritableDir && f.createNewFile()) {
boolean ret = f.delete();
assert ret;
return f;
}
} catch (IOException e) {
// cant write to it - drop through
}
return getCacheFile(fileLocation);
}
} | class class_name[name] begin[{]
method[getFile, return_type[type[File]], modifier[public static], parameter[fileLocation, alwaysInCache]] begin[{]
if[member[.alwaysInCache]] begin[{]
return[call[.getCacheFile, parameter[member[.fileLocation]]]]
else begin[{]
local_variable[type[File], f]
if[call[f.exists, parameter[]]] begin[{]
return[member[.f]]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=simulateUnwritableDir, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=createNewFile, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=delete, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), name=ret)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), AssertStatement(condition=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None, value=None), ReturnStatement(expression=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[call[.getCacheFile, parameter[member[.fileLocation]]]]
end[}]
end[}]
END[}] | Keyword[static] Keyword[public] identifier[File] identifier[getFile] operator[SEP] identifier[String] identifier[fileLocation] , Keyword[boolean] identifier[alwaysInCache] operator[SEP] {
Keyword[if] operator[SEP] identifier[alwaysInCache] operator[SEP] {
Keyword[return] identifier[getCacheFile] operator[SEP] identifier[fileLocation] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[File] identifier[f] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[fileLocation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[simulateUnwritableDir] operator[&&] identifier[f] operator[SEP] identifier[createNewFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[ret] operator[=] identifier[f] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[ret] operator[SEP] Keyword[return] identifier[f] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
Keyword[return] identifier[getCacheFile] operator[SEP] identifier[fileLocation] operator[SEP] operator[SEP]
}
}
|
void parseHeader(String header, Set<String> packages) {
if (header != null && header.length() > 0) {
List<String> splitPackages = new ArrayList<String>();
// We can't just split() on commas, because there may be things in quotes, like uses clauses
int lastIndex = 0;
boolean inQuotedSection = false;
int i = 0;
for (i = 0; i < header.length(); i++) {
if ((header.charAt(i) == ',') && !(inQuotedSection)) {
String packagePlusAttributesAndDirectives = header.substring(lastIndex, i);
lastIndex = i + 1;
splitPackages.add(packagePlusAttributesAndDirectives);
} else if (header.charAt(i) == '"') {
inQuotedSection = !inQuotedSection;
}
}
// Add the last string
splitPackages.add(header.substring(lastIndex, i));
// Now go through and handle the attributes
for (String packagePlusAttributesAndDirectives : splitPackages) {
String[] bits = packagePlusAttributesAndDirectives.split(";");
// We could also process ibm-api-type and other declarations here to get better information if we need it
packages.add(bits[0]);
}
}
} | class class_name[name] begin[{]
method[parseHeader, return_type[void], modifier[default], parameter[header, packages]] begin[{]
if[binary_operation[binary_operation[member[.header], !=, literal[null]], &&, binary_operation[call[header.length, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[List], splitPackages]
local_variable[type[int], lastIndex]
local_variable[type[boolean], inQuotedSection]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=','), operator===), operandr=MemberReference(member=inQuotedSection, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inQuotedSection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=inQuotedSection, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=lastIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), name=packagePlusAttributesAndDirectives)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=packagePlusAttributesAndDirectives, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=splitPackages, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[splitPackages.add, parameter[call[header.substring, parameter[member[.lastIndex], member[.i]]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";")], member=split, postfix_operators=[], prefix_operators=[], qualifier=packagePlusAttributesAndDirectives, selectors=[], type_arguments=None), name=bits)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=add, postfix_operators=[], prefix_operators=[], qualifier=packages, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=splitPackages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=packagePlusAttributesAndDirectives)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[parseHeader] operator[SEP] identifier[String] identifier[header] , identifier[Set] operator[<] identifier[String] operator[>] identifier[packages] operator[SEP] {
Keyword[if] operator[SEP] identifier[header] operator[!=] Other[null] operator[&&] identifier[header] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[splitPackages] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[lastIndex] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[inQuotedSection] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[header] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[==] literal[String] operator[SEP] operator[&&] operator[!] operator[SEP] identifier[inQuotedSection] operator[SEP] operator[SEP] {
identifier[String] identifier[packagePlusAttributesAndDirectives] operator[=] identifier[header] operator[SEP] identifier[substring] operator[SEP] identifier[lastIndex] , identifier[i] operator[SEP] operator[SEP] identifier[lastIndex] operator[=] identifier[i] operator[+] Other[1] operator[SEP] identifier[splitPackages] operator[SEP] identifier[add] operator[SEP] identifier[packagePlusAttributesAndDirectives] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[header] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[inQuotedSection] operator[=] operator[!] identifier[inQuotedSection] operator[SEP]
}
}
identifier[splitPackages] operator[SEP] identifier[add] operator[SEP] identifier[header] operator[SEP] identifier[substring] operator[SEP] identifier[lastIndex] , identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[packagePlusAttributesAndDirectives] operator[:] identifier[splitPackages] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[bits] operator[=] identifier[packagePlusAttributesAndDirectives] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[packages] operator[SEP] identifier[add] operator[SEP] identifier[bits] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected boolean onTap(float rawX, float rawY) {
Log.d("CAPTURE-FRAGMENT", "got tap at: (" + rawX + ", " + rawY + ")");
Barcode barcode = null;
if (mMode == MVBarcodeScanner.ScanningMode.SINGLE_AUTO) {
BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
if (graphic != null) {
barcode = graphic.getBarcode();
if (barcode != null && mListener != null) {
mListener.onBarcodeScanned(barcode);
}
}
} else if (mMode == MVBarcodeScanner.ScanningMode.SINGLE_MANUAL) {
Set<BarcodeGraphic> graphicSet = mGraphicOverlay.getAllGraphics();
if (graphicSet != null && !graphicSet.isEmpty()) {
for (BarcodeGraphic graphic : graphicSet) {
if (graphic != null && graphic.isPointInsideBarcode(rawX, rawY)) {
Log.d("CAPTURE-FRAGMENT", "got tap inside barcode");
barcode = graphic.getBarcode();
break;
}
}
if (mListener != null && barcode != null) {
mListener.onBarcodeScanned(barcode);
}
}
} else {
Set<BarcodeGraphic> graphicSet = mGraphicOverlay.getAllGraphics();
if (graphicSet != null && !graphicSet.isEmpty()) {
List<Barcode> barcodes = new ArrayList<>();
for (BarcodeGraphic graphic : graphicSet) {
if (graphic != null && graphic.getBarcode() != null) {
barcode = graphic.getBarcode();
barcodes.add(barcode);
}
}
if (mListener != null && !barcodes.isEmpty()) {
mListener.onBarcodesScanned(barcodes);
}
}
}
return barcode != null;
} | class class_name[name] begin[{]
method[onTap, return_type[type[boolean]], modifier[protected], parameter[rawX, rawY]] begin[{]
call[Log.d, parameter[literal["CAPTURE-FRAGMENT"], binary_operation[binary_operation[binary_operation[binary_operation[literal["got tap at: ("], +, member[.rawX]], +, literal[", "]], +, member[.rawY]], +, literal[")"]]]]
local_variable[type[Barcode], barcode]
if[binary_operation[member[.mMode], ==, member[MVBarcodeScanner.ScanningMode.SINGLE_AUTO]]] begin[{]
local_variable[type[BarcodeGraphic], graphic]
if[binary_operation[member[.graphic], !=, literal[null]]] begin[{]
assign[member[.barcode], call[graphic.getBarcode, parameter[]]]
if[binary_operation[binary_operation[member[.barcode], !=, literal[null]], &&, binary_operation[member[.mListener], !=, literal[null]]]] begin[{]
call[mListener.onBarcodeScanned, parameter[member[.barcode]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.mMode], ==, member[MVBarcodeScanner.ScanningMode.SINGLE_MANUAL]]] begin[{]
local_variable[type[Set], graphicSet]
if[binary_operation[binary_operation[member[.graphicSet], !=, literal[null]], &&, call[graphicSet.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=graphic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=rawX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isPointInsideBarcode, postfix_operators=[], prefix_operators=[], qualifier=graphic, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CAPTURE-FRAGMENT"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="got tap inside barcode")], member=d, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=barcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getBarcode, postfix_operators=[], prefix_operators=[], qualifier=graphic, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=graphicSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=graphic)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BarcodeGraphic, sub_type=None))), label=None)
if[binary_operation[binary_operation[member[.mListener], !=, literal[null]], &&, binary_operation[member[.barcode], !=, literal[null]]]] begin[{]
call[mListener.onBarcodeScanned, parameter[member[.barcode]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[Set], graphicSet]
if[binary_operation[binary_operation[member[.graphicSet], !=, literal[null]], &&, call[graphicSet.isEmpty, parameter[]]]] begin[{]
local_variable[type[List], barcodes]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=graphic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBarcode, postfix_operators=[], prefix_operators=[], qualifier=graphic, selectors=[], type_arguments=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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=barcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getBarcode, postfix_operators=[], prefix_operators=[], qualifier=graphic, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=barcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=barcodes, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=graphicSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=graphic)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BarcodeGraphic, sub_type=None))), label=None)
if[binary_operation[binary_operation[member[.mListener], !=, literal[null]], &&, call[barcodes.isEmpty, parameter[]]]] begin[{]
call[mListener.onBarcodesScanned, parameter[member[.barcodes]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
return[binary_operation[member[.barcode], !=, literal[null]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[onTap] operator[SEP] Keyword[float] identifier[rawX] , Keyword[float] identifier[rawY] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] literal[String] , literal[String] operator[+] identifier[rawX] operator[+] literal[String] operator[+] identifier[rawY] operator[+] literal[String] operator[SEP] operator[SEP] identifier[Barcode] identifier[barcode] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[mMode] operator[==] identifier[MVBarcodeScanner] operator[SEP] identifier[ScanningMode] operator[SEP] identifier[SINGLE_AUTO] operator[SEP] {
identifier[BarcodeGraphic] identifier[graphic] operator[=] identifier[mGraphicOverlay] operator[SEP] identifier[getFirstGraphic] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[graphic] operator[!=] Other[null] operator[SEP] {
identifier[barcode] operator[=] identifier[graphic] operator[SEP] identifier[getBarcode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[barcode] operator[!=] Other[null] operator[&&] identifier[mListener] operator[!=] Other[null] operator[SEP] {
identifier[mListener] operator[SEP] identifier[onBarcodeScanned] operator[SEP] identifier[barcode] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[mMode] operator[==] identifier[MVBarcodeScanner] operator[SEP] identifier[ScanningMode] operator[SEP] identifier[SINGLE_MANUAL] operator[SEP] {
identifier[Set] operator[<] identifier[BarcodeGraphic] operator[>] identifier[graphicSet] operator[=] identifier[mGraphicOverlay] operator[SEP] identifier[getAllGraphics] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[graphicSet] operator[!=] Other[null] operator[&&] operator[!] identifier[graphicSet] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[BarcodeGraphic] identifier[graphic] operator[:] identifier[graphicSet] operator[SEP] {
Keyword[if] operator[SEP] identifier[graphic] operator[!=] Other[null] operator[&&] identifier[graphic] operator[SEP] identifier[isPointInsideBarcode] operator[SEP] identifier[rawX] , identifier[rawY] operator[SEP] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[barcode] operator[=] identifier[graphic] operator[SEP] identifier[getBarcode] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[mListener] operator[!=] Other[null] operator[&&] identifier[barcode] operator[!=] Other[null] operator[SEP] {
identifier[mListener] operator[SEP] identifier[onBarcodeScanned] operator[SEP] identifier[barcode] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[Set] operator[<] identifier[BarcodeGraphic] operator[>] identifier[graphicSet] operator[=] identifier[mGraphicOverlay] operator[SEP] identifier[getAllGraphics] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[graphicSet] operator[!=] Other[null] operator[&&] operator[!] identifier[graphicSet] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Barcode] operator[>] identifier[barcodes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BarcodeGraphic] identifier[graphic] operator[:] identifier[graphicSet] operator[SEP] {
Keyword[if] operator[SEP] identifier[graphic] operator[!=] Other[null] operator[&&] identifier[graphic] operator[SEP] identifier[getBarcode] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[barcode] operator[=] identifier[graphic] operator[SEP] identifier[getBarcode] operator[SEP] operator[SEP] operator[SEP] identifier[barcodes] operator[SEP] identifier[add] operator[SEP] identifier[barcode] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[mListener] operator[!=] Other[null] operator[&&] operator[!] identifier[barcodes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[mListener] operator[SEP] identifier[onBarcodesScanned] operator[SEP] identifier[barcodes] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[barcode] operator[!=] Other[null] operator[SEP]
}
|
public static String getSuffix(String path) {
if (null == path)
return null;
int p0 = path.lastIndexOf('.');
int p1 = path.lastIndexOf('/');
if (-1 == p0 || p0 < p1)
return "";
return path.substring(p0);
} | class class_name[name] begin[{]
method[getSuffix, return_type[type[String]], modifier[public static], parameter[path]] begin[{]
if[binary_operation[literal[null], ==, member[.path]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], p0]
local_variable[type[int], p1]
if[binary_operation[binary_operation[literal[1], ==, member[.p0]], ||, binary_operation[member[.p0], <, member[.p1]]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
return[call[path.substring, parameter[member[.p0]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getSuffix] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[path] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[int] identifier[p0] operator[=] identifier[path] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[p1] operator[=] identifier[path] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[-] Other[1] operator[==] identifier[p0] operator[||] identifier[p0] operator[<] identifier[p1] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[return] identifier[path] operator[SEP] identifier[substring] operator[SEP] identifier[p0] operator[SEP] operator[SEP]
}
|
@Deprecated
public ChangePlaylistsDetailsRequest.Builder changePlaylistsDetails(String user_id, String playlist_id) {
return new ChangePlaylistsDetailsRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.playlist_id(playlist_id);
} | class class_name[name] begin[{]
method[changePlaylistsDetails, return_type[type[ChangePlaylistsDetailsRequest]], modifier[public], parameter[user_id, playlist_id]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=accessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=httpManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaults, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=user_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=user_id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=playlist_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=playlist_id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ChangePlaylistsDetailsRequest, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] identifier[ChangePlaylistsDetailsRequest] operator[SEP] identifier[Builder] identifier[changePlaylistsDetails] operator[SEP] identifier[String] identifier[user_id] , identifier[String] identifier[playlist_id] operator[SEP] {
Keyword[return] Keyword[new] identifier[ChangePlaylistsDetailsRequest] operator[SEP] identifier[Builder] operator[SEP] identifier[accessToken] operator[SEP] operator[SEP] identifier[setDefaults] operator[SEP] identifier[httpManager] , identifier[scheme] , identifier[host] , identifier[port] operator[SEP] operator[SEP] identifier[user_id] operator[SEP] identifier[user_id] operator[SEP] operator[SEP] identifier[playlist_id] operator[SEP] identifier[playlist_id] operator[SEP] operator[SEP]
}
|
public Mono<HttpDecodedResponse> decode(Mono<HttpResponse> response, HttpResponseDecodeData decodeData) {
return response.map(r -> new HttpDecodedResponse(r, this.serializer, decodeData));
} | class class_name[name] begin[{]
method[decode, return_type[type[Mono]], modifier[public], parameter[response, decodeData]] begin[{]
return[call[response.map, parameter[LambdaExpression(body=ClassCreator(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serializer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=decodeData, 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=HttpDecodedResponse, sub_type=None)), parameters=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | Keyword[public] identifier[Mono] operator[<] identifier[HttpDecodedResponse] operator[>] identifier[decode] operator[SEP] identifier[Mono] operator[<] identifier[HttpResponse] operator[>] identifier[response] , identifier[HttpResponseDecodeData] identifier[decodeData] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[map] operator[SEP] identifier[r] operator[->] Keyword[new] identifier[HttpDecodedResponse] operator[SEP] identifier[r] , Keyword[this] operator[SEP] identifier[serializer] , identifier[decodeData] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<List<ReplicationUsageInner>> listAsync(String resourceGroupName, String vaultName) {
return listWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1<ServiceResponse<List<ReplicationUsageInner>>, List<ReplicationUsageInner>>() {
@Override
public List<ReplicationUsageInner> call(ServiceResponse<List<ReplicationUsageInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, vaultName]] begin[{]
return[call[.listWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.vaultName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[List] operator[<] identifier[ReplicationUsageInner] operator[>] operator[>] identifier[listAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[vaultName] operator[SEP] {
Keyword[return] identifier[listWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[vaultName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[ReplicationUsageInner] operator[>] operator[>] , identifier[List] operator[<] identifier[ReplicationUsageInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[ReplicationUsageInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[ReplicationUsageInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public final void addAreas(@NonNull final Map<ViewType, View> areas) {
this.areas = new TreeMap<>(new AreaComparator());
this.dividers = new HashMap<>();
for (Map.Entry<ViewType, View> entry : areas.entrySet()) {
ViewType viewType = entry.getKey();
View view = entry.getValue();
if (viewType instanceof AreaViewType) {
this.areas.put(((AreaViewType) viewType).getArea(), view);
} else if (viewType instanceof DividerViewType && view instanceof Divider) {
this.dividers.put(((DividerViewType) viewType).getLocation(), (Divider) view);
}
}
addAreas();
addDividers();
registerScrollLayoutListener();
} | class class_name[name] begin[{]
method[addAreas, return_type[void], modifier[final public], parameter[areas]] begin[{]
assign[THIS[member[None.areas]], ClassCreator(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AreaComparator, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=TreeMap, sub_type=None))]
assign[THIS[member[None.dividers]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=viewType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ViewType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=view)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=viewType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=AreaViewType, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=viewType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DividerViewType, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=view, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Divider, sub_type=None), operator=instanceof), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=dividers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Cast(expression=MemberReference(member=viewType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DividerViewType, sub_type=None)), Cast(expression=MemberReference(member=view, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Divider, sub_type=None))], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=areas, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Cast(expression=MemberReference(member=viewType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AreaViewType, sub_type=None)), MemberReference(member=view, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=areas, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ViewType, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[.addAreas, parameter[]]
call[.addDividers, parameter[]]
call[.registerScrollLayoutListener, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addAreas] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[Map] operator[<] identifier[ViewType] , identifier[View] operator[>] identifier[areas] operator[SEP] {
Keyword[this] operator[SEP] identifier[areas] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] Keyword[new] identifier[AreaComparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[dividers] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[ViewType] , identifier[View] operator[>] identifier[entry] operator[:] identifier[areas] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[ViewType] identifier[viewType] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[View] identifier[view] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[viewType] Keyword[instanceof] identifier[AreaViewType] operator[SEP] {
Keyword[this] operator[SEP] identifier[areas] operator[SEP] identifier[put] operator[SEP] operator[SEP] operator[SEP] identifier[AreaViewType] operator[SEP] identifier[viewType] operator[SEP] operator[SEP] identifier[getArea] operator[SEP] operator[SEP] , identifier[view] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[viewType] Keyword[instanceof] identifier[DividerViewType] operator[&&] identifier[view] Keyword[instanceof] identifier[Divider] operator[SEP] {
Keyword[this] operator[SEP] identifier[dividers] operator[SEP] identifier[put] operator[SEP] operator[SEP] operator[SEP] identifier[DividerViewType] operator[SEP] identifier[viewType] operator[SEP] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] , operator[SEP] identifier[Divider] operator[SEP] identifier[view] operator[SEP] operator[SEP]
}
}
identifier[addAreas] operator[SEP] operator[SEP] operator[SEP] identifier[addDividers] operator[SEP] operator[SEP] operator[SEP] identifier[registerScrollLayoutListener] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Collection<TypedDependency> getRoots(Collection<TypedDependency> list) {
Collection<TypedDependency> roots = new ArrayList<TypedDependency>();
// need to see if more than one governor is not listed somewhere as a dependent
// first take all the deps
Collection<TreeGraphNode> deps = new HashSet<TreeGraphNode>();
for (TypedDependency typedDep : list) {
deps.add(typedDep.dep());
}
// go through the list and add typedDependency for which the gov is not a dep
Collection<TreeGraphNode> govs = new HashSet<TreeGraphNode>();
for (TypedDependency typedDep : list) {
TreeGraphNode gov = typedDep.gov();
if (!deps.contains(gov) && !govs.contains(gov)) {
roots.add(typedDep);
}
govs.add(gov);
}
return roots;
} | class class_name[name] begin[{]
method[getRoots, return_type[type[Collection]], modifier[public static], parameter[list]] begin[{]
local_variable[type[Collection], roots]
local_variable[type[Collection], deps]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=dep, postfix_operators=[], prefix_operators=[], qualifier=typedDep, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=deps, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typedDep)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypedDependency, sub_type=None))), label=None)
local_variable[type[Collection], govs]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=gov, postfix_operators=[], prefix_operators=[], qualifier=typedDep, selectors=[], type_arguments=None), name=gov)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeGraphNode, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=gov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=deps, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=gov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=govs, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=typedDep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=roots, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=govs, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typedDep)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypedDependency, sub_type=None))), label=None)
return[member[.roots]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Collection] operator[<] identifier[TypedDependency] operator[>] identifier[getRoots] operator[SEP] identifier[Collection] operator[<] identifier[TypedDependency] operator[>] identifier[list] operator[SEP] {
identifier[Collection] operator[<] identifier[TypedDependency] operator[>] identifier[roots] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TypedDependency] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[TreeGraphNode] operator[>] identifier[deps] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[TreeGraphNode] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TypedDependency] identifier[typedDep] operator[:] identifier[list] operator[SEP] {
identifier[deps] operator[SEP] identifier[add] operator[SEP] identifier[typedDep] operator[SEP] identifier[dep] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collection] operator[<] identifier[TreeGraphNode] operator[>] identifier[govs] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[TreeGraphNode] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TypedDependency] identifier[typedDep] operator[:] identifier[list] operator[SEP] {
identifier[TreeGraphNode] identifier[gov] operator[=] identifier[typedDep] operator[SEP] identifier[gov] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[deps] operator[SEP] identifier[contains] operator[SEP] identifier[gov] operator[SEP] operator[&&] operator[!] identifier[govs] operator[SEP] identifier[contains] operator[SEP] identifier[gov] operator[SEP] operator[SEP] {
identifier[roots] operator[SEP] identifier[add] operator[SEP] identifier[typedDep] operator[SEP] operator[SEP]
}
identifier[govs] operator[SEP] identifier[add] operator[SEP] identifier[gov] operator[SEP] operator[SEP]
}
Keyword[return] identifier[roots] operator[SEP]
}
|
public GSSCredential get(String username,
String passphrase,
int lifetime)
throws MyProxyException {
return get(null, username, passphrase, lifetime);
} | class class_name[name] begin[{]
method[get, return_type[type[GSSCredential]], modifier[public], parameter[username, passphrase, lifetime]] begin[{]
return[call[.get, parameter[literal[null], member[.username], member[.passphrase], member[.lifetime]]]]
end[}]
END[}] | Keyword[public] identifier[GSSCredential] identifier[get] operator[SEP] identifier[String] identifier[username] , identifier[String] identifier[passphrase] , Keyword[int] identifier[lifetime] operator[SEP] Keyword[throws] identifier[MyProxyException] {
Keyword[return] identifier[get] operator[SEP] Other[null] , identifier[username] , identifier[passphrase] , identifier[lifetime] operator[SEP] operator[SEP]
}
|
public static Interval[][] calculateTemporalDistance( Interval[][] constraintMatrix ) {
Interval[][] result = new Interval[constraintMatrix.length][];
for( int i = 0; i < result.length; i++ ) {
result[i] = new Interval[constraintMatrix[i].length];
for( int j = 0; j < result[i].length; j++ ) {
result[i][j] = constraintMatrix[i][j].clone();
}
}
for( int k = 0; k < result.length; k++ ) {
for( int i = 0; i < result.length; i++ ) {
for( int j = 0; j < result.length; j++ ) {
Interval interval = result[i][k].clone();
interval.add( result[k][j] );
result[i][j].intersect( interval);
}
}
}
return result;
} | class class_name[name] begin[{]
method[calculateTemporalDistance, return_type[type[Interval]], modifier[public static], parameter[constraintMatrix]] begin[{]
local_variable[type[Interval], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ArrayCreator(dimensions=[MemberReference(member=constraintMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Interval, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=constraintMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=clone, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=clone, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=interval)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Interval, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=add, postfix_operators=[], prefix_operators=[], qualifier=interval, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=interval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=intersect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, 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)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Interval] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[calculateTemporalDistance] operator[SEP] identifier[Interval] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[constraintMatrix] operator[SEP] {
identifier[Interval] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[Interval] operator[SEP] identifier[constraintMatrix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[Interval] operator[SEP] identifier[constraintMatrix] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[result] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[constraintMatrix] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[0] operator[SEP] identifier[k] operator[<] identifier[result] operator[SEP] identifier[length] operator[SEP] identifier[k] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[result] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[Interval] identifier[interval] operator[=] identifier[result] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[interval] operator[SEP] identifier[add] operator[SEP] identifier[result] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[intersect] operator[SEP] identifier[interval] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static boolean isValid(final String cssValue) {
final String trimmedCssValue = TagStringUtil
.toLowerCase(StringUtil.strip(cssValue));
final String[] cssValueParts = StringUtil.splitBySpace(trimmedCssValue);
if (cssValueParts.length > 2) {
return false;
}
if (PREDEFINED_CONSTANTS.contains(trimmedCssValue)) {
return true;
}
boolean valid = false;
for (final String each : cssValueParts) {
final Object[] lengthValueAndUnit = CssLengthUtil
.getLengthValueAsPremitiveAndUnit(each);
if (lengthValueAndUnit.length != 2) {
return false;
}
valid = true;
}
return valid;
} | class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[public static], parameter[cssValue]] begin[{]
local_variable[type[String], trimmedCssValue]
local_variable[type[String], cssValueParts]
if[binary_operation[member[cssValueParts.length], >, literal[2]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[call[PREDEFINED_CONSTANTS.contains, parameter[member[.trimmedCssValue]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], valid]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=each, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLengthValueAsPremitiveAndUnit, postfix_operators=[], prefix_operators=[], qualifier=CssLengthUtil, selectors=[], type_arguments=None), name=lengthValueAndUnit)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lengthValueAndUnit, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), 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)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=valid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=cssValueParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=each)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.valid]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isValid] operator[SEP] Keyword[final] identifier[String] identifier[cssValue] operator[SEP] {
Keyword[final] identifier[String] identifier[trimmedCssValue] operator[=] identifier[TagStringUtil] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[StringUtil] operator[SEP] identifier[strip] operator[SEP] identifier[cssValue] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[cssValueParts] operator[=] identifier[StringUtil] operator[SEP] identifier[splitBySpace] operator[SEP] identifier[trimmedCssValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cssValueParts] operator[SEP] identifier[length] operator[>] Other[2] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[PREDEFINED_CONSTANTS] operator[SEP] identifier[contains] operator[SEP] identifier[trimmedCssValue] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[valid] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[each] operator[:] identifier[cssValueParts] operator[SEP] {
Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[lengthValueAndUnit] operator[=] identifier[CssLengthUtil] operator[SEP] identifier[getLengthValueAsPremitiveAndUnit] operator[SEP] identifier[each] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lengthValueAndUnit] operator[SEP] identifier[length] operator[!=] Other[2] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[valid] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[valid] operator[SEP]
}
|
public static Properties loadFile(File file) throws IOException {
InputStream input = new FileInputStream(file);
Properties prop = null;
try {
prop = load(input);
} finally {
IOUtils.close(input);
}
return prop;
} | class class_name[name] begin[{]
method[loadFile, return_type[type[Properties]], modifier[public static], parameter[file]] begin[{]
local_variable[type[InputStream], input]
local_variable[type[Properties], prop]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=prop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.prop]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Properties] identifier[loadFile] operator[SEP] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStream] identifier[input] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[Properties] identifier[prop] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[prop] operator[=] identifier[load] operator[SEP] identifier[input] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[IOUtils] operator[SEP] identifier[close] operator[SEP] identifier[input] operator[SEP] operator[SEP]
}
Keyword[return] identifier[prop] operator[SEP]
}
|
private boolean hasExpansionExpressionInArguments()
{
Expression[] args = _expr().getArgs();
if( args == null )
{
return false;
}
for( Expression arg: args )
{
List<IMemberExpansionExpression> l = new ArrayList<>();
if( arg.getContainedParsedElementsByType( IMemberExpansionExpression.class, l ) )
{
for( IMemberExpansionExpression expr: l )
{
if( isInThisNew( expr ) )
{
return true;
}
}
}
List<BeanMethodCallExpression> list = new ArrayList<>();
if( arg.getContainedParsedElementsByType( BeanMethodCallExpression.class, list ) )
{
for( BeanMethodCallExpression expr: list )
{
if( expr.isExpansion() && isInThisNew( expr ) )
{
return true;
}
}
}
}
return false;
} | class class_name[name] begin[{]
method[hasExpansionExpressionInArguments, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
local_variable[type[Expression], args]
if[binary_operation[member[.args], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=l)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IMemberExpansionExpression, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IMemberExpansionExpression, sub_type=None)), MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContainedParsedElementsByType, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInThisNew, 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=expr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IMemberExpansionExpression, sub_type=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=[], dimensions=None, name=ArrayList, sub_type=None)), name=list)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BeanMethodCallExpression, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanMethodCallExpression, sub_type=None)), MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContainedParsedElementsByType, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isExpansion, postfix_operators=[], prefix_operators=[], qualifier=expr, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=expr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInThisNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=expr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanMethodCallExpression, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Expression, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[hasExpansionExpressionInArguments] operator[SEP] operator[SEP] {
identifier[Expression] operator[SEP] operator[SEP] identifier[args] operator[=] identifier[_expr] operator[SEP] operator[SEP] operator[SEP] identifier[getArgs] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[args] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Expression] identifier[arg] operator[:] identifier[args] operator[SEP] {
identifier[List] operator[<] identifier[IMemberExpansionExpression] operator[>] identifier[l] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[arg] operator[SEP] identifier[getContainedParsedElementsByType] operator[SEP] identifier[IMemberExpansionExpression] operator[SEP] Keyword[class] , identifier[l] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[IMemberExpansionExpression] identifier[expr] operator[:] identifier[l] operator[SEP] {
Keyword[if] operator[SEP] identifier[isInThisNew] operator[SEP] identifier[expr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
identifier[List] operator[<] identifier[BeanMethodCallExpression] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[arg] operator[SEP] identifier[getContainedParsedElementsByType] operator[SEP] identifier[BeanMethodCallExpression] operator[SEP] Keyword[class] , identifier[list] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[BeanMethodCallExpression] identifier[expr] operator[:] identifier[list] operator[SEP] {
Keyword[if] operator[SEP] identifier[expr] operator[SEP] identifier[isExpansion] operator[SEP] operator[SEP] operator[&&] identifier[isInThisNew] operator[SEP] identifier[expr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public Matrix[] decompose() {
Matrix[] qrr = super.decompose();
Matrix qr = qrr[0];
Matrix r = qrr[1];
Matrix q = qr.blank();
for (int k = q.columns() - 1; k >= 0; k--) {
q.set(k, k, 1.0);
for (int j = k; j < q.columns(); j++) {
if (Math.abs(qr.get(k, k)) > Matrices.EPS) {
double acc = 0.0;
for (int i = k; i < q.rows(); i++) {
acc += qr.get(i, k) * q.get(i, j);
}
acc = -acc / qr.get(k, k);
for (int i = k; i < q.rows(); i++) {
q.updateAt(i, j, Matrices.asPlusFunction(acc * qr.get(i, k)));
}
}
}
}
for (int i = 0; i < r.rows(); i++) {
for (int j = i + 1; j < r.columns(); j++) {
r.set(i, j, qr.get(i, j));
}
}
return new Matrix[] { q, r };
} | class class_name[name] begin[{]
method[decompose, return_type[type[Matrix]], modifier[public], parameter[]] begin[{]
local_variable[type[Matrix], qrr]
local_variable[type[Matrix], qr]
local_variable[type[Matrix], r]
local_variable[type[Matrix], q]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[], type_arguments=None)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=MemberReference(member=EPS, postfix_operators=[], prefix_operators=[], qualifier=Matrices, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), name=acc)], modifiers=set(), type=BasicType(dimensions=[], name=double)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=acc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=rows, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=acc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=acc, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[], type_arguments=None), operator=/)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=acc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[], type_arguments=None), operator=*)], member=asPlusFunction, postfix_operators=[], prefix_operators=[], qualifier=Matrices, selectors=[], type_arguments=None)], member=updateAt, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=rows, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=columns, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=columns, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=columns, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=rows, postfix_operators=[], prefix_operators=[], qualifier=r, 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[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Matrix, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Matrix] operator[SEP] operator[SEP] identifier[decompose] operator[SEP] operator[SEP] {
identifier[Matrix] operator[SEP] operator[SEP] identifier[qrr] operator[=] Keyword[super] operator[SEP] identifier[decompose] operator[SEP] operator[SEP] operator[SEP] identifier[Matrix] identifier[qr] operator[=] identifier[qrr] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Matrix] identifier[r] operator[=] identifier[qrr] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[Matrix] identifier[q] operator[=] identifier[qr] operator[SEP] identifier[blank] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] identifier[q] operator[SEP] identifier[columns] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[k] operator[>=] Other[0] operator[SEP] identifier[k] operator[--] operator[SEP] {
identifier[q] operator[SEP] identifier[set] operator[SEP] identifier[k] , identifier[k] , literal[Float] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[k] operator[SEP] identifier[j] operator[<] identifier[q] operator[SEP] identifier[columns] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[qr] operator[SEP] identifier[get] operator[SEP] identifier[k] , identifier[k] operator[SEP] operator[SEP] operator[>] identifier[Matrices] operator[SEP] identifier[EPS] operator[SEP] {
Keyword[double] identifier[acc] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[k] operator[SEP] identifier[i] operator[<] identifier[q] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[acc] operator[+=] identifier[qr] operator[SEP] identifier[get] operator[SEP] identifier[i] , identifier[k] operator[SEP] operator[*] identifier[q] operator[SEP] identifier[get] operator[SEP] identifier[i] , identifier[j] operator[SEP] operator[SEP]
}
identifier[acc] operator[=] operator[-] identifier[acc] operator[/] identifier[qr] operator[SEP] identifier[get] operator[SEP] identifier[k] , identifier[k] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[k] operator[SEP] identifier[i] operator[<] identifier[q] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[q] operator[SEP] identifier[updateAt] operator[SEP] identifier[i] , identifier[j] , identifier[Matrices] operator[SEP] identifier[asPlusFunction] operator[SEP] identifier[acc] operator[*] identifier[qr] operator[SEP] identifier[get] operator[SEP] identifier[i] , identifier[k] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[r] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[i] operator[+] Other[1] operator[SEP] identifier[j] operator[<] identifier[r] operator[SEP] identifier[columns] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[r] operator[SEP] identifier[set] operator[SEP] identifier[i] , identifier[j] , identifier[qr] operator[SEP] identifier[get] operator[SEP] identifier[i] , identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[Matrix] operator[SEP] operator[SEP] {
identifier[q] , identifier[r]
} operator[SEP]
}
|
@Deprecated
@SuppressWarnings("unused")
public void operaAction(String using, String... params) {
exec.action(using, params);
} | class class_name[name] begin[{]
method[operaAction, return_type[void], modifier[public], parameter[using, params]] begin[{]
call[exec.action, parameter[member[.using], member[.params]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[operaAction] operator[SEP] identifier[String] identifier[using] , identifier[String] operator[...] identifier[params] operator[SEP] {
identifier[exec] operator[SEP] identifier[action] operator[SEP] identifier[using] , identifier[params] operator[SEP] operator[SEP]
}
|
public void translate(double dx, double dy) {
this.m02 = this.m00 * dx + this.m01 * dy + this.m02;
this.m12 = this.m10 * dx + this.m11 * dy + this.m12;
} | class class_name[name] begin[{]
method[translate, return_type[void], modifier[public], parameter[dx, dy]] begin[{]
assign[THIS[member[None.m02]], binary_operation[binary_operation[binary_operation[THIS[member[None.m00]], *, member[.dx]], +, binary_operation[THIS[member[None.m01]], *, member[.dy]]], +, THIS[member[None.m02]]]]
assign[THIS[member[None.m12]], binary_operation[binary_operation[binary_operation[THIS[member[None.m10]], *, member[.dx]], +, binary_operation[THIS[member[None.m11]], *, member[.dy]]], +, THIS[member[None.m12]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[translate] operator[SEP] Keyword[double] identifier[dx] , Keyword[double] identifier[dy] operator[SEP] {
Keyword[this] operator[SEP] identifier[m02] operator[=] Keyword[this] operator[SEP] identifier[m00] operator[*] identifier[dx] operator[+] Keyword[this] operator[SEP] identifier[m01] operator[*] identifier[dy] operator[+] Keyword[this] operator[SEP] identifier[m02] operator[SEP] Keyword[this] operator[SEP] identifier[m12] operator[=] Keyword[this] operator[SEP] identifier[m10] operator[*] identifier[dx] operator[+] Keyword[this] operator[SEP] identifier[m11] operator[*] identifier[dy] operator[+] Keyword[this] operator[SEP] identifier[m12] operator[SEP]
}
|
public String param(String name){
/*if(name.equals("id")){
return getId();
} else */if (request.getParameter(name) != null) {
return request.getParameter(name);
// }else if(requestContext.getUserSegments().get(name) != null){
// return requestContext.getUserSegments().get(name);
// }else if(requestContext.getWildCardName() != null
// && name.equals(requestContext.getWildCardName())){
// return requestContext.getWildCardValue();
}else{
return getRouteParam(name);
}
} | class class_name[name] begin[{]
method[param, return_type[type[String]], modifier[public], parameter[name]] begin[{]
if[binary_operation[call[request.getParameter, parameter[member[.name]]], !=, literal[null]]] begin[{]
return[call[request.getParameter, parameter[member[.name]]]]
else begin[{]
return[call[.getRouteParam, parameter[member[.name]]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[param] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[name] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[getRouteParam] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
}
|
static ModelNode filterSpecToFilter(final String value) {
final ModelNode filter = new ModelNode(CommonAttributes.FILTER.getName()).setEmptyObject();
final Iterator<String> iterator = tokens(value).iterator();
parseFilterExpression(iterator, filter, true);
return filter;
} | class class_name[name] begin[{]
method[filterSpecToFilter, return_type[type[ModelNode]], modifier[static], parameter[value]] begin[{]
local_variable[type[ModelNode], filter]
local_variable[type[Iterator], iterator]
call[.parseFilterExpression, parameter[member[.iterator], member[.filter], literal[true]]]
return[member[.filter]]
end[}]
END[}] | Keyword[static] identifier[ModelNode] identifier[filterSpecToFilter] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[SEP] {
Keyword[final] identifier[ModelNode] identifier[filter] operator[=] Keyword[new] identifier[ModelNode] operator[SEP] identifier[CommonAttributes] operator[SEP] identifier[FILTER] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setEmptyObject] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[iterator] operator[=] identifier[tokens] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[parseFilterExpression] operator[SEP] identifier[iterator] , identifier[filter] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[filter] operator[SEP]
}
|
public static String canonicalContextPathSpec(String contextPathSpec)
{
// check context path
if (contextPathSpec==null ||
contextPathSpec.indexOf(',')>=0 ||
contextPathSpec.startsWith("*"))
throw new IllegalArgumentException ("Illegal context spec:"+contextPathSpec);
if(!contextPathSpec.startsWith("/"))
contextPathSpec='/'+contextPathSpec;
if (contextPathSpec.length()>1)
{
if (contextPathSpec.endsWith("/"))
contextPathSpec+="*";
else if (!contextPathSpec.endsWith("/*"))
contextPathSpec+="/*";
}
return contextPathSpec;
} | class class_name[name] begin[{]
method[canonicalContextPathSpec, return_type[type[String]], modifier[public static], parameter[contextPathSpec]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.contextPathSpec], ==, literal[null]], ||, binary_operation[call[contextPathSpec.indexOf, parameter[literal[',']]], >=, literal[0]]], ||, call[contextPathSpec.startsWith, parameter[literal["*"]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal context spec:"), operandr=MemberReference(member=contextPathSpec, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[contextPathSpec.startsWith, parameter[literal["/"]]]] begin[{]
assign[member[.contextPathSpec], binary_operation[literal['/'], +, member[.contextPathSpec]]]
else begin[{]
None
end[}]
if[binary_operation[call[contextPathSpec.length, parameter[]], >, literal[1]]] begin[{]
if[call[contextPathSpec.endsWith, parameter[literal["/"]]]] begin[{]
assign[member[.contextPathSpec], literal["*"]]
else begin[{]
if[call[contextPathSpec.endsWith, parameter[literal["/*"]]]] begin[{]
assign[member[.contextPathSpec], literal["/*"]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.contextPathSpec]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[canonicalContextPathSpec] operator[SEP] identifier[String] identifier[contextPathSpec] operator[SEP] {
Keyword[if] operator[SEP] identifier[contextPathSpec] operator[==] Other[null] operator[||] identifier[contextPathSpec] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[||] identifier[contextPathSpec] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[contextPathSpec] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[contextPathSpec] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[contextPathSpec] operator[=] literal[String] operator[+] identifier[contextPathSpec] operator[SEP] Keyword[if] operator[SEP] identifier[contextPathSpec] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[contextPathSpec] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[contextPathSpec] operator[+=] literal[String] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[contextPathSpec] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[contextPathSpec] operator[+=] literal[String] operator[SEP]
}
Keyword[return] identifier[contextPathSpec] operator[SEP]
}
|
public void freeFiltersWithListener(JMessageListener listener)
{
if (m_messageMap != null)
{
for (BaseMessageQueue messageQueue : m_messageMap.values())
{
if (messageQueue != null)
messageQueue.freeFiltersWithListener(listener);
}
}
} | class class_name[name] begin[{]
method[freeFiltersWithListener, return_type[void], modifier[public], parameter[listener]] begin[{]
if[binary_operation[member[.m_messageMap], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=messageQueue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=freeFiltersWithListener, postfix_operators=[], prefix_operators=[], qualifier=messageQueue, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=m_messageMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=messageQueue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseMessageQueue, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[freeFiltersWithListener] operator[SEP] identifier[JMessageListener] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_messageMap] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[BaseMessageQueue] identifier[messageQueue] operator[:] identifier[m_messageMap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[messageQueue] operator[!=] Other[null] operator[SEP] identifier[messageQueue] operator[SEP] identifier[freeFiltersWithListener] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void installProvider(boolean clientSide, List<Object> providers, Set<String> features) {
if (!clientSide) {
if (getAddCustomExceptionMapperFlag(providers))
{
providers.add(new CustomWebApplicationExceptionMapper());
}
}
} | class class_name[name] begin[{]
method[installProvider, return_type[void], modifier[public], parameter[clientSide, providers, features]] begin[{]
if[member[.clientSide]] begin[{]
if[call[.getAddCustomExceptionMapperFlag, parameter[member[.providers]]]] begin[{]
call[providers.add, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CustomWebApplicationExceptionMapper, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[installProvider] operator[SEP] Keyword[boolean] identifier[clientSide] , identifier[List] operator[<] identifier[Object] operator[>] identifier[providers] , identifier[Set] operator[<] identifier[String] operator[>] identifier[features] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[clientSide] operator[SEP] {
Keyword[if] operator[SEP] identifier[getAddCustomExceptionMapperFlag] operator[SEP] identifier[providers] operator[SEP] operator[SEP] {
identifier[providers] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[CustomWebApplicationExceptionMapper] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static base_responses update(nitro_service client, gslbservice resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbservice updateresources[] = new gslbservice[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new gslbservice();
updateresources[i].servicename = resources[i].servicename;
updateresources[i].ipaddress = resources[i].ipaddress;
updateresources[i].publicip = resources[i].publicip;
updateresources[i].publicport = resources[i].publicport;
updateresources[i].cip = resources[i].cip;
updateresources[i].cipheader = resources[i].cipheader;
updateresources[i].sitepersistence = resources[i].sitepersistence;
updateresources[i].siteprefix = resources[i].siteprefix;
updateresources[i].maxclient = resources[i].maxclient;
updateresources[i].healthmonitor = resources[i].healthmonitor;
updateresources[i].maxbandwidth = resources[i].maxbandwidth;
updateresources[i].downstateflush = resources[i].downstateflush;
updateresources[i].maxaaausers = resources[i].maxaaausers;
updateresources[i].viewname = resources[i].viewname;
updateresources[i].viewip = resources[i].viewip;
updateresources[i].monthreshold = resources[i].monthreshold;
updateresources[i].weight = resources[i].weight;
updateresources[i].monitor_name_svc = resources[i].monitor_name_svc;
updateresources[i].hashid = resources[i].hashid;
updateresources[i].comment = resources[i].comment;
updateresources[i].appflowlog = resources[i].appflowlog;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | class class_name[name] begin[{]
method[update, return_type[type[base_responses]], modifier[public static], parameter[client, resources]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.resources], !=, literal[null]], &&, binary_operation[member[resources.length], >, literal[0]]]] begin[{]
local_variable[type[gslbservice], updateresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, 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=gslbservice, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=servicename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=servicename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=ipaddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=ipaddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=publicip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=publicip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=publicport, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=publicport, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=cip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=cip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=cipheader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=cipheader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=sitepersistence, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=sitepersistence, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=siteprefix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=siteprefix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxclient, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxclient, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=healthmonitor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=healthmonitor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxbandwidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxbandwidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=downstateflush, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=downstateflush, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxaaausers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxaaausers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=viewname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=viewname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=viewip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=viewip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=monthreshold, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=monthreshold, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=weight, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=weight, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=monitor_name_svc, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=monitor_name_svc, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=hashid, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=hashid, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=comment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=comment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=appflowlog, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=appflowlog, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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=resources, 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)
assign[member[.result], call[.update_bulk_request, parameter[member[.client], member[.updateresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_responses] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[gslbservice] identifier[resources] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resources] operator[!=] Other[null] operator[&&] identifier[resources] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[gslbservice] identifier[updateresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[gslbservice] operator[SEP] identifier[resources] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[resources] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[gslbservice] operator[SEP] operator[SEP] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[servicename] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[servicename] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[ipaddress] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[ipaddress] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[publicip] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[publicip] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[publicport] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[publicport] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cip] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cip] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cipheader] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cipheader] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sitepersistence] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sitepersistence] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[siteprefix] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[siteprefix] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxclient] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxclient] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[healthmonitor] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[healthmonitor] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxbandwidth] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxbandwidth] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[downstateflush] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[downstateflush] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxaaausers] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxaaausers] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[viewname] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[viewname] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[viewip] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[viewip] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[monthreshold] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[monthreshold] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[weight] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[weight] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[monitor_name_svc] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[monitor_name_svc] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[hashid] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[hashid] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[comment] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[comment] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[appflowlog] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[appflowlog] operator[SEP]
}
identifier[result] operator[=] identifier[update_bulk_request] operator[SEP] identifier[client] , identifier[updateresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
protected <T> List<T> listResources(String path, Class<T> objectClass) throws SmartsheetException {
Util.throwIfNull(path, objectClass);
Util.throwIfEmpty(path);
HttpRequest request;
request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.GET);
List<T> obj = null;
try {
HttpResponse response = this.smartsheet.getHttpClient().request(request);
switch (response.getStatusCode()) {
case 200:
obj = this.smartsheet.getJsonSerializer().deserializeList(objectClass,
response.getEntity().getContent());
break;
default:
handleError(response);
}
} finally {
smartsheet.getHttpClient().releaseConnection();
}
return obj;
} | class class_name[name] begin[{]
method[listResources, return_type[type[List]], modifier[protected], parameter[path, objectClass]] begin[{]
call[Util.throwIfNull, parameter[member[.path], member[.objectClass]]]
call[Util.throwIfEmpty, parameter[member[.path]]]
local_variable[type[HttpRequest], request]
assign[member[.request], call[.createHttpRequest, parameter[call[smartsheet.getBaseURI, parameter[]], member[HttpMethod.GET]]]]
local_variable[type[List], obj]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=smartsheet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getHttpClient, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=request, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpResponse, sub_type=None)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=smartsheet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getJsonSerializer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=objectClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getEntity, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=getContent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=deserializeList, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getHttpClient, postfix_operators=[], prefix_operators=[], qualifier=smartsheet, selectors=[MethodInvocation(arguments=[], member=releaseConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
return[member[.obj]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[listResources] operator[SEP] identifier[String] identifier[path] , identifier[Class] operator[<] identifier[T] operator[>] identifier[objectClass] operator[SEP] Keyword[throws] identifier[SmartsheetException] {
identifier[Util] operator[SEP] identifier[throwIfNull] operator[SEP] identifier[path] , identifier[objectClass] operator[SEP] operator[SEP] identifier[Util] operator[SEP] identifier[throwIfEmpty] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[HttpRequest] identifier[request] operator[SEP] identifier[request] operator[=] identifier[createHttpRequest] operator[SEP] identifier[smartsheet] operator[SEP] identifier[getBaseURI] operator[SEP] operator[SEP] operator[SEP] identifier[resolve] operator[SEP] identifier[path] operator[SEP] , identifier[HttpMethod] operator[SEP] identifier[GET] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[obj] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[HttpResponse] identifier[response] operator[=] Keyword[this] operator[SEP] identifier[smartsheet] operator[SEP] identifier[getHttpClient] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[response] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] Other[200] operator[:] identifier[obj] operator[=] Keyword[this] operator[SEP] identifier[smartsheet] operator[SEP] identifier[getJsonSerializer] operator[SEP] operator[SEP] operator[SEP] identifier[deserializeList] operator[SEP] identifier[objectClass] , identifier[response] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[handleError] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[smartsheet] operator[SEP] identifier[getHttpClient] operator[SEP] operator[SEP] operator[SEP] identifier[releaseConnection] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[obj] operator[SEP]
}
|
@Override
public void classLoaderDestroy(DynamicClassLoader loader)
{
removeLoader(loader);
_localHandlers.remove(loader);
HandlerEntry ownHandlers = _ownHandlers.getLevel(loader);
if (ownHandlers != null)
_ownHandlers.remove(loader);
if (ownHandlers != null)
ownHandlers.destroy();
if (_localLevel != null)
_localLevel.remove(loader);
updateEffectiveLevel(_systemClassLoader);
} | class class_name[name] begin[{]
method[classLoaderDestroy, return_type[void], modifier[public], parameter[loader]] begin[{]
call[.removeLoader, parameter[member[.loader]]]
call[_localHandlers.remove, parameter[member[.loader]]]
local_variable[type[HandlerEntry], ownHandlers]
if[binary_operation[member[.ownHandlers], !=, literal[null]]] begin[{]
call[_ownHandlers.remove, parameter[member[.loader]]]
else begin[{]
None
end[}]
if[binary_operation[member[.ownHandlers], !=, literal[null]]] begin[{]
call[ownHandlers.destroy, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[._localLevel], !=, literal[null]]] begin[{]
call[_localLevel.remove, parameter[member[.loader]]]
else begin[{]
None
end[}]
call[.updateEffectiveLevel, parameter[member[._systemClassLoader]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[classLoaderDestroy] operator[SEP] identifier[DynamicClassLoader] identifier[loader] operator[SEP] {
identifier[removeLoader] operator[SEP] identifier[loader] operator[SEP] operator[SEP] identifier[_localHandlers] operator[SEP] identifier[remove] operator[SEP] identifier[loader] operator[SEP] operator[SEP] identifier[HandlerEntry] identifier[ownHandlers] operator[=] identifier[_ownHandlers] operator[SEP] identifier[getLevel] operator[SEP] identifier[loader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ownHandlers] operator[!=] Other[null] operator[SEP] identifier[_ownHandlers] operator[SEP] identifier[remove] operator[SEP] identifier[loader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ownHandlers] operator[!=] Other[null] operator[SEP] identifier[ownHandlers] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_localLevel] operator[!=] Other[null] operator[SEP] identifier[_localLevel] operator[SEP] identifier[remove] operator[SEP] identifier[loader] operator[SEP] operator[SEP] identifier[updateEffectiveLevel] operator[SEP] identifier[_systemClassLoader] operator[SEP] operator[SEP]
}
|
void patchGlobalScope(TypedScope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
checkState(scriptRoot.isScript());
checkNotNull(globalScope);
checkState(globalScope.isGlobal());
String scriptName = NodeUtil.getSourceName(scriptRoot);
checkNotNull(scriptName);
Predicate<Node> inScript = n -> scriptName.equals(NodeUtil.getSourceName(n));
escapedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
assignedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
functionsWithNonEmptyReturns.removeIf(inScript);
new FirstOrderFunctionAnalyzer().process(null, scriptRoot);
// TODO(bashir): Variable declaration is not the only side effect of last
// global scope generation but here we only wipe that part off.
// Remove all variables that were previously declared in this scripts.
// First find all vars to remove then remove them because of iterator.
List<TypedVar> varsToRemove = new ArrayList<>();
for (TypedVar oldVar : globalScope.getVarIterable()) {
if (scriptName.equals(oldVar.getInputName())) {
varsToRemove.add(oldVar);
}
}
for (TypedVar var : varsToRemove) {
// By removing the type here, we're potentially invalidating any files that contain
// references to this type. Those files will need to be recompiled. Ideally, this
// was handled by the compiler (see b/29121507), but in the meantime users of incremental
// compilation will need to manage it themselves (e.g., by recompiling dependent files
// based on the dep graph).
String typeName = var.getName();
globalScope.undeclare(var);
globalScope.getTypeOfThis().toObjectType().removeProperty(typeName);
if (typeRegistry.getType(globalScope, typeName) != null) {
typeRegistry.removeType(globalScope, typeName);
}
}
// Now re-traverse the given script.
NormalScopeBuilder scopeBuilder = new NormalScopeBuilder(globalScope, null);
NodeTraversal.traverse(compiler, scriptRoot, scopeBuilder);
} | class class_name[name] begin[{]
method[patchGlobalScope, return_type[void], modifier[default], parameter[globalScope, scriptRoot]] begin[{]
call[.checkState, parameter[call[scriptRoot.isScript, parameter[]]]]
call[.checkNotNull, parameter[member[.globalScope]]]
call[.checkState, parameter[call[globalScope.isGlobal, parameter[]]]]
local_variable[type[String], scriptName]
call[.checkNotNull, parameter[member[.scriptName]]]
local_variable[type[Predicate], inScript]
call[escapedVarNames.removeIf, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getScopeRoot, postfix_operators=[], prefix_operators=[], qualifier=var, selectors=[], type_arguments=None)], member=test, postfix_operators=[], prefix_operators=[], qualifier=inScript, selectors=[], type_arguments=None), parameters=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[assignedVarNames.removeIf, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getScopeRoot, postfix_operators=[], prefix_operators=[], qualifier=var, selectors=[], type_arguments=None)], member=test, postfix_operators=[], prefix_operators=[], qualifier=inScript, selectors=[], type_arguments=None), parameters=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[functionsWithNonEmptyReturns.removeIf, parameter[member[.inScript]]]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=scriptRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=process, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=FirstOrderFunctionAnalyzer, sub_type=None))
local_variable[type[List], varsToRemove]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInputName, postfix_operators=[], prefix_operators=[], qualifier=oldVar, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=scriptName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=oldVar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=varsToRemove, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getVarIterable, postfix_operators=[], prefix_operators=[], qualifier=globalScope, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=oldVar)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypedVar, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=var, selectors=[], type_arguments=None), name=typeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=undeclare, postfix_operators=[], prefix_operators=[], qualifier=globalScope, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getTypeOfThis, postfix_operators=[], prefix_operators=[], qualifier=globalScope, selectors=[MethodInvocation(arguments=[], member=toObjectType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeProperty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=globalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=typeRegistry, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=globalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeType, postfix_operators=[], prefix_operators=[], qualifier=typeRegistry, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=varsToRemove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=var)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypedVar, sub_type=None))), label=None)
local_variable[type[NormalScopeBuilder], scopeBuilder]
call[NodeTraversal.traverse, parameter[member[.compiler], member[.scriptRoot], member[.scopeBuilder]]]
end[}]
END[}] | Keyword[void] identifier[patchGlobalScope] operator[SEP] identifier[TypedScope] identifier[globalScope] , identifier[Node] identifier[scriptRoot] operator[SEP] {
identifier[checkState] operator[SEP] identifier[scriptRoot] operator[SEP] identifier[isScript] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[globalScope] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] identifier[globalScope] operator[SEP] identifier[isGlobal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[scriptName] operator[=] identifier[NodeUtil] operator[SEP] identifier[getSourceName] operator[SEP] identifier[scriptRoot] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[scriptName] operator[SEP] operator[SEP] identifier[Predicate] operator[<] identifier[Node] operator[>] identifier[inScript] operator[=] identifier[n] operator[->] identifier[scriptName] operator[SEP] identifier[equals] operator[SEP] identifier[NodeUtil] operator[SEP] identifier[getSourceName] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] identifier[escapedVarNames] operator[SEP] identifier[removeIf] operator[SEP] identifier[var] operator[->] identifier[inScript] operator[SEP] identifier[test] operator[SEP] identifier[var] operator[SEP] identifier[getScopeRoot] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[assignedVarNames] operator[SEP] identifier[removeIf] operator[SEP] identifier[var] operator[->] identifier[inScript] operator[SEP] identifier[test] operator[SEP] identifier[var] operator[SEP] identifier[getScopeRoot] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[functionsWithNonEmptyReturns] operator[SEP] identifier[removeIf] operator[SEP] identifier[inScript] operator[SEP] operator[SEP] Keyword[new] identifier[FirstOrderFunctionAnalyzer] operator[SEP] operator[SEP] operator[SEP] identifier[process] operator[SEP] Other[null] , identifier[scriptRoot] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[TypedVar] operator[>] identifier[varsToRemove] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TypedVar] identifier[oldVar] operator[:] identifier[globalScope] operator[SEP] identifier[getVarIterable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[scriptName] operator[SEP] identifier[equals] operator[SEP] identifier[oldVar] operator[SEP] identifier[getInputName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[varsToRemove] operator[SEP] identifier[add] operator[SEP] identifier[oldVar] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[TypedVar] identifier[var] operator[:] identifier[varsToRemove] operator[SEP] {
identifier[String] identifier[typeName] operator[=] identifier[var] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[globalScope] operator[SEP] identifier[undeclare] operator[SEP] identifier[var] operator[SEP] operator[SEP] identifier[globalScope] operator[SEP] identifier[getTypeOfThis] operator[SEP] operator[SEP] operator[SEP] identifier[toObjectType] operator[SEP] operator[SEP] operator[SEP] identifier[removeProperty] operator[SEP] identifier[typeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeRegistry] operator[SEP] identifier[getType] operator[SEP] identifier[globalScope] , identifier[typeName] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[typeRegistry] operator[SEP] identifier[removeType] operator[SEP] identifier[globalScope] , identifier[typeName] operator[SEP] operator[SEP]
}
}
identifier[NormalScopeBuilder] identifier[scopeBuilder] operator[=] Keyword[new] identifier[NormalScopeBuilder] operator[SEP] identifier[globalScope] , Other[null] operator[SEP] operator[SEP] identifier[NodeTraversal] operator[SEP] identifier[traverse] operator[SEP] identifier[compiler] , identifier[scriptRoot] , identifier[scopeBuilder] operator[SEP] operator[SEP]
}
|
public Actions doubleClick(WebElement target) {
if (isBuildingActions()) {
action.addAction(new DoubleClickAction(jsonMouse, (Locatable) target));
}
return moveInTicks(target, 0, 0)
.clickInTicks(LEFT)
.clickInTicks(LEFT);
} | class class_name[name] begin[{]
method[doubleClick, return_type[type[Actions]], modifier[public], parameter[target]] begin[{]
if[call[.isBuildingActions, parameter[]]] begin[{]
call[action.addAction, parameter[ClassCreator(arguments=[MemberReference(member=jsonMouse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Locatable, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleClickAction, sub_type=None))]]
else begin[{]
None
end[}]
return[call[.moveInTicks, parameter[member[.target], literal[0], literal[0]]]]
end[}]
END[}] | Keyword[public] identifier[Actions] identifier[doubleClick] operator[SEP] identifier[WebElement] identifier[target] operator[SEP] {
Keyword[if] operator[SEP] identifier[isBuildingActions] operator[SEP] operator[SEP] operator[SEP] {
identifier[action] operator[SEP] identifier[addAction] operator[SEP] Keyword[new] identifier[DoubleClickAction] operator[SEP] identifier[jsonMouse] , operator[SEP] identifier[Locatable] operator[SEP] identifier[target] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[moveInTicks] operator[SEP] identifier[target] , Other[0] , Other[0] operator[SEP] operator[SEP] identifier[clickInTicks] operator[SEP] identifier[LEFT] operator[SEP] operator[SEP] identifier[clickInTicks] operator[SEP] identifier[LEFT] operator[SEP] operator[SEP]
}
|
private boolean processQueryEventFilter(EventFilter filter, EntryEventType eventType,
Data dataKey, Object oldValue, Object dataValue, String mapNameOrNull) {
Object testValue;
if (eventType == REMOVED || eventType == EVICTED || eventType == EXPIRED) {
testValue = oldValue;
} else {
testValue = dataValue;
}
return evaluateQueryEventFilter(filter, dataKey, testValue, mapNameOrNull);
} | class class_name[name] begin[{]
method[processQueryEventFilter, return_type[type[boolean]], modifier[private], parameter[filter, eventType, dataKey, oldValue, dataValue, mapNameOrNull]] begin[{]
local_variable[type[Object], testValue]
if[binary_operation[binary_operation[binary_operation[member[.eventType], ==, member[.REMOVED]], ||, binary_operation[member[.eventType], ==, member[.EVICTED]]], ||, binary_operation[member[.eventType], ==, member[.EXPIRED]]]] begin[{]
assign[member[.testValue], member[.oldValue]]
else begin[{]
assign[member[.testValue], member[.dataValue]]
end[}]
return[call[.evaluateQueryEventFilter, parameter[member[.filter], member[.dataKey], member[.testValue], member[.mapNameOrNull]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[processQueryEventFilter] operator[SEP] identifier[EventFilter] identifier[filter] , identifier[EntryEventType] identifier[eventType] , identifier[Data] identifier[dataKey] , identifier[Object] identifier[oldValue] , identifier[Object] identifier[dataValue] , identifier[String] identifier[mapNameOrNull] operator[SEP] {
identifier[Object] identifier[testValue] operator[SEP] Keyword[if] operator[SEP] identifier[eventType] operator[==] identifier[REMOVED] operator[||] identifier[eventType] operator[==] identifier[EVICTED] operator[||] identifier[eventType] operator[==] identifier[EXPIRED] operator[SEP] {
identifier[testValue] operator[=] identifier[oldValue] operator[SEP]
}
Keyword[else] {
identifier[testValue] operator[=] identifier[dataValue] operator[SEP]
}
Keyword[return] identifier[evaluateQueryEventFilter] operator[SEP] identifier[filter] , identifier[dataKey] , identifier[testValue] , identifier[mapNameOrNull] operator[SEP] operator[SEP]
}
|
public Docket genericModelSubstitutes(Class... genericClasses) {
for (Class clz : genericClasses) {
this.ruleBuilders.add(newGenericSubstitutionFunction(clz));
}
return this;
} | class class_name[name] begin[{]
method[genericModelSubstitutes, return_type[type[Docket]], modifier[public], parameter[genericClasses]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ruleBuilders, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=clz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newGenericSubstitutionFunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=genericClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=clz)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Docket] identifier[genericModelSubstitutes] operator[SEP] identifier[Class] operator[...] identifier[genericClasses] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] identifier[clz] operator[:] identifier[genericClasses] operator[SEP] {
Keyword[this] operator[SEP] identifier[ruleBuilders] operator[SEP] identifier[add] operator[SEP] identifier[newGenericSubstitutionFunction] operator[SEP] identifier[clz] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static base_responses restore(nitro_service client, appfwprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwprofile restoreresources[] = new appfwprofile[resources.length];
for (int i=0;i<resources.length;i++){
restoreresources[i] = new appfwprofile();
restoreresources[i].archivename = resources[i].archivename;
}
result = perform_operation_bulk_request(client, restoreresources,"restore");
}
return result;
} | class class_name[name] begin[{]
method[restore, return_type[type[base_responses]], modifier[public static], parameter[client, resources]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.resources], !=, literal[null]], &&, binary_operation[member[resources.length], >, literal[0]]]] begin[{]
local_variable[type[appfwprofile], restoreresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=restoreresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, 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=appfwprofile, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=restoreresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=archivename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=archivename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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=resources, 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)
assign[member[.result], call[.perform_operation_bulk_request, parameter[member[.client], member[.restoreresources], literal["restore"]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_responses] identifier[restore] operator[SEP] identifier[nitro_service] identifier[client] , identifier[appfwprofile] identifier[resources] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resources] operator[!=] Other[null] operator[&&] identifier[resources] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[appfwprofile] identifier[restoreresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[appfwprofile] operator[SEP] identifier[resources] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[resources] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[restoreresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[appfwprofile] operator[SEP] operator[SEP] operator[SEP] identifier[restoreresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[archivename] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[archivename] operator[SEP]
}
identifier[result] operator[=] identifier[perform_operation_bulk_request] operator[SEP] identifier[client] , identifier[restoreresources] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Nullable
private static Matrix getTransformationMatrixFromInvertedExif(final int orientation) {
Matrix matrix = new Matrix();
switch (orientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
default:
return null;
}
return matrix;
} | class class_name[name] begin[{]
method[getTransformationMatrixFromInvertedExif, return_type[type[Matrix]], modifier[private static], parameter[orientation]] begin[{]
local_variable[type[Matrix], matrix]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=ORIENTATION_FLIP_HORIZONTAL, postfix_operators=[], prefix_operators=[], qualifier=ExifInterface, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=setScale, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=ORIENTATION_TRANSVERSE, postfix_operators=[], prefix_operators=[], qualifier=ExifInterface, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=90)], member=setRotate, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=postScale, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=ORIENTATION_FLIP_VERTICAL, postfix_operators=[], prefix_operators=[], qualifier=ExifInterface, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=180)], member=setRotate, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=postScale, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=ORIENTATION_TRANSPOSE, postfix_operators=[], prefix_operators=[], qualifier=ExifInterface, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=90)], member=setRotate, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=postScale, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])], expression=MemberReference(member=orientation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.matrix]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[private] Keyword[static] identifier[Matrix] identifier[getTransformationMatrixFromInvertedExif] operator[SEP] Keyword[final] Keyword[int] identifier[orientation] operator[SEP] {
identifier[Matrix] identifier[matrix] operator[=] Keyword[new] identifier[Matrix] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[orientation] operator[SEP] {
Keyword[case] identifier[ExifInterface] operator[SEP] identifier[ORIENTATION_FLIP_HORIZONTAL] operator[:] identifier[matrix] operator[SEP] identifier[setScale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ExifInterface] operator[SEP] identifier[ORIENTATION_TRANSVERSE] operator[:] identifier[matrix] operator[SEP] identifier[setRotate] operator[SEP] operator[-] Other[90] operator[SEP] operator[SEP] identifier[matrix] operator[SEP] identifier[postScale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ExifInterface] operator[SEP] identifier[ORIENTATION_FLIP_VERTICAL] operator[:] identifier[matrix] operator[SEP] identifier[setRotate] operator[SEP] Other[180] operator[SEP] operator[SEP] identifier[matrix] operator[SEP] identifier[postScale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ExifInterface] operator[SEP] identifier[ORIENTATION_TRANSPOSE] operator[:] identifier[matrix] operator[SEP] identifier[setRotate] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[matrix] operator[SEP] identifier[postScale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[matrix] operator[SEP]
}
|
protected MaterialDnd buildDnd() {
MaterialDnd dnd = MaterialDnd.draggable(this, buildDragOptions());
dnd.ignoreFrom(".content, .window-action");
return dnd;
} | class class_name[name] begin[{]
method[buildDnd, return_type[type[MaterialDnd]], modifier[protected], parameter[]] begin[{]
local_variable[type[MaterialDnd], dnd]
call[dnd.ignoreFrom, parameter[literal[".content, .window-action"]]]
return[member[.dnd]]
end[}]
END[}] | Keyword[protected] identifier[MaterialDnd] identifier[buildDnd] operator[SEP] operator[SEP] {
identifier[MaterialDnd] identifier[dnd] operator[=] identifier[MaterialDnd] operator[SEP] identifier[draggable] operator[SEP] Keyword[this] , identifier[buildDragOptions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[dnd] operator[SEP] identifier[ignoreFrom] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[dnd] operator[SEP]
}
|
public T set(final Properties properties) throws MailException {
checkSessionNotSet();
this.properties.putAll(properties);
return _this();
} | class class_name[name] begin[{]
method[set, return_type[type[T]], modifier[public], parameter[properties]] begin[{]
call[.checkSessionNotSet, parameter[]]
THIS[member[None.properties]call[None.putAll, parameter[member[.properties]]]]
return[call[._this, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[T] identifier[set] operator[SEP] Keyword[final] identifier[Properties] identifier[properties] operator[SEP] Keyword[throws] identifier[MailException] {
identifier[checkSessionNotSet] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[properties] operator[SEP] identifier[putAll] operator[SEP] identifier[properties] operator[SEP] operator[SEP] Keyword[return] identifier[_this] operator[SEP] operator[SEP] operator[SEP]
}
|
protected static void writeSingleEntity(final StringWriter strWriter, final TableEntity entity,
final boolean isTableEntry, final OperationContext opContext) throws StorageException, IOException {
JsonGenerator generator = jsonFactory.createGenerator(strWriter);
try {
// write to stream
writeJsonEntity(generator, entity, isTableEntry, opContext);
}
finally {
generator.close();
}
} | class class_name[name] begin[{]
method[writeSingleEntity, return_type[void], modifier[static protected], parameter[strWriter, entity, isTableEntry, opContext]] begin[{]
local_variable[type[JsonGenerator], generator]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=generator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isTableEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=opContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeJsonEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[void] identifier[writeSingleEntity] operator[SEP] Keyword[final] identifier[StringWriter] identifier[strWriter] , Keyword[final] identifier[TableEntity] identifier[entity] , Keyword[final] Keyword[boolean] identifier[isTableEntry] , Keyword[final] identifier[OperationContext] identifier[opContext] operator[SEP] Keyword[throws] identifier[StorageException] , identifier[IOException] {
identifier[JsonGenerator] identifier[generator] operator[=] identifier[jsonFactory] operator[SEP] identifier[createGenerator] operator[SEP] identifier[strWriter] operator[SEP] operator[SEP] Keyword[try] {
identifier[writeJsonEntity] operator[SEP] identifier[generator] , identifier[entity] , identifier[isTableEntry] , identifier[opContext] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[generator] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private String getSiteTitle(CmsSessionInfo currentSession) {
String siteRoot = currentSession.getSiteRoot();
return (siteRoot.isEmpty() | siteRoot.equals("/"))
? CmsVaadinUtils.getMessageText(org.opencms.ade.galleries.Messages.GUI_ROOT_SITE_0)
: OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot).getTitle();
} | class class_name[name] begin[{]
method[getSiteTitle, return_type[type[String]], modifier[private], parameter[currentSession]] begin[{]
local_variable[type[String], siteRoot]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=siteRoot, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=siteRoot, selectors=[], type_arguments=None), operator=|), if_false=MethodInvocation(arguments=[], member=getSiteManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=siteRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSiteForSiteRoot, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=GUI_ROOT_SITE_0, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.ade.galleries.Messages, selectors=[])], member=getMessageText, postfix_operators=[], prefix_operators=[], qualifier=CmsVaadinUtils, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getSiteTitle] operator[SEP] identifier[CmsSessionInfo] identifier[currentSession] operator[SEP] {
identifier[String] identifier[siteRoot] operator[=] identifier[currentSession] operator[SEP] identifier[getSiteRoot] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[siteRoot] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[|] identifier[siteRoot] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[?] identifier[CmsVaadinUtils] operator[SEP] identifier[getMessageText] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[ade] operator[SEP] identifier[galleries] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_ROOT_SITE_0] operator[SEP] operator[:] identifier[OpenCms] operator[SEP] identifier[getSiteManager] operator[SEP] operator[SEP] operator[SEP] identifier[getSiteForSiteRoot] operator[SEP] identifier[siteRoot] operator[SEP] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public T findUniqueUsingQueryModel(QueryModel queryModel)
throws NoSuchItemException, TooManyItemsException, JeppettoException {
T result;
try {
if (accessControlContextProvider == null
|| accessControlHelper.annotationAllowsAccess(persistentClass, queryModel.getAccessControlContext(), AccessType.Read)) {
// noinspection unchecked
result = (T) buildCriteria(queryModel).uniqueResult();
} else {
// noinspection unchecked
result = (T) createAccessControlledQuery(queryModel).uniqueResult();
}
} catch (NonUniqueObjectException e) {
throw new TooManyItemsException(e.getMessage());
} catch (HibernateException e) {
throw new JeppettoException(e);
}
if (result == null) {
throw new NoSuchItemException(persistentClass.getSimpleName(), queryModel.toString());
}
return result;
} | class class_name[name] begin[{]
method[findUniqueUsingQueryModel, return_type[type[T]], modifier[public], parameter[queryModel]] begin[{]
local_variable[type[T], result]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=accessControlContextProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=persistentClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAccessControlContext, postfix_operators=[], prefix_operators=[], qualifier=queryModel, selectors=[], type_arguments=None), MemberReference(member=Read, postfix_operators=[], prefix_operators=[], qualifier=AccessType, selectors=[])], member=annotationAllowsAccess, postfix_operators=[], prefix_operators=[], qualifier=accessControlHelper, selectors=[], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=queryModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createAccessControlledQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=uniqueResult, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=queryModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildCriteria, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=uniqueResult, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TooManyItemsException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NonUniqueObjectException'])), 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=JeppettoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['HibernateException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=persistentClass, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=queryModel, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchItemException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[findUniqueUsingQueryModel] operator[SEP] identifier[QueryModel] identifier[queryModel] operator[SEP] Keyword[throws] identifier[NoSuchItemException] , identifier[TooManyItemsException] , identifier[JeppettoException] {
identifier[T] identifier[result] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[accessControlContextProvider] operator[==] Other[null] operator[||] identifier[accessControlHelper] operator[SEP] identifier[annotationAllowsAccess] operator[SEP] identifier[persistentClass] , identifier[queryModel] operator[SEP] identifier[getAccessControlContext] operator[SEP] operator[SEP] , identifier[AccessType] operator[SEP] identifier[Read] operator[SEP] operator[SEP] {
identifier[result] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[buildCriteria] operator[SEP] identifier[queryModel] operator[SEP] operator[SEP] identifier[uniqueResult] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[createAccessControlledQuery] operator[SEP] identifier[queryModel] operator[SEP] operator[SEP] identifier[uniqueResult] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NonUniqueObjectException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TooManyItemsException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[HibernateException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JeppettoException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchItemException] operator[SEP] identifier[persistentClass] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[queryModel] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static Integer getDayOfSeason(Date date) {
if (date == null)
return null;
int day = 0;
Date[] seasonDates = getSeasonDate(date);
Calendar c = Calendar.getInstance();
c.setTime(date);
int month = c.get(Calendar.MONTH);
if (month == Calendar.JANUARY || month == Calendar.APRIL || month == Calendar.JULY || month == Calendar.OCTOBER) {// 季度第一个月
day = getDayOfMonth(seasonDates[0]);
} else if (month == Calendar.FEBRUARY || month == Calendar.MAY || month == Calendar.AUGUST || month == Calendar.NOVEMBER) {// 季度第二个月
day = getDayOfMonth(seasonDates[0]) + getDayOfMonth(seasonDates[1]);
} else if (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER || month == Calendar.DECEMBER) {// 季度第三个月
day = getDayOfMonth(seasonDates[0]) + getDayOfMonth(seasonDates[1]) + getDayOfMonth(seasonDates[2]);
}
return day;
} | class class_name[name] begin[{]
method[getDayOfSeason, return_type[type[Integer]], modifier[public static], parameter[date]] begin[{]
if[binary_operation[member[.date], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], day]
local_variable[type[Date], seasonDates]
local_variable[type[Calendar], c]
call[c.setTime, parameter[member[.date]]]
local_variable[type[int], month]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.month], ==, member[Calendar.JANUARY]], ||, binary_operation[member[.month], ==, member[Calendar.APRIL]]], ||, binary_operation[member[.month], ==, member[Calendar.JULY]]], ||, binary_operation[member[.month], ==, member[Calendar.OCTOBER]]]] begin[{]
assign[member[.day], call[.getDayOfMonth, parameter[member[.seasonDates]]]]
else begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.month], ==, member[Calendar.FEBRUARY]], ||, binary_operation[member[.month], ==, member[Calendar.MAY]]], ||, binary_operation[member[.month], ==, member[Calendar.AUGUST]]], ||, binary_operation[member[.month], ==, member[Calendar.NOVEMBER]]]] begin[{]
assign[member[.day], binary_operation[call[.getDayOfMonth, parameter[member[.seasonDates]]], +, call[.getDayOfMonth, parameter[member[.seasonDates]]]]]
else begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.month], ==, member[Calendar.MARCH]], ||, binary_operation[member[.month], ==, member[Calendar.JUNE]]], ||, binary_operation[member[.month], ==, member[Calendar.SEPTEMBER]]], ||, binary_operation[member[.month], ==, member[Calendar.DECEMBER]]]] begin[{]
assign[member[.day], binary_operation[binary_operation[call[.getDayOfMonth, parameter[member[.seasonDates]]], +, call[.getDayOfMonth, parameter[member[.seasonDates]]]], +, call[.getDayOfMonth, parameter[member[.seasonDates]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
return[member[.day]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Integer] identifier[getDayOfSeason] operator[SEP] identifier[Date] identifier[date] operator[SEP] {
Keyword[if] operator[SEP] identifier[date] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[int] identifier[day] operator[=] Other[0] operator[SEP] identifier[Date] operator[SEP] operator[SEP] identifier[seasonDates] operator[=] identifier[getSeasonDate] operator[SEP] identifier[date] operator[SEP] operator[SEP] identifier[Calendar] identifier[c] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[setTime] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[int] identifier[month] operator[=] identifier[c] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[JANUARY] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[APRIL] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[JULY] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[OCTOBER] operator[SEP] {
identifier[day] operator[=] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[FEBRUARY] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[MAY] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[AUGUST] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[NOVEMBER] operator[SEP] {
identifier[day] operator[=] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[+] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[MARCH] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[JUNE] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[SEPTEMBER] operator[||] identifier[month] operator[==] identifier[Calendar] operator[SEP] identifier[DECEMBER] operator[SEP] {
identifier[day] operator[=] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[+] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[+] identifier[getDayOfMonth] operator[SEP] identifier[seasonDates] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[day] operator[SEP]
}
|
public static String getApproximateSize(long size) {
if(size==1) return "1 byte";
if(size<1024) return new StringBuilder().append((int)size).append(" bytes").toString();
String unitName;
long unitSize;
if(size<(1024*1024)) {
unitName=" k";
unitSize=1024;
} else if(size<((long)1024*1024*1024)) {
unitName=" M";
unitSize=1024*1024;
} else if(size<((long)1024*1024*1024*1024)) {
unitName=" G";
unitSize=(long)1024*1024*1024;
} else {
unitName=" T";
unitSize=(long)1024*1024*1024*1024;
}
long whole=size/unitSize;
if(whole<100) {
int fraction=(int)(((size%unitSize)*10)/unitSize);
return new StringBuilder().append(whole).append('.').append(fraction).append(unitName).toString();
} else return new StringBuilder().append(whole).append(unitName).toString();
} | class class_name[name] begin[{]
method[getApproximateSize, return_type[type[String]], modifier[public static], parameter[size]] begin[{]
if[binary_operation[member[.size], ==, literal[1]]] begin[{]
return[literal["1 byte"]]
else begin[{]
None
end[}]
if[binary_operation[member[.size], <, literal[1024]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))], 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=" bytes")], 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))]
else begin[{]
None
end[}]
local_variable[type[String], unitName]
local_variable[type[long], unitSize]
if[binary_operation[member[.size], <, binary_operation[literal[1024], *, literal[1024]]]] begin[{]
assign[member[.unitName], literal[" k"]]
assign[member[.unitSize], literal[1024]]
else begin[{]
if[binary_operation[member[.size], <, binary_operation[binary_operation[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), type=BasicType(dimensions=[], name=long)), *, literal[1024]], *, literal[1024]]]] begin[{]
assign[member[.unitName], literal[" M"]]
assign[member[.unitSize], binary_operation[literal[1024], *, literal[1024]]]
else begin[{]
if[binary_operation[member[.size], <, binary_operation[binary_operation[binary_operation[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), type=BasicType(dimensions=[], name=long)), *, literal[1024]], *, literal[1024]], *, literal[1024]]]] begin[{]
assign[member[.unitName], literal[" G"]]
assign[member[.unitSize], binary_operation[binary_operation[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), type=BasicType(dimensions=[], name=long)), *, literal[1024]], *, literal[1024]]]
else begin[{]
assign[member[.unitName], literal[" T"]]
assign[member[.unitSize], binary_operation[binary_operation[binary_operation[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), type=BasicType(dimensions=[], name=long)), *, literal[1024]], *, literal[1024]], *, literal[1024]]]
end[}]
end[}]
end[}]
local_variable[type[long], whole]
if[binary_operation[member[.whole], <, literal[100]]] begin[{]
local_variable[type[int], fraction]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=whole, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=fraction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=unitName, 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))]
else begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=whole, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=unitName, 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[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getApproximateSize] operator[SEP] Keyword[long] identifier[size] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[==] Other[1] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[<] Other[1024] operator[SEP] Keyword[return] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[unitName] operator[SEP] Keyword[long] identifier[unitSize] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[<] operator[SEP] Other[1024] operator[*] Other[1024] operator[SEP] operator[SEP] {
identifier[unitName] operator[=] literal[String] operator[SEP] identifier[unitSize] operator[=] Other[1024] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[<] operator[SEP] operator[SEP] Keyword[long] operator[SEP] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[SEP] operator[SEP] {
identifier[unitName] operator[=] literal[String] operator[SEP] identifier[unitSize] operator[=] Other[1024] operator[*] Other[1024] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[<] operator[SEP] operator[SEP] Keyword[long] operator[SEP] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[SEP] operator[SEP] {
identifier[unitName] operator[=] literal[String] operator[SEP] identifier[unitSize] operator[=] operator[SEP] Keyword[long] operator[SEP] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[SEP]
}
Keyword[else] {
identifier[unitName] operator[=] literal[String] operator[SEP] identifier[unitSize] operator[=] operator[SEP] Keyword[long] operator[SEP] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[*] Other[1024] operator[SEP]
}
Keyword[long] identifier[whole] operator[=] identifier[size] operator[/] identifier[unitSize] operator[SEP] Keyword[if] operator[SEP] identifier[whole] operator[<] Other[100] operator[SEP] {
Keyword[int] identifier[fraction] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[%] identifier[unitSize] operator[SEP] operator[*] Other[10] operator[SEP] operator[/] identifier[unitSize] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[whole] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fraction] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[unitName] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[return] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[whole] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[unitName] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public String[] list () throws SmbException {
return SmbEnumerationUtil.list(this, "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null);
} | class class_name[name] begin[{]
method[list, return_type[type[String]], modifier[public], parameter[]] begin[{]
return[call[SmbEnumerationUtil.list, parameter[THIS[], literal["*"], binary_operation[binary_operation[member[.ATTR_DIRECTORY], |, member[.ATTR_HIDDEN]], |, member[.ATTR_SYSTEM]], literal[null], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[list] operator[SEP] operator[SEP] Keyword[throws] identifier[SmbException] {
Keyword[return] identifier[SmbEnumerationUtil] operator[SEP] identifier[list] operator[SEP] Keyword[this] , literal[String] , identifier[ATTR_DIRECTORY] operator[|] identifier[ATTR_HIDDEN] operator[|] identifier[ATTR_SYSTEM] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
@Path("/new")
@POST
public Response addRelationship(
@PathParam(RestParam.PID)
String pid,
@QueryParam(RestParam.SUBJECT)
String subject,
@QueryParam(RestParam.PREDICATE)
String predicate,
@QueryParam(RestParam.OBJECT)
String object,
@QueryParam(RestParam.IS_LITERAL)
boolean isLiteral,
@QueryParam(RestParam.DATATYPE)
String datatype,
@QueryParam(RestParam.FLASH)
@DefaultValue("false")
boolean flash) {
Context context = getContext();
try {
if (subject == null) {
// assume the subject is the object as denoted by the pid
subject = PID.toURI(pid);
}
boolean result = m_management.addRelationship(context, subject, predicate, object, isLiteral, datatype);
return Response.ok(Boolean.toString(result)).build(); // needs an entity to not be overridden with a 204
} catch (ServerException e) {
return handleException(e, flash);
}
} | class class_name[name] begin[{]
method[addRelationship, return_type[type[Response]], modifier[public], parameter[pid, subject, predicate, object, isLiteral, datatype, flash]] begin[{]
local_variable[type[Context], context]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=subject, 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=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=pid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=PID, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=predicate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isLiteral, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=datatype, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addRelationship, postfix_operators=[], prefix_operators=[], qualifier=m_management, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None)], member=ok, postfix_operators=[], prefix_operators=[], qualifier=Response, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=flash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ServerException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[POST] Keyword[public] identifier[Response] identifier[addRelationship] operator[SEP] annotation[@] identifier[PathParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[PID] operator[SEP] identifier[String] identifier[pid] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[SUBJECT] operator[SEP] identifier[String] identifier[subject] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[PREDICATE] operator[SEP] identifier[String] identifier[predicate] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[OBJECT] operator[SEP] identifier[String] identifier[object] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[IS_LITERAL] operator[SEP] Keyword[boolean] identifier[isLiteral] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[DATATYPE] operator[SEP] identifier[String] identifier[datatype] , annotation[@] identifier[QueryParam] operator[SEP] identifier[RestParam] operator[SEP] identifier[FLASH] operator[SEP] annotation[@] identifier[DefaultValue] operator[SEP] literal[String] operator[SEP] Keyword[boolean] identifier[flash] operator[SEP] {
identifier[Context] identifier[context] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[subject] operator[==] Other[null] operator[SEP] {
identifier[subject] operator[=] identifier[PID] operator[SEP] identifier[toURI] operator[SEP] identifier[pid] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[result] operator[=] identifier[m_management] operator[SEP] identifier[addRelationship] operator[SEP] identifier[context] , identifier[subject] , identifier[predicate] , identifier[object] , identifier[isLiteral] , identifier[datatype] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[ok] operator[SEP] identifier[Boolean] operator[SEP] identifier[toString] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ServerException] identifier[e] operator[SEP] {
Keyword[return] identifier[handleException] operator[SEP] identifier[e] , identifier[flash] operator[SEP] operator[SEP]
}
}
|
private void jCheckBoxUseDefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxUseDefaultActionPerformed
if(jCheckBoxUseDefault.isSelected()){
pref.put(DisposableOBDAPreferences.USE_DEAFAULT, "true");
cmdFontFamily.setEnabled(false);
}else{
pref.put(DisposableOBDAPreferences.USE_DEAFAULT, "false");
cmdFontFamily.setEnabled(true);
}
} | class class_name[name] begin[{]
method[jCheckBoxUseDefaultActionPerformed, return_type[void], modifier[private], parameter[evt]] begin[{]
if[call[jCheckBoxUseDefault.isSelected, parameter[]]] begin[{]
call[pref.put, parameter[member[DisposableOBDAPreferences.USE_DEAFAULT], literal["true"]]]
call[cmdFontFamily.setEnabled, parameter[literal[false]]]
else begin[{]
call[pref.put, parameter[member[DisposableOBDAPreferences.USE_DEAFAULT], literal["false"]]]
call[cmdFontFamily.setEnabled, parameter[literal[true]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[jCheckBoxUseDefaultActionPerformed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
Keyword[if] operator[SEP] identifier[jCheckBoxUseDefault] operator[SEP] identifier[isSelected] operator[SEP] operator[SEP] operator[SEP] {
identifier[pref] operator[SEP] identifier[put] operator[SEP] identifier[DisposableOBDAPreferences] operator[SEP] identifier[USE_DEAFAULT] , literal[String] operator[SEP] operator[SEP] identifier[cmdFontFamily] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pref] operator[SEP] identifier[put] operator[SEP] identifier[DisposableOBDAPreferences] operator[SEP] identifier[USE_DEAFAULT] , literal[String] operator[SEP] operator[SEP] identifier[cmdFontFamily] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
public static void addValueHashCodeCall(CodeBuilder b,
TypeDesc valueType,
boolean testForNull,
boolean mixIn)
{
LocalVariable value = null;
if (mixIn) {
value = b.createLocalVariable(null, valueType);
b.storeLocal(value);
// Multiply current hashcode by 31 before adding more to it.
b.loadConstant(31);
b.math(Opcode.IMUL);
b.loadLocal(value);
}
switch (valueType.getTypeCode()) {
case TypeDesc.FLOAT_CODE:
b.invokeStatic(TypeDesc.FLOAT.toObjectType(), "floatToIntBits",
TypeDesc.INT, new TypeDesc[]{TypeDesc.FLOAT});
// Fall through
case TypeDesc.INT_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
case TypeDesc.BYTE_CODE:
case TypeDesc.BOOLEAN_CODE:
if (mixIn) {
b.math(Opcode.IADD);
}
break;
case TypeDesc.DOUBLE_CODE:
b.invokeStatic(TypeDesc.DOUBLE.toObjectType(), "doubleToLongBits",
TypeDesc.LONG, new TypeDesc[]{TypeDesc.DOUBLE});
// Fall through
case TypeDesc.LONG_CODE:
b.dup2();
b.loadConstant(32);
b.math(Opcode.LUSHR);
b.math(Opcode.LXOR);
b.convert(TypeDesc.LONG, TypeDesc.INT);
if (mixIn) {
b.math(Opcode.IADD);
}
break;
case TypeDesc.OBJECT_CODE:
default:
if (testForNull) {
if (value == null) {
value = b.createLocalVariable(null, valueType);
b.storeLocal(value);
b.loadLocal(value);
}
}
if (mixIn) {
Label isNull = b.createLabel();
if (testForNull) {
b.ifNullBranch(isNull, true);
b.loadLocal(value);
}
addValueHashCodeCallTo(b, valueType);
b.math(Opcode.IADD);
if (testForNull) {
isNull.setLocation();
}
} else {
Label cont = b.createLabel();
if (testForNull) {
Label notNull = b.createLabel();
b.ifNullBranch(notNull, false);
b.loadConstant(0);
b.branch(cont);
notNull.setLocation();
b.loadLocal(value);
}
addValueHashCodeCallTo(b, valueType);
if (testForNull) {
cont.setLocation();
}
}
break;
}
} | class class_name[name] begin[{]
method[addValueHashCodeCall, return_type[void], modifier[public static], parameter[b, valueType, testForNull, mixIn]] begin[{]
local_variable[type[LocalVariable], value]
if[member[.mixIn]] begin[{]
assign[member[.value], call[b.createLocalVariable, parameter[literal[null], member[.valueType]]]]
call[b.storeLocal, parameter[member[.value]]]
call[b.loadConstant, parameter[literal[31]]]
call[b.math, parameter[member[Opcode.IMUL]]]
call[b.loadLocal, parameter[member[.value]]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=FLOAT_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toObjectType, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc.FLOAT, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="floatToIntBits"), MemberReference(member=INT, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=FLOAT, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeDesc, sub_type=None))], member=invokeStatic, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=INT_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), MemberReference(member=CHAR_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), MemberReference(member=SHORT_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), MemberReference(member=BYTE_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), MemberReference(member=BOOLEAN_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], statements=[IfStatement(condition=MemberReference(member=mixIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=IADD, postfix_operators=[], prefix_operators=[], qualifier=Opcode, selectors=[])], member=math, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=DOUBLE_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toObjectType, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc.DOUBLE, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="doubleToLongBits"), MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeDesc, sub_type=None))], member=invokeStatic, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=LONG_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=dup2, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32)], member=loadConstant, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LUSHR, postfix_operators=[], prefix_operators=[], qualifier=Opcode, selectors=[])], member=math, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LXOR, postfix_operators=[], prefix_operators=[], qualifier=Opcode, selectors=[])], member=math, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[]), MemberReference(member=INT, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=mixIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=IADD, postfix_operators=[], prefix_operators=[], qualifier=Opcode, selectors=[])], member=math, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=OBJECT_CODE, postfix_operators=[], prefix_operators=[], qualifier=TypeDesc, selectors=[])], statements=[IfStatement(condition=MemberReference(member=testForNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[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=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=valueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createLocalVariable, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=storeLocal, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadLocal, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=MemberReference(member=mixIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=createLabel, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), name=cont)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Label, sub_type=None)), IfStatement(condition=MemberReference(member=testForNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=createLabel, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), name=notNull)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Label, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=notNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=ifNullBranch, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=loadConstant, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cont, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=branch, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=setLocation, postfix_operators=[], prefix_operators=[], qualifier=notNull, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadLocal, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=valueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addValueHashCodeCallTo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=testForNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setLocation, postfix_operators=[], prefix_operators=[], qualifier=cont, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=createLabel, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), name=isNull)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Label, sub_type=None)), IfStatement(condition=MemberReference(member=testForNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=isNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=ifNullBranch, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadLocal, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=valueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addValueHashCodeCallTo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=IADD, postfix_operators=[], prefix_operators=[], qualifier=Opcode, selectors=[])], member=math, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=testForNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setLocation, postfix_operators=[], prefix_operators=[], qualifier=isNull, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getTypeCode, postfix_operators=[], prefix_operators=[], qualifier=valueType, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addValueHashCodeCall] operator[SEP] identifier[CodeBuilder] identifier[b] , identifier[TypeDesc] identifier[valueType] , Keyword[boolean] identifier[testForNull] , Keyword[boolean] identifier[mixIn] operator[SEP] {
identifier[LocalVariable] identifier[value] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[mixIn] operator[SEP] {
identifier[value] operator[=] identifier[b] operator[SEP] identifier[createLocalVariable] operator[SEP] Other[null] , identifier[valueType] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[storeLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadConstant] operator[SEP] Other[31] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[IMUL] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[valueType] operator[SEP] identifier[getTypeCode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[TypeDesc] operator[SEP] identifier[FLOAT_CODE] operator[:] identifier[b] operator[SEP] identifier[invokeStatic] operator[SEP] identifier[TypeDesc] operator[SEP] identifier[FLOAT] operator[SEP] identifier[toObjectType] operator[SEP] operator[SEP] , literal[String] , identifier[TypeDesc] operator[SEP] identifier[INT] , Keyword[new] identifier[TypeDesc] operator[SEP] operator[SEP] {
identifier[TypeDesc] operator[SEP] identifier[FLOAT]
} operator[SEP] operator[SEP] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[INT_CODE] operator[:] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[CHAR_CODE] operator[:] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[SHORT_CODE] operator[:] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[BYTE_CODE] operator[:] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[BOOLEAN_CODE] operator[:] Keyword[if] operator[SEP] identifier[mixIn] operator[SEP] {
identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[IADD] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[DOUBLE_CODE] operator[:] identifier[b] operator[SEP] identifier[invokeStatic] operator[SEP] identifier[TypeDesc] operator[SEP] identifier[DOUBLE] operator[SEP] identifier[toObjectType] operator[SEP] operator[SEP] , literal[String] , identifier[TypeDesc] operator[SEP] identifier[LONG] , Keyword[new] identifier[TypeDesc] operator[SEP] operator[SEP] {
identifier[TypeDesc] operator[SEP] identifier[DOUBLE]
} operator[SEP] operator[SEP] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[LONG_CODE] operator[:] identifier[b] operator[SEP] identifier[dup2] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadConstant] operator[SEP] Other[32] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[LUSHR] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[LXOR] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[convert] operator[SEP] identifier[TypeDesc] operator[SEP] identifier[LONG] , identifier[TypeDesc] operator[SEP] identifier[INT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mixIn] operator[SEP] {
identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[IADD] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TypeDesc] operator[SEP] identifier[OBJECT_CODE] operator[:] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[testForNull] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[b] operator[SEP] identifier[createLocalVariable] operator[SEP] Other[null] , identifier[valueType] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[storeLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[mixIn] operator[SEP] {
identifier[Label] identifier[isNull] operator[=] identifier[b] operator[SEP] identifier[createLabel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[testForNull] operator[SEP] {
identifier[b] operator[SEP] identifier[ifNullBranch] operator[SEP] identifier[isNull] , literal[boolean] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
identifier[addValueHashCodeCallTo] operator[SEP] identifier[b] , identifier[valueType] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[math] operator[SEP] identifier[Opcode] operator[SEP] identifier[IADD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[testForNull] operator[SEP] {
identifier[isNull] operator[SEP] identifier[setLocation] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Label] identifier[cont] operator[=] identifier[b] operator[SEP] identifier[createLabel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[testForNull] operator[SEP] {
identifier[Label] identifier[notNull] operator[=] identifier[b] operator[SEP] identifier[createLabel] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[ifNullBranch] operator[SEP] identifier[notNull] , literal[boolean] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadConstant] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[branch] operator[SEP] identifier[cont] operator[SEP] operator[SEP] identifier[notNull] operator[SEP] identifier[setLocation] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadLocal] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
identifier[addValueHashCodeCallTo] operator[SEP] identifier[b] , identifier[valueType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[testForNull] operator[SEP] {
identifier[cont] operator[SEP] identifier[setLocation] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[break] operator[SEP]
}
}
|
public void start(java.awt.Component top, String taskName, int progressMaxCount) {
// create ProgressMonitor
pm = new javax.swing.ProgressMonitor(top, taskName, "", 0, progressMaxCount);
pm.setMillisToDecideToPopup(millisToDecideToPopup);
pm.setMillisToPopup(millisToPopup);
// do task in a seperate, non-event, thread
taskThread = new Thread(task);
taskThread.start();
// create timer, whose events happen on the awt event Thread
ActionListener watcher = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
secs++;
if (pm.isCanceled()) {
task.cancel();
} else {
// indicate progress
String note = task.getNote();
pm.setNote(note == null ? secs + " secs" : note);
int progress = task.getProgress();
pm.setProgress(progress <= 0 ? secs : progress);
}
// need to make sure task acknowledges the cancel; so dont shut down
// until the task is done
if (task.isDone()) {
timer.stop();
pm.close();
// Toolkit.getDefaultToolkit().beep();
if (task.isError()) {
javax.swing.JOptionPane.showMessageDialog(null, task.getErrorMessage());
}
if (task.isSuccess())
fireEvent(new ActionEvent(this, 0, "success"));
else if (task.isError())
fireEvent(new ActionEvent(this, 0, "error"));
else if (task.isCancel())
fireEvent(new ActionEvent(this, 0, "cancel"));
else
fireEvent(new ActionEvent(this, 0, "done"));
}
}
};
timer = new javax.swing.Timer(1000, watcher); // every second
timer.start();
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[top, taskName, progressMaxCount]] begin[{]
assign[member[.pm], ClassCreator(arguments=[MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=progressMaxCount, 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=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProgressMonitor, sub_type=None))))]
call[pm.setMillisToDecideToPopup, parameter[member[.millisToDecideToPopup]]]
call[pm.setMillisToPopup, parameter[member[.millisToPopup]]]
assign[member[.taskThread], ClassCreator(arguments=[MemberReference(member=task, 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=Thread, sub_type=None))]
call[taskThread.start, parameter[]]
local_variable[type[ActionListener], watcher]
assign[member[.timer], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), MemberReference(member=watcher, 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=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=Timer, sub_type=None))))]
call[timer.start, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Component] identifier[top] , identifier[String] identifier[taskName] , Keyword[int] identifier[progressMaxCount] operator[SEP] {
identifier[pm] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[ProgressMonitor] operator[SEP] identifier[top] , identifier[taskName] , literal[String] , Other[0] , identifier[progressMaxCount] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[setMillisToDecideToPopup] operator[SEP] identifier[millisToDecideToPopup] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[setMillisToPopup] operator[SEP] identifier[millisToPopup] operator[SEP] operator[SEP] identifier[taskThread] operator[=] Keyword[new] identifier[Thread] operator[SEP] identifier[task] operator[SEP] operator[SEP] identifier[taskThread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[ActionListener] identifier[watcher] operator[=] Keyword[new] identifier[ActionListener] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[actionPerformed] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
identifier[secs] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[pm] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] {
identifier[task] operator[SEP] identifier[cancel] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[note] operator[=] identifier[task] operator[SEP] identifier[getNote] operator[SEP] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[setNote] operator[SEP] identifier[note] operator[==] Other[null] operator[?] identifier[secs] operator[+] literal[String] operator[:] identifier[note] operator[SEP] operator[SEP] Keyword[int] identifier[progress] operator[=] identifier[task] operator[SEP] identifier[getProgress] operator[SEP] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[setProgress] operator[SEP] identifier[progress] operator[<=] Other[0] operator[?] identifier[secs] operator[:] identifier[progress] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isDone] operator[SEP] operator[SEP] operator[SEP] {
identifier[timer] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isError] operator[SEP] operator[SEP] operator[SEP] {
identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JOptionPane] operator[SEP] identifier[showMessageDialog] operator[SEP] Other[null] , identifier[task] operator[SEP] identifier[getErrorMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[SEP] identifier[fireEvent] operator[SEP] Keyword[new] identifier[ActionEvent] operator[SEP] Keyword[this] , Other[0] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isError] operator[SEP] operator[SEP] operator[SEP] identifier[fireEvent] operator[SEP] Keyword[new] identifier[ActionEvent] operator[SEP] Keyword[this] , Other[0] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isCancel] operator[SEP] operator[SEP] operator[SEP] identifier[fireEvent] operator[SEP] Keyword[new] identifier[ActionEvent] operator[SEP] Keyword[this] , Other[0] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[fireEvent] operator[SEP] Keyword[new] identifier[ActionEvent] operator[SEP] Keyword[this] , Other[0] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] identifier[timer] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[Timer] operator[SEP] Other[1000] , identifier[watcher] operator[SEP] operator[SEP] identifier[timer] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
public LogicalTimestamp incrementAndUpdate(LogicalTimestamp timestamp) {
long nextValue = currentTimestamp.value() + 1;
if (timestamp.value() > nextValue) {
return update(timestamp);
}
return increment();
} | class class_name[name] begin[{]
method[incrementAndUpdate, return_type[type[LogicalTimestamp]], modifier[public], parameter[timestamp]] begin[{]
local_variable[type[long], nextValue]
if[binary_operation[call[timestamp.value, parameter[]], >, member[.nextValue]]] begin[{]
return[call[.update, parameter[member[.timestamp]]]]
else begin[{]
None
end[}]
return[call[.increment, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[LogicalTimestamp] identifier[incrementAndUpdate] operator[SEP] identifier[LogicalTimestamp] identifier[timestamp] operator[SEP] {
Keyword[long] identifier[nextValue] operator[=] identifier[currentTimestamp] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[timestamp] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[>] identifier[nextValue] operator[SEP] {
Keyword[return] identifier[update] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP]
}
Keyword[return] identifier[increment] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Video video = (Video) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = video.getClientId();
boolean idHasBeenRendered=false;
rw.startElement("div", video);
String responsiveStyle = Responsive.getResponsiveStyleClass(video, false);
if (null != responsiveStyle && responsiveStyle.trim().length()>0) {
rw.writeAttribute("class", responsiveStyle, null);
rw.writeAttribute("id", clientId, null);
idHasBeenRendered=true;
}
rw.startElement("video", video);
Tooltip.generateTooltip(context, video, rw);
rw.writeAttribute("src", video.getSrc(), null);
rw.writeAttribute("autoplay", video.isAutoplay(), null);
rw.writeAttribute("controls", video.isControls(), null);
rw.writeAttribute("loop", video.isLoop(), null);
String videoId = clientId;
if (idHasBeenRendered) {
videoId = clientId + "_video";
}
rw.writeAttribute("id", videoId, null);
String style = video.getStyle();
if (null != style) {
rw.writeAttribute("style", style, null);
}
String styleClass = video.getStyleClass();
if (null == styleClass)
styleClass = "";
else
styleClass = " " + styleClass;
Tooltip.generateTooltip(context, video, rw);
rw.writeAttribute("class", styleClass, "class");
// Render Ajax Capabilities
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(FacesContext.getCurrentInstance(), video, rw, false);
rw.endElement("video");
if (null != responsiveStyle && responsiveStyle.trim().length()>0) {
rw.endElement("div");
}
Tooltip.activateTooltips(context, video, videoId);
} | class class_name[name] begin[{]
method[encodeBegin, return_type[void], modifier[public], parameter[context, component]] begin[{]
if[call[component.isRendered, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Video], video]
local_variable[type[ResponseWriter], rw]
local_variable[type[String], clientId]
local_variable[type[boolean], idHasBeenRendered]
call[rw.startElement, parameter[literal["div"], member[.video]]]
local_variable[type[String], responsiveStyle]
if[binary_operation[binary_operation[literal[null], !=, member[.responsiveStyle]], &&, binary_operation[call[responsiveStyle.trim, parameter[]], >, literal[0]]]] begin[{]
call[rw.writeAttribute, parameter[literal["class"], member[.responsiveStyle], literal[null]]]
call[rw.writeAttribute, parameter[literal["id"], member[.clientId], literal[null]]]
assign[member[.idHasBeenRendered], literal[true]]
else begin[{]
None
end[}]
call[rw.startElement, parameter[literal["video"], member[.video]]]
call[Tooltip.generateTooltip, parameter[member[.context], member[.video], member[.rw]]]
call[rw.writeAttribute, parameter[literal["src"], call[video.getSrc, parameter[]], literal[null]]]
call[rw.writeAttribute, parameter[literal["autoplay"], call[video.isAutoplay, parameter[]], literal[null]]]
call[rw.writeAttribute, parameter[literal["controls"], call[video.isControls, parameter[]], literal[null]]]
call[rw.writeAttribute, parameter[literal["loop"], call[video.isLoop, parameter[]], literal[null]]]
local_variable[type[String], videoId]
if[member[.idHasBeenRendered]] begin[{]
assign[member[.videoId], binary_operation[member[.clientId], +, literal["_video"]]]
else begin[{]
None
end[}]
call[rw.writeAttribute, parameter[literal["id"], member[.videoId], literal[null]]]
local_variable[type[String], style]
if[binary_operation[literal[null], !=, member[.style]]] begin[{]
call[rw.writeAttribute, parameter[literal["style"], member[.style], literal[null]]]
else begin[{]
None
end[}]
local_variable[type[String], styleClass]
if[binary_operation[literal[null], ==, member[.styleClass]]] begin[{]
assign[member[.styleClass], literal[""]]
else begin[{]
assign[member[.styleClass], binary_operation[literal[" "], +, member[.styleClass]]]
end[}]
call[Tooltip.generateTooltip, parameter[member[.context], member[.video], member[.rw]]]
call[rw.writeAttribute, parameter[literal["class"], member[.styleClass], literal["class"]]]
call[AJAXRenderer.generateBootsFacesAJAXAndJavaScript, parameter[call[FacesContext.getCurrentInstance, parameter[]], member[.video], member[.rw], literal[false]]]
call[rw.endElement, parameter[literal["video"]]]
if[binary_operation[binary_operation[literal[null], !=, member[.responsiveStyle]], &&, binary_operation[call[responsiveStyle.trim, parameter[]], >, literal[0]]]] begin[{]
call[rw.endElement, parameter[literal["div"]]]
else begin[{]
None
end[}]
call[Tooltip.activateTooltips, parameter[member[.context], member[.video], member[.videoId]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[encodeBegin] operator[SEP] identifier[FacesContext] identifier[context] , identifier[UIComponent] identifier[component] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[component] operator[SEP] identifier[isRendered] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[Video] identifier[video] operator[=] operator[SEP] identifier[Video] operator[SEP] identifier[component] operator[SEP] identifier[ResponseWriter] identifier[rw] operator[=] identifier[context] operator[SEP] identifier[getResponseWriter] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[clientId] operator[=] identifier[video] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[idHasBeenRendered] operator[=] literal[boolean] operator[SEP] identifier[rw] operator[SEP] identifier[startElement] operator[SEP] literal[String] , identifier[video] operator[SEP] operator[SEP] identifier[String] identifier[responsiveStyle] operator[=] identifier[Responsive] operator[SEP] identifier[getResponsiveStyleClass] operator[SEP] identifier[video] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[responsiveStyle] operator[&&] identifier[responsiveStyle] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[responsiveStyle] , Other[null] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[clientId] , Other[null] operator[SEP] operator[SEP] identifier[idHasBeenRendered] operator[=] literal[boolean] operator[SEP]
}
identifier[rw] operator[SEP] identifier[startElement] operator[SEP] literal[String] , identifier[video] operator[SEP] operator[SEP] identifier[Tooltip] operator[SEP] identifier[generateTooltip] operator[SEP] identifier[context] , identifier[video] , identifier[rw] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[video] operator[SEP] identifier[getSrc] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[video] operator[SEP] identifier[isAutoplay] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[video] operator[SEP] identifier[isControls] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[video] operator[SEP] identifier[isLoop] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[String] identifier[videoId] operator[=] identifier[clientId] operator[SEP] Keyword[if] operator[SEP] identifier[idHasBeenRendered] operator[SEP] {
identifier[videoId] operator[=] identifier[clientId] operator[+] literal[String] operator[SEP]
}
identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[videoId] , Other[null] operator[SEP] operator[SEP] identifier[String] identifier[style] operator[=] identifier[video] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[style] operator[SEP] {
identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[style] , Other[null] operator[SEP] operator[SEP]
}
identifier[String] identifier[styleClass] operator[=] identifier[video] operator[SEP] identifier[getStyleClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[styleClass] operator[SEP] identifier[styleClass] operator[=] literal[String] operator[SEP] Keyword[else] identifier[styleClass] operator[=] literal[String] operator[+] identifier[styleClass] operator[SEP] identifier[Tooltip] operator[SEP] identifier[generateTooltip] operator[SEP] identifier[context] , identifier[video] , identifier[rw] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[styleClass] , literal[String] operator[SEP] operator[SEP] identifier[AJAXRenderer] operator[SEP] identifier[generateBootsFacesAJAXAndJavaScript] operator[SEP] identifier[FacesContext] operator[SEP] identifier[getCurrentInstance] operator[SEP] operator[SEP] , identifier[video] , identifier[rw] , literal[boolean] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[endElement] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[responsiveStyle] operator[&&] identifier[responsiveStyle] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[rw] operator[SEP] identifier[endElement] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Tooltip] operator[SEP] identifier[activateTooltips] operator[SEP] identifier[context] , identifier[video] , identifier[videoId] operator[SEP] operator[SEP]
}
|
public static nstimer[] get(nitro_service service) throws Exception{
nstimer obj = new nstimer();
nstimer[] response = (nstimer[])obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[nstimer]], modifier[public static], parameter[service]] begin[{]
local_variable[type[nstimer], obj]
local_variable[type[nstimer], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[nstimer] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[nstimer] identifier[obj] operator[=] Keyword[new] identifier[nstimer] operator[SEP] operator[SEP] operator[SEP] identifier[nstimer] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[nstimer] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
private <T> T nullSafe(T actual, T safe) {
return actual == null ? safe : actual;
} | class class_name[name] begin[{]
method[nullSafe, return_type[type[T]], modifier[private], parameter[actual, safe]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=safe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[T] identifier[nullSafe] operator[SEP] identifier[T] identifier[actual] , identifier[T] identifier[safe] operator[SEP] {
Keyword[return] identifier[actual] operator[==] Other[null] operator[?] identifier[safe] operator[:] identifier[actual] operator[SEP]
}
|
private static DateFormat get(int dateStyle, int timeStyle, ULocale loc, Calendar cal) {
if((timeStyle != DateFormat.NONE && (timeStyle & RELATIVE)>0) ||
(dateStyle != DateFormat.NONE && (dateStyle & RELATIVE)>0)) {
RelativeDateFormat r = new RelativeDateFormat(timeStyle, dateStyle /* offset? */, loc, cal);
return r;
}
if (timeStyle < DateFormat.NONE || timeStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal time style " + timeStyle);
}
if (dateStyle < DateFormat.NONE || dateStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal date style " + dateStyle);
}
if (cal == null) {
cal = Calendar.getInstance(loc);
}
try {
DateFormat result = cal.getDateTimeFormat(dateStyle, timeStyle, loc);
result.setLocale(cal.getLocale(ULocale.VALID_LOCALE),
cal.getLocale(ULocale.ACTUAL_LOCALE));
return result;
} catch (MissingResourceException e) {
///CLOVER:OFF
// coverage requires separate run with no data, so skip
return new SimpleDateFormat("M/d/yy h:mm a");
///CLOVER:ON
}
} | class class_name[name] begin[{]
method[get, return_type[type[DateFormat]], modifier[private static], parameter[dateStyle, timeStyle, loc, cal]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.timeStyle], !=, member[DateFormat.NONE]], &&, binary_operation[binary_operation[member[.timeStyle], &, member[.RELATIVE]], >, literal[0]]], ||, binary_operation[binary_operation[member[.dateStyle], !=, member[DateFormat.NONE]], &&, binary_operation[binary_operation[member[.dateStyle], &, member[.RELATIVE]], >, literal[0]]]]] begin[{]
local_variable[type[RelativeDateFormat], r]
return[member[.r]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.timeStyle], <, member[DateFormat.NONE]], ||, binary_operation[member[.timeStyle], >, member[DateFormat.SHORT]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal time style "), operandr=MemberReference(member=timeStyle, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.dateStyle], <, member[DateFormat.NONE]], ||, binary_operation[member[.dateStyle], >, member[DateFormat.SHORT]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal date style "), operandr=MemberReference(member=dateStyle, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.cal], ==, literal[null]]] begin[{]
assign[member[.cal], call[Calendar.getInstance, parameter[member[.loc]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dateStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=loc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateTimeFormat, postfix_operators=[], prefix_operators=[], qualifier=cal, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateFormat, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=VALID_LOCALE, postfix_operators=[], prefix_operators=[], qualifier=ULocale, selectors=[])], member=getLocale, postfix_operators=[], prefix_operators=[], qualifier=cal, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ACTUAL_LOCALE, postfix_operators=[], prefix_operators=[], qualifier=ULocale, selectors=[])], member=getLocale, postfix_operators=[], prefix_operators=[], qualifier=cal, selectors=[], type_arguments=None)], member=setLocale, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="M/d/yy h:mm a")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleDateFormat, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MissingResourceException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[DateFormat] identifier[get] operator[SEP] Keyword[int] identifier[dateStyle] , Keyword[int] identifier[timeStyle] , identifier[ULocale] identifier[loc] , identifier[Calendar] identifier[cal] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[timeStyle] operator[!=] identifier[DateFormat] operator[SEP] identifier[NONE] operator[&&] operator[SEP] identifier[timeStyle] operator[&] identifier[RELATIVE] operator[SEP] operator[>] Other[0] operator[SEP] operator[||] operator[SEP] identifier[dateStyle] operator[!=] identifier[DateFormat] operator[SEP] identifier[NONE] operator[&&] operator[SEP] identifier[dateStyle] operator[&] identifier[RELATIVE] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
identifier[RelativeDateFormat] identifier[r] operator[=] Keyword[new] identifier[RelativeDateFormat] operator[SEP] identifier[timeStyle] , identifier[dateStyle] , identifier[loc] , identifier[cal] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
Keyword[if] operator[SEP] identifier[timeStyle] operator[<] identifier[DateFormat] operator[SEP] identifier[NONE] operator[||] identifier[timeStyle] operator[>] identifier[DateFormat] operator[SEP] identifier[SHORT] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[timeStyle] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dateStyle] operator[<] identifier[DateFormat] operator[SEP] identifier[NONE] operator[||] identifier[dateStyle] operator[>] identifier[DateFormat] operator[SEP] identifier[SHORT] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[dateStyle] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cal] operator[==] Other[null] operator[SEP] {
identifier[cal] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] identifier[loc] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[DateFormat] identifier[result] operator[=] identifier[cal] operator[SEP] identifier[getDateTimeFormat] operator[SEP] identifier[dateStyle] , identifier[timeStyle] , identifier[loc] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setLocale] operator[SEP] identifier[cal] operator[SEP] identifier[getLocale] operator[SEP] identifier[ULocale] operator[SEP] identifier[VALID_LOCALE] operator[SEP] , identifier[cal] operator[SEP] identifier[getLocale] operator[SEP] identifier[ULocale] operator[SEP] identifier[ACTUAL_LOCALE] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MissingResourceException] identifier[e] operator[SEP] {
Keyword[return] Keyword[new] identifier[SimpleDateFormat] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public boolean isOutDated(boolean checkClass) {
String jsp = ctxt.getJspFile();
if (jsw != null
&& (ctxt.getOptions().getModificationTestInterval() > 0)) {
if (jsw.getLastModificationTest()
+ (ctxt.getOptions().getModificationTestInterval() * 1000)
> System.currentTimeMillis()) {
return false;
} else {
jsw.setLastModificationTest(System.currentTimeMillis());
}
}
long jspRealLastModified = 0;
// START PWC 6468930
File targetFile;
if (checkClass) {
targetFile = new File(ctxt.getClassFileName());
} else {
targetFile = new File(ctxt.getServletJavaFileName());
}
// Get the target file's last modified time. File.lastModified()
// returns 0 if the file does not exist.
long targetLastModified = targetFile.lastModified();
// Check cached class file
if (checkClass) {
JspRuntimeContext rtctxt = ctxt.getRuntimeContext();
String className = ctxt.getFullClassName();
long cachedTime = rtctxt.getBytecodeBirthTime(className);
if (cachedTime > targetLastModified) {
targetLastModified = cachedTime;
} else {
// Remove from cache, since the bytecodes from the file is more
// current, so that JasperLoader won't load the cached version
rtctxt.setBytecode(className, null);
}
}
if (targetLastModified == 0L)
return true;
// Check if the jsp exists in the filesystem (instead of a jar
// or a remote location). If yes, then do a File.lastModified()
// to determine its last modified time. This is more performant
// (fewer stat calls) than the ctxt.getResource() followed by
// openConnection(). However, it only works for file system jsps.
// If the file has indeed changed, then need to call URL.OpenConnection()
// so that the cache loads the latest jsp file
if (jsw != null) {
File jspFile = jsw.getJspFile();
if (jspFile != null) {
jspRealLastModified = jspFile.lastModified();
}
}
if (jspRealLastModified == 0 ||
targetLastModified < jspRealLastModified) {
// END PWC 6468930
try {
URL jspUrl = ctxt.getResource(jsp);
if (jspUrl == null) {
ctxt.incrementRemoved();
return false;
}
URLConnection uc = jspUrl.openConnection();
if (uc instanceof JarURLConnection) {
jspRealLastModified =
((JarURLConnection) uc).getJarEntry().getTime();
} else {
jspRealLastModified = uc.getLastModified();
}
uc.getInputStream().close();
} catch (Exception e) {
e.printStackTrace();
return true;
}
// START PWC 6468930
}
// END PWC 6468930
/* PWC 6468930
long targetLastModified = 0;
File targetFile;
if( checkClass ) {
targetFile = new File(ctxt.getClassFileName());
} else {
targetFile = new File(ctxt.getServletJavaFileName());
}
if (!targetFile.exists()) {
return true;
}
targetLastModified = targetFile.lastModified();
*/
if (checkClass && jsw != null) {
jsw.setServletClassLastModifiedTime(targetLastModified);
}
if (targetLastModified < jspRealLastModified) {
// Remember JSP mod time
jspModTime = jspRealLastModified;
if( log.isLoggable(Level.FINE) ) {
log.fine("Compiler: outdated: " + targetFile + " " +
targetLastModified );
}
return true;
}
// determine if source dependent files (e.g. includes using include
// directives) have been changed.
if( jsw==null ) {
return false;
}
List<String> depends = jsw.getDependants();
if (depends == null) {
return false;
}
for (String include: depends) {
try {
URL includeUrl = ctxt.getResource(include);
if (includeUrl == null) {
return true;
}
URLConnection includeUconn = includeUrl.openConnection();
long includeLastModified = 0;
if (includeUconn instanceof JarURLConnection) {
includeLastModified =
((JarURLConnection)includeUconn).getJarEntry().getTime();
} else {
includeLastModified = includeUconn.getLastModified();
}
includeUconn.getInputStream().close();
if (includeLastModified > targetLastModified) {
// START GlassFish 750
if (include.endsWith(".tld")) {
ctxt.clearTaglibs();
ctxt.clearTagFileJarUrls();
}
// END GlassFish 750
return true;
}
} catch (Exception e) {
e.printStackTrace();
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[isOutDated, return_type[type[boolean]], modifier[public], parameter[checkClass]] begin[{]
local_variable[type[String], jsp]
if[binary_operation[binary_operation[member[.jsw], !=, literal[null]], &&, binary_operation[call[ctxt.getOptions, parameter[]], >, literal[0]]]] begin[{]
if[binary_operation[binary_operation[call[jsw.getLastModificationTest, parameter[]], +, binary_operation[call[ctxt.getOptions, parameter[]], *, literal[1000]]], >, call[System.currentTimeMillis, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
call[jsw.setLastModificationTest, parameter[call[System.currentTimeMillis, parameter[]]]]
end[}]
else begin[{]
None
end[}]
local_variable[type[long], jspRealLastModified]
local_variable[type[File], targetFile]
if[member[.checkClass]] begin[{]
assign[member[.targetFile], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getClassFileName, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]
else begin[{]
assign[member[.targetFile], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getServletJavaFileName, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]
end[}]
local_variable[type[long], targetLastModified]
if[member[.checkClass]] begin[{]
local_variable[type[JspRuntimeContext], rtctxt]
local_variable[type[String], className]
local_variable[type[long], cachedTime]
if[binary_operation[member[.cachedTime], >, member[.targetLastModified]]] begin[{]
assign[member[.targetLastModified], member[.cachedTime]]
else begin[{]
call[rtctxt.setBytecode, parameter[member[.className], literal[null]]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.targetLastModified], ==, literal[0L]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.jsw], !=, literal[null]]] begin[{]
local_variable[type[File], jspFile]
if[binary_operation[member[.jspFile], !=, literal[null]]] begin[{]
assign[member[.jspRealLastModified], call[jspFile.lastModified, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.jspRealLastModified], ==, literal[0]], ||, binary_operation[member[.targetLastModified], <, member[.jspRealLastModified]]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=jsp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None), name=jspUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jspUrl, 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=incrementRemoved, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=jspUrl, selectors=[], type_arguments=None), name=uc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URLConnection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=uc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jspRealLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLastModified, postfix_operators=[], prefix_operators=[], qualifier=uc, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jspRealLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=uc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=uc, selectors=[MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.checkClass], &&, binary_operation[member[.jsw], !=, literal[null]]]] begin[{]
call[jsw.setServletClassLastModifiedTime, parameter[member[.targetLastModified]]]
else begin[{]
None
end[}]
if[binary_operation[member[.targetLastModified], <, member[.jspRealLastModified]]] begin[{]
assign[member[.jspModTime], member[.jspRealLastModified]]
if[call[log.isLoggable, parameter[member[Level.FINE]]]] begin[{]
call[log.fine, parameter[binary_operation[binary_operation[binary_operation[literal["Compiler: outdated: "], +, member[.targetFile]], +, literal[" "]], +, member[.targetLastModified]]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.jsw], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[List], depends]
if[binary_operation[member[.depends], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=include, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None), name=includeUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=includeUrl, selectors=[], type_arguments=None), name=includeUconn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URLConnection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=includeLastModified)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeUconn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=includeLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLastModified, postfix_operators=[], prefix_operators=[], qualifier=includeUconn, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=includeLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=includeUconn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=includeUconn, selectors=[MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=targetLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".tld")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=include, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearTaglibs, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clearTagFileJarUrls, postfix_operators=[], prefix_operators=[], qualifier=ctxt, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=depends, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=include)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isOutDated] operator[SEP] Keyword[boolean] identifier[checkClass] operator[SEP] {
identifier[String] identifier[jsp] operator[=] identifier[ctxt] operator[SEP] identifier[getJspFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsw] operator[!=] Other[null] operator[&&] operator[SEP] identifier[ctxt] operator[SEP] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] identifier[getModificationTestInterval] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[jsw] operator[SEP] identifier[getLastModificationTest] operator[SEP] operator[SEP] operator[+] operator[SEP] identifier[ctxt] operator[SEP] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] identifier[getModificationTestInterval] operator[SEP] operator[SEP] operator[*] Other[1000] operator[SEP] operator[>] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[jsw] operator[SEP] identifier[setLastModificationTest] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[long] identifier[jspRealLastModified] operator[=] Other[0] operator[SEP] identifier[File] identifier[targetFile] operator[SEP] Keyword[if] operator[SEP] identifier[checkClass] operator[SEP] {
identifier[targetFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[ctxt] operator[SEP] identifier[getClassFileName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[targetFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[ctxt] operator[SEP] identifier[getServletJavaFileName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[long] identifier[targetLastModified] operator[=] identifier[targetFile] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[checkClass] operator[SEP] {
identifier[JspRuntimeContext] identifier[rtctxt] operator[=] identifier[ctxt] operator[SEP] identifier[getRuntimeContext] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[className] operator[=] identifier[ctxt] operator[SEP] identifier[getFullClassName] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[cachedTime] operator[=] identifier[rtctxt] operator[SEP] identifier[getBytecodeBirthTime] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cachedTime] operator[>] identifier[targetLastModified] operator[SEP] {
identifier[targetLastModified] operator[=] identifier[cachedTime] operator[SEP]
}
Keyword[else] {
identifier[rtctxt] operator[SEP] identifier[setBytecode] operator[SEP] identifier[className] , Other[null] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[targetLastModified] operator[==] Other[0L] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[jsw] operator[!=] Other[null] operator[SEP] {
identifier[File] identifier[jspFile] operator[=] identifier[jsw] operator[SEP] identifier[getJspFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jspFile] operator[!=] Other[null] operator[SEP] {
identifier[jspRealLastModified] operator[=] identifier[jspFile] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[jspRealLastModified] operator[==] Other[0] operator[||] identifier[targetLastModified] operator[<] identifier[jspRealLastModified] operator[SEP] {
Keyword[try] {
identifier[URL] identifier[jspUrl] operator[=] identifier[ctxt] operator[SEP] identifier[getResource] operator[SEP] identifier[jsp] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jspUrl] operator[==] Other[null] operator[SEP] {
identifier[ctxt] operator[SEP] identifier[incrementRemoved] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[URLConnection] identifier[uc] operator[=] identifier[jspUrl] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uc] Keyword[instanceof] identifier[JarURLConnection] operator[SEP] {
identifier[jspRealLastModified] operator[=] operator[SEP] operator[SEP] identifier[JarURLConnection] operator[SEP] identifier[uc] operator[SEP] operator[SEP] identifier[getJarEntry] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[jspRealLastModified] operator[=] identifier[uc] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[SEP]
}
identifier[uc] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] identifier[close] 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] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[checkClass] operator[&&] identifier[jsw] operator[!=] Other[null] operator[SEP] {
identifier[jsw] operator[SEP] identifier[setServletClassLastModifiedTime] operator[SEP] identifier[targetLastModified] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetLastModified] operator[<] identifier[jspRealLastModified] operator[SEP] {
identifier[jspModTime] operator[=] identifier[jspRealLastModified] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[targetFile] operator[+] literal[String] operator[+] identifier[targetLastModified] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jsw] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[List] operator[<] identifier[String] operator[>] identifier[depends] operator[=] identifier[jsw] operator[SEP] identifier[getDependants] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[depends] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[include] operator[:] identifier[depends] operator[SEP] {
Keyword[try] {
identifier[URL] identifier[includeUrl] operator[=] identifier[ctxt] operator[SEP] identifier[getResource] operator[SEP] identifier[include] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[includeUrl] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[URLConnection] identifier[includeUconn] operator[=] identifier[includeUrl] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[includeLastModified] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[includeUconn] Keyword[instanceof] identifier[JarURLConnection] operator[SEP] {
identifier[includeLastModified] operator[=] operator[SEP] operator[SEP] identifier[JarURLConnection] operator[SEP] identifier[includeUconn] operator[SEP] operator[SEP] identifier[getJarEntry] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[includeLastModified] operator[=] identifier[includeUconn] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[SEP]
}
identifier[includeUconn] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[includeLastModified] operator[>] identifier[targetLastModified] operator[SEP] {
Keyword[if] operator[SEP] identifier[include] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[ctxt] operator[SEP] identifier[clearTaglibs] operator[SEP] operator[SEP] operator[SEP] identifier[ctxt] operator[SEP] identifier[clearTagFileJarUrls] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private DefaultSipApplicationRouterInfo getFirstRequestApplicationEntry(
List<? extends SipApplicationRouterInfo> defaultSipApplicationRouterInfoList, SipServletRequest initialRequest) {
SipSession sipSession = initialRequest.getSession(false);
if (sipSession != null) {
String appName = sipSession.getApplicationSession().getApplicationName();
Iterator<? extends SipApplicationRouterInfo> iterator = defaultSipApplicationRouterInfoList.iterator();
while (iterator.hasNext()) {
DefaultSipApplicationRouterInfo next = (DefaultSipApplicationRouterInfo) iterator.next();
if (next.getApplicationName().equals(appName))
return next;
}
}
return null;
} | class class_name[name] begin[{]
method[getFirstRequestApplicationEntry, return_type[type[DefaultSipApplicationRouterInfo]], modifier[private], parameter[defaultSipApplicationRouterInfoList, initialRequest]] begin[{]
local_variable[type[SipSession], sipSession]
if[binary_operation[member[.sipSession], !=, literal[null]]] begin[{]
local_variable[type[String], appName]
local_variable[type[Iterator], iterator]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[DefaultSipApplicationRouterInfo], next]
if[call[next.getApplicationName, parameter[]]] begin[{]
return[member[.next]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[DefaultSipApplicationRouterInfo] identifier[getFirstRequestApplicationEntry] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[SipApplicationRouterInfo] operator[>] identifier[defaultSipApplicationRouterInfoList] , identifier[SipServletRequest] identifier[initialRequest] operator[SEP] {
identifier[SipSession] identifier[sipSession] operator[=] identifier[initialRequest] operator[SEP] identifier[getSession] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sipSession] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[appName] operator[=] identifier[sipSession] operator[SEP] identifier[getApplicationSession] operator[SEP] operator[SEP] operator[SEP] identifier[getApplicationName] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] operator[?] Keyword[extends] identifier[SipApplicationRouterInfo] operator[>] identifier[iterator] operator[=] identifier[defaultSipApplicationRouterInfoList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[DefaultSipApplicationRouterInfo] identifier[next] operator[=] operator[SEP] identifier[DefaultSipApplicationRouterInfo] operator[SEP] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[SEP] identifier[getApplicationName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[appName] operator[SEP] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static void illegalCode(Exception e, String methodName, String className){
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointer,methodName,className,e.getClass().getSimpleName(),""+e.getMessage()));
} | class class_name[name] begin[{]
method[illegalCode, return_type[void], modifier[public static], parameter[e, methodName, className]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=nullPointer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=message, postfix_operators=[], prefix_operators=[], qualifier=MSG.INSTANCE, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalCodeException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[illegalCode] operator[SEP] identifier[Exception] identifier[e] , identifier[String] identifier[methodName] , identifier[String] identifier[className] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalCodeException] operator[SEP] identifier[MSG] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[message] operator[SEP] identifier[nullPointer] , identifier[methodName] , identifier[className] , identifier[e] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void decode(FacesContext context, UIComponent component) {
Gyroscope gyroscope = (Gyroscope) component;
if (gyroscope.isDisabled()) {
return;
}
decodeBehaviors(context, gyroscope);
String clientId = gyroscope.getClientId(context);
// String submittedAlpha = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".alpha");
// String submittedBeta = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".beta");
// String submittedGamma = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".gamma");
new AJAXRenderer().decode(context, component, clientId);
} | class class_name[name] begin[{]
method[decode, return_type[void], modifier[public], parameter[context, component]] begin[{]
local_variable[type[Gyroscope], gyroscope]
if[call[gyroscope.isDisabled, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.decodeBehaviors, parameter[member[.context], member[.gyroscope]]]
local_variable[type[String], clientId]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clientId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=AJAXRenderer, sub_type=None))
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[decode] operator[SEP] identifier[FacesContext] identifier[context] , identifier[UIComponent] identifier[component] operator[SEP] {
identifier[Gyroscope] identifier[gyroscope] operator[=] operator[SEP] identifier[Gyroscope] operator[SEP] identifier[component] operator[SEP] Keyword[if] operator[SEP] identifier[gyroscope] operator[SEP] identifier[isDisabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[decodeBehaviors] operator[SEP] identifier[context] , identifier[gyroscope] operator[SEP] operator[SEP] identifier[String] identifier[clientId] operator[=] identifier[gyroscope] operator[SEP] identifier[getClientId] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[new] identifier[AJAXRenderer] operator[SEP] operator[SEP] operator[SEP] identifier[decode] operator[SEP] identifier[context] , identifier[component] , identifier[clientId] operator[SEP] operator[SEP]
}
|
public static ByteBuffer decodeMOVPacket(ByteBuffer result, AvcCBox avcC) {
if (avcC.getNalLengthSize() == 4) {
decodeMOVPacketInplace(result, avcC);
return result;
}
return joinNALUnits(splitMOVPacket(result, avcC));
} | class class_name[name] begin[{]
method[decodeMOVPacket, return_type[type[ByteBuffer]], modifier[public static], parameter[result, avcC]] begin[{]
if[binary_operation[call[avcC.getNalLengthSize, parameter[]], ==, literal[4]]] begin[{]
call[.decodeMOVPacketInplace, parameter[member[.result], member[.avcC]]]
return[member[.result]]
else begin[{]
None
end[}]
return[call[.joinNALUnits, parameter[call[.splitMOVPacket, parameter[member[.result], member[.avcC]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ByteBuffer] identifier[decodeMOVPacket] operator[SEP] identifier[ByteBuffer] identifier[result] , identifier[AvcCBox] identifier[avcC] operator[SEP] {
Keyword[if] operator[SEP] identifier[avcC] operator[SEP] identifier[getNalLengthSize] operator[SEP] operator[SEP] operator[==] Other[4] operator[SEP] {
identifier[decodeMOVPacketInplace] operator[SEP] identifier[result] , identifier[avcC] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[return] identifier[joinNALUnits] operator[SEP] identifier[splitMOVPacket] operator[SEP] identifier[result] , identifier[avcC] operator[SEP] operator[SEP] operator[SEP]
}
|
public void complete(NetworkConnection vc, IOWriteRequestContext wctx) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "complete", new Object[] {vc, wctx});
if (connection.isLoggingIOEvents()) connection.getConnectionEventRecorder().logDebug("complete method invoked on write context "+System.identityHashCode(wctx));
try {
doWork(true);
} catch(SIConnectionDroppedException connectionDroppedException) {
// No FFDC code needed
// This has been thrown because the priority queue was purged (most likely on another thread).
// The exception is thrown to prevent threads in this method looping forever or hanging if the
// conneciton is invalidate on another thread. Therefore we simply swallow this exception and
// allow the thread to exit this method.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Caught SIConnectionDroppedException, Priority Queue has been purged");
} catch(Error error) {
FFDCFilter.processException
(error, "com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback", JFapChannelConstants.CONNWRITECOMPCALLBACK_COMPLETE_03, connection.getDiagnostics(true));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, error);
// It might appear slightly odd for this code to catch Error (especially since the JDK docs say
// that Error means that something has gone so badly wrong that you should abandon all hope).
// This code makes one final stab at putting out some diagnostics about what happened (if we
// propagate the Error up to the TCP Channel, it is sometimes lost) and closing down the
// connection. I figured that we might as well try to do something - as we can hardly make
// things worse... (famous last words)
connection.invalidate(false, error, "Error caught in ConnectionWriteCompletedCallback.complete()");
// Re-throw the error to ensure that it causes the maximum devastation.
// The JVM is probably very ill if an Error is thrown so attempt no recovery.
throw error;
} catch(RuntimeException runtimeException) {
FFDCFilter.processException
(runtimeException, "com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback", JFapChannelConstants.CONNWRITECOMPCALLBACK_COMPLETE_04, connection.getDiagnostics(true));
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, runtimeException);
// We can reasonably try to recover from a runtime exception by invalidating the associated
// connection. This should drive the underlying TCP/IP socket to be closed.
connection.invalidate(false, runtimeException, "RuntimeException caught in ConnectionWriteCompletedCallback.complete()");
// Don't throw the RuntimeException on as we risk blowing away part of the TCP channel.
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "complete");
} | class class_name[name] begin[{]
method[complete, return_type[void], modifier[public], parameter[vc, wctx]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["complete"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=vc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=wctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[call[connection.isLoggingIOEvents, parameter[]]] begin[{]
call[connection.getConnectionEventRecorder, parameter[]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=doWork, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Caught SIConnectionDroppedException, Priority Queue has been purged")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=connectionDroppedException, types=['SIConnectionDroppedException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback"), MemberReference(member=CONNWRITECOMPCALLBACK_COMPLETE_03, postfix_operators=[], prefix_operators=[], qualifier=JFapChannelConstants, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getDiagnostics, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, 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=isEventEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error caught in ConnectionWriteCompletedCallback.complete()")], member=invalidate, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=error, types=['Error'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=runtimeException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback"), MemberReference(member=CONNWRITECOMPCALLBACK_COMPLETE_04, postfix_operators=[], prefix_operators=[], qualifier=JFapChannelConstants, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getDiagnostics, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, 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=isEventEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=runtimeException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=runtimeException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RuntimeException caught in ConnectionWriteCompletedCallback.complete()")], member=invalidate, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=runtimeException, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["complete"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[complete] operator[SEP] identifier[NetworkConnection] identifier[vc] , identifier[IOWriteRequestContext] identifier[wctx] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[vc] , identifier[wctx]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connection] operator[SEP] identifier[isLoggingIOEvents] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[getConnectionEventRecorder] operator[SEP] operator[SEP] operator[SEP] identifier[logDebug] operator[SEP] literal[String] operator[+] identifier[System] operator[SEP] identifier[identityHashCode] operator[SEP] identifier[wctx] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[doWork] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SIConnectionDroppedException] identifier[connectionDroppedException] 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[SibTr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Error] identifier[error] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[error] , literal[String] , identifier[JFapChannelConstants] operator[SEP] identifier[CONNWRITECOMPCALLBACK_COMPLETE_03] , identifier[connection] operator[SEP] identifier[getDiagnostics] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] Keyword[this] , identifier[tc] , identifier[error] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[invalidate] operator[SEP] literal[boolean] , identifier[error] , literal[String] operator[SEP] operator[SEP] Keyword[throw] identifier[error] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[runtimeException] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[runtimeException] , literal[String] , identifier[JFapChannelConstants] operator[SEP] identifier[CONNWRITECOMPCALLBACK_COMPLETE_04] , identifier[connection] operator[SEP] identifier[getDiagnostics] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] Keyword[this] , identifier[tc] , identifier[runtimeException] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[invalidate] operator[SEP] literal[boolean] , identifier[runtimeException] , literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public int[] toIntArray ()
{
int[] vals = new int[size()];
int ii = 0;
for (Interator it = interator(); (ii < Integer.MAX_VALUE) && it.hasNext(); ) {
vals[ii++] = it.nextInt();
}
return vals;
} | class class_name[name] begin[{]
method[toIntArray, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], vals]
local_variable[type[int], ii]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=vals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator=<), operandr=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=interator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Interator, sub_type=None)), update=None), label=None)
return[member[.vals]]
end[}]
END[}] | Keyword[public] Keyword[int] operator[SEP] operator[SEP] identifier[toIntArray] operator[SEP] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[vals] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Interator] identifier[it] operator[=] identifier[interator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ii] operator[<] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[&&] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[vals] operator[SEP] identifier[ii] operator[++] operator[SEP] operator[=] identifier[it] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[vals] operator[SEP]
}
|
public synchronized void canonLabel(IAtomContainer atomContainer) {
if (atomContainer.getAtomCount() == 0) return;
if (atomContainer.getAtomCount() == 1) {
atomContainer.getAtom(0).setProperty(InvPair.CANONICAL_LABEL, 1);
}
List<InvPair> vect = createInvarLabel(atomContainer);
step3(vect, atomContainer);
} | class class_name[name] begin[{]
method[canonLabel, return_type[void], modifier[synchronized public], parameter[atomContainer]] begin[{]
if[binary_operation[call[atomContainer.getAtomCount, parameter[]], ==, literal[0]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[atomContainer.getAtomCount, parameter[]], ==, literal[1]]] begin[{]
call[atomContainer.getAtom, parameter[literal[0]]]
else begin[{]
None
end[}]
local_variable[type[List], vect]
call[.step3, parameter[member[.vect], member[.atomContainer]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[canonLabel] operator[SEP] identifier[IAtomContainer] identifier[atomContainer] operator[SEP] {
Keyword[if] operator[SEP] identifier[atomContainer] operator[SEP] identifier[getAtomCount] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[atomContainer] operator[SEP] identifier[getAtomCount] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[atomContainer] operator[SEP] identifier[getAtom] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[setProperty] operator[SEP] identifier[InvPair] operator[SEP] identifier[CANONICAL_LABEL] , Other[1] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[InvPair] operator[>] identifier[vect] operator[=] identifier[createInvarLabel] operator[SEP] identifier[atomContainer] operator[SEP] operator[SEP] identifier[step3] operator[SEP] identifier[vect] , identifier[atomContainer] operator[SEP] operator[SEP]
}
|
private static BigDecimal findDecimalSingleValue(Connection connection, String sql, List<SqlParam> sqlParams) throws SQLException {
PreparedStatement stmt = null;
ResultSet resultSet = null;
try {
stmt = connection.prepareStatement(sql);
stmtAssignSqlParams(stmt, sqlParams);
resultSet = stmt.executeQuery();
if (resultSet == null /*|| resultSet.isClosed()*/) // isClosed may throw AbstractMethod error for older versions of driver
throw new SQLException("ResultSet is null or closed");
ResultSetMetaData rsmd = resultSet.getMetaData();
if (rsmd.getColumnCount() != 1)
throw new SQLException("ResultSet must have exactly 1 column");
if (!resultSet.next())
throw new SQLException("ResultSet must have exactly 1 row");
Object object = resultSet.getObject(1);
if (resultSet.next())
throw new SQLException("ResultSet have more than 1 row");
if (object == null)
return null;
return getBigDecimal(object);
} finally {
try { if (resultSet != null) resultSet.close(); } catch (Exception e) {logger.error("Cannot close resultSet", e);};
try { if (stmt != null) stmt.close(); } catch (Exception e) {logger.error("Cannot close statement", e);};
}
} | class class_name[name] begin[{]
method[findDecimalSingleValue, return_type[type[BigDecimal]], modifier[private static], parameter[connection, sql, sqlParams]] begin[{]
local_variable[type[PreparedStatement], stmt]
local_variable[type[ResultSet], resultSet]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=sql, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sqlParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=stmtAssignSqlParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=resultSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resultSet, 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=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResultSet is null or closed")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetaData, postfix_operators=[], prefix_operators=[], qualifier=resultSet, selectors=[], type_arguments=None), name=rsmd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResultSetMetaData, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=rsmd, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResultSet must have exactly 1 column")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=['!'], qualifier=resultSet, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResultSet must have exactly 1 row")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=resultSet, selectors=[], type_arguments=None), name=object)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=resultSet, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResultSet have more than 1 row")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=object, 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=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resultSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=resultSet, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot close resultSet"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), Statement(label=None), 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=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot close statement"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), Statement(label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[BigDecimal] identifier[findDecimalSingleValue] operator[SEP] identifier[Connection] identifier[connection] , identifier[String] identifier[sql] , identifier[List] operator[<] identifier[SqlParam] operator[>] identifier[sqlParams] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[PreparedStatement] identifier[stmt] operator[=] Other[null] operator[SEP] identifier[ResultSet] identifier[resultSet] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[stmt] operator[=] identifier[connection] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sql] operator[SEP] operator[SEP] identifier[stmtAssignSqlParams] operator[SEP] identifier[stmt] , identifier[sqlParams] operator[SEP] operator[SEP] identifier[resultSet] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resultSet] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ResultSetMetaData] identifier[rsmd] operator[=] identifier[resultSet] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rsmd] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[resultSet] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Object] identifier[object] operator[=] identifier[resultSet] operator[SEP] identifier[getObject] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resultSet] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[object] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[getBigDecimal] operator[SEP] identifier[object] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[resultSet] operator[!=] Other[null] operator[SEP] identifier[resultSet] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
} operator[SEP] 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]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
} operator[SEP]
}
}
|
public static void main(String args[]) {
// Associate a new Context with this thread
Context cx = Context.enter();
try {
// Initialize the standard objects (Object, Function, etc.)
// This must be done before scripts can be executed.
Shell shell = new Shell();
cx.initStandardObjects(shell);
// Define some global functions particular to the shell. Note
// that these functions are not part of ECMA.
String[] names = { "print", "quit", "version", "load", "help" };
shell.defineFunctionProperties(names, Shell.class,
ScriptableObject.DONTENUM);
args = processOptions(cx, args);
// Set up "arguments" in the global scope to contain the command
// line arguments after the name of the script to execute
Object[] array;
if (args.length == 0) {
array = new Object[0];
} else {
int length = args.length - 1;
array = new Object[length];
System.arraycopy(args, 1, array, 0, length);
}
Scriptable argsObj = cx.newArray(shell, array);
shell.defineProperty("arguments", argsObj,
ScriptableObject.DONTENUM);
shell.processSource(cx, args.length == 0 ? null : args[0]);
} finally {
Context.exit();
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[Context], cx]
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=Shell, sub_type=None)), name=shell)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Shell, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=shell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initStandardObjects, postfix_operators=[], prefix_operators=[], qualifier=cx, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="print"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="quit"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="version"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="load"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="help")]), name=names)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Shell, sub_type=None)), MemberReference(member=DONTENUM, postfix_operators=[], prefix_operators=[], qualifier=ScriptableObject, selectors=[])], member=defineFunctionProperties, postfix_operators=[], prefix_operators=[], qualifier=shell, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=cx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=array)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=shell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newArray, postfix_operators=[], prefix_operators=[], qualifier=cx, selectors=[], type_arguments=None), name=argsObj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Scriptable, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="arguments"), MemberReference(member=argsObj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DONTENUM, postfix_operators=[], prefix_operators=[], qualifier=ScriptableObject, selectors=[])], member=defineProperty, postfix_operators=[], prefix_operators=[], qualifier=shell, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))], member=processSource, postfix_operators=[], prefix_operators=[], qualifier=shell, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] identifier[args] operator[SEP] operator[SEP] operator[SEP] {
identifier[Context] identifier[cx] operator[=] identifier[Context] operator[SEP] identifier[enter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Shell] identifier[shell] operator[=] Keyword[new] identifier[Shell] operator[SEP] operator[SEP] operator[SEP] identifier[cx] operator[SEP] identifier[initStandardObjects] operator[SEP] identifier[shell] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[names] operator[=] {
literal[String] , literal[String] , literal[String] , literal[String] , literal[String]
} operator[SEP] identifier[shell] operator[SEP] identifier[defineFunctionProperties] operator[SEP] identifier[names] , identifier[Shell] operator[SEP] Keyword[class] , identifier[ScriptableObject] operator[SEP] identifier[DONTENUM] operator[SEP] operator[SEP] identifier[args] operator[=] identifier[processOptions] operator[SEP] identifier[cx] , identifier[args] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[SEP] Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[array] operator[=] Keyword[new] identifier[Object] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[length] operator[=] identifier[args] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] identifier[array] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[args] , Other[1] , identifier[array] , Other[0] , identifier[length] operator[SEP] operator[SEP]
}
identifier[Scriptable] identifier[argsObj] operator[=] identifier[cx] operator[SEP] identifier[newArray] operator[SEP] identifier[shell] , identifier[array] operator[SEP] operator[SEP] identifier[shell] operator[SEP] identifier[defineProperty] operator[SEP] literal[String] , identifier[argsObj] , identifier[ScriptableObject] operator[SEP] identifier[DONTENUM] operator[SEP] operator[SEP] identifier[shell] operator[SEP] identifier[processSource] operator[SEP] identifier[cx] , identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[?] Other[null] operator[:] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[Context] operator[SEP] identifier[exit] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static void buildNodeName(Node node, StringBuffer buffer) {
if (node.getParentNode() == null) {
return;
}
buildNodeName(node.getParentNode(), buffer);
if (node.getParentNode() != null
&& node.getParentNode().getParentNode() != null) {
buffer.append(".");
}
buffer.append(node.getLocalName());
} | class class_name[name] begin[{]
method[buildNodeName, return_type[void], modifier[private static], parameter[node, buffer]] begin[{]
if[binary_operation[call[node.getParentNode, parameter[]], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.buildNodeName, parameter[call[node.getParentNode, parameter[]], member[.buffer]]]
if[binary_operation[binary_operation[call[node.getParentNode, parameter[]], !=, literal[null]], &&, binary_operation[call[node.getParentNode, parameter[]], !=, literal[null]]]] begin[{]
call[buffer.append, parameter[literal["."]]]
else begin[{]
None
end[}]
call[buffer.append, parameter[call[node.getLocalName, parameter[]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[buildNodeName] operator[SEP] identifier[Node] identifier[node] , identifier[StringBuffer] identifier[buffer] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getParentNode] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[buildNodeName] operator[SEP] identifier[node] operator[SEP] identifier[getParentNode] operator[SEP] operator[SEP] , identifier[buffer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getParentNode] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[node] operator[SEP] identifier[getParentNode] operator[SEP] operator[SEP] operator[SEP] identifier[getParentNode] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[node] operator[SEP] identifier[getLocalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.