code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
protected boolean isStale() throws IOException {
boolean isStale = true;
if (isOpen) {
// the connection is open, but now we have to see if we can read it
// assume the connection is not stale.
isStale = false;
try {
if (inputStream.available() <= 0) {
try {
socket.setSoTimeout(1);
inputStream.mark(1);
int byteRead = inputStream.read();
if (byteRead == -1) {
// again - if the socket is reporting all data read,
// probably stale
isStale = true;
} else {
inputStream.reset();
}
} finally {
socket.setSoTimeout(this.params.getSoTimeout());
}
}
} catch (InterruptedIOException e) {
if (!ExceptionUtil.isSocketTimeoutException(e)) {
throw e;
}
// aha - the connection is NOT stale - continue on!
} catch (IOException e) {
// oops - the connection is stale, the read or soTimeout failed.
LOG.debug(
"An error occurred while reading from the socket, is appears to be stale",
e
);
isStale = true;
}
}
return isStale;
} | class class_name[name] begin[{]
method[isStale, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
local_variable[type[boolean], isStale]
if[member[.isOpen]] begin[{]
assign[member[.isStale], literal[false]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=available, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=setSoTimeout, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=mark, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), name=byteRead)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=byteRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isStale, 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=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=params, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getSoTimeout, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=setSoTimeout, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None)], label=None, resources=None)]))], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSocketTimeoutException, postfix_operators=[], prefix_operators=['!'], qualifier=ExceptionUtil, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedIOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An error occurred while reading from the socket, is appears to be stale"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isStale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.isStale]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isStale] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[boolean] identifier[isStale] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[isOpen] operator[SEP] {
identifier[isStale] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[inputStream] operator[SEP] identifier[available] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] {
Keyword[try] {
identifier[socket] operator[SEP] identifier[setSoTimeout] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[inputStream] operator[SEP] identifier[mark] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[byteRead] operator[=] identifier[inputStream] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[byteRead] operator[==] operator[-] Other[1] operator[SEP] {
identifier[isStale] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[inputStream] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[socket] operator[SEP] identifier[setSoTimeout] operator[SEP] Keyword[this] operator[SEP] identifier[params] operator[SEP] identifier[getSoTimeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[InterruptedIOException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ExceptionUtil] operator[SEP] identifier[isSocketTimeoutException] operator[SEP] identifier[e] operator[SEP] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] identifier[isStale] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[isStale] operator[SEP]
}
|
private Object getOrMakeSerializedObject( Object entityEntryValue,
Map<Object, Map<String, Object>> serializedCache )
{
if( serializedCache.containsKey( entityEntryValue ) ) //cyclic relation
{
//take from cache and substitute
return serializedCache.get( entityEntryValue );
}
else //not cyclic relation
{
//serialize and put into result
return serializeToMap( entityEntryValue, serializedCache );
}
} | class class_name[name] begin[{]
method[getOrMakeSerializedObject, return_type[type[Object]], modifier[private], parameter[entityEntryValue, serializedCache]] begin[{]
if[call[serializedCache.containsKey, parameter[member[.entityEntryValue]]]] begin[{]
return[call[serializedCache.get, parameter[member[.entityEntryValue]]]]
else begin[{]
return[call[.serializeToMap, parameter[member[.entityEntryValue], member[.serializedCache]]]]
end[}]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[getOrMakeSerializedObject] operator[SEP] identifier[Object] identifier[entityEntryValue] , identifier[Map] operator[<] identifier[Object] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[serializedCache] operator[SEP] {
Keyword[if] operator[SEP] identifier[serializedCache] operator[SEP] identifier[containsKey] operator[SEP] identifier[entityEntryValue] operator[SEP] operator[SEP] {
Keyword[return] identifier[serializedCache] operator[SEP] identifier[get] operator[SEP] identifier[entityEntryValue] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[serializeToMap] operator[SEP] identifier[entityEntryValue] , identifier[serializedCache] operator[SEP] operator[SEP]
}
}
|
public String putRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException {
Util.throwIfNull(payload);
return passthroughRequest(HttpMethod.PUT, endpoint, payload, parameters);
} | class class_name[name] begin[{]
method[putRequest, return_type[type[String]], modifier[public], parameter[endpoint, payload, parameters]] begin[{]
call[Util.throwIfNull, parameter[member[.payload]]]
return[call[.passthroughRequest, parameter[member[HttpMethod.PUT], member[.endpoint], member[.payload], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[putRequest] operator[SEP] identifier[String] identifier[endpoint] , identifier[String] identifier[payload] , identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[parameters] operator[SEP] Keyword[throws] identifier[SmartsheetException] {
identifier[Util] operator[SEP] identifier[throwIfNull] operator[SEP] identifier[payload] operator[SEP] operator[SEP] Keyword[return] identifier[passthroughRequest] operator[SEP] identifier[HttpMethod] operator[SEP] identifier[PUT] , identifier[endpoint] , identifier[payload] , identifier[parameters] operator[SEP] operator[SEP]
}
|
private static Configuration getClientConfiguration(final String[] args)
throws BindException, InjectionException, IOException {
try (final LoggingScope ls = LoggingScopeFactory.getNewLoggingScope(Level.INFO, "Launch::getClientConfiguration")) {
final Configuration commandLineConf = parseCommandLine(args);
final Configuration clientConfiguration = ClientConfiguration.CONF
.set(ClientConfiguration.ON_JOB_COMPLETED, JobClient.CompletedJobHandler.class)
.set(ClientConfiguration.ON_JOB_FAILED, JobClient.FailedJobHandler.class)
.set(ClientConfiguration.ON_RUNTIME_ERROR, JobClient.RuntimeErrorHandler.class)
.build();
final Injector commandLineInjector = Tang.Factory.getTang().newInjector(commandLineConf);
final boolean isLocal = commandLineInjector.getNamedInstance(Local.class);
final Configuration runtimeConfiguration;
if (isLocal) {
LOG.log(Level.INFO, "Running on the local runtime");
runtimeConfiguration = LocalRuntimeConfiguration.CONF
.set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, MAX_NUMBER_OF_EVALUATORS)
.build();
} else {
LOG.log(Level.INFO, "Running on YARN");
runtimeConfiguration = YarnClientConfiguration.CONF.build();
}
return Tang.Factory.getTang()
.newConfigurationBuilder(runtimeConfiguration, clientConfiguration,
cloneCommandLineConfiguration(commandLineConf))
.build();
}
} | class class_name[name] begin[{]
method[getClientConfiguration, return_type[type[Configuration]], modifier[private static], parameter[args]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseCommandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=commandLineConf)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Configuration, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ON_JOB_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=ClientConfiguration, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=JobClient, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CompletedJobHandler, sub_type=None))], member=set, postfix_operators=[], prefix_operators=[], qualifier=ClientConfiguration.CONF, selectors=[MethodInvocation(arguments=[MemberReference(member=ON_JOB_FAILED, postfix_operators=[], prefix_operators=[], qualifier=ClientConfiguration, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=JobClient, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FailedJobHandler, sub_type=None))], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ON_RUNTIME_ERROR, postfix_operators=[], prefix_operators=[], qualifier=ClientConfiguration, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=JobClient, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeErrorHandler, sub_type=None))], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=clientConfiguration)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Configuration, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTang, postfix_operators=[], prefix_operators=[], qualifier=Tang.Factory, selectors=[MethodInvocation(arguments=[MemberReference(member=commandLineConf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInjector, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=commandLineInjector)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Injector, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Local, sub_type=None))], member=getNamedInstance, postfix_operators=[], prefix_operators=[], qualifier=commandLineInjector, selectors=[], type_arguments=None), name=isLocal)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=runtimeConfiguration)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Configuration, sub_type=None)), IfStatement(condition=MemberReference(member=isLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=INFO, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Running on YARN")], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=runtimeConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=YarnClientConfiguration.CONF, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=INFO, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Running on the local runtime")], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=runtimeConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=MAX_NUMBER_OF_EVALUATORS, postfix_operators=[], prefix_operators=[], qualifier=LocalRuntimeConfiguration, selectors=[]), MemberReference(member=MAX_NUMBER_OF_EVALUATORS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=LocalRuntimeConfiguration.CONF, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=getTang, postfix_operators=[], prefix_operators=[], qualifier=Tang.Factory, selectors=[MethodInvocation(arguments=[MemberReference(member=runtimeConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clientConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=commandLineConf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cloneCommandLineConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=newConfigurationBuilder, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers={'final'}, name=ls, type=ReferenceType(arguments=None, dimensions=[], name=LoggingScope, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=INFO, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Launch::getClientConfiguration")], member=getNewLoggingScope, postfix_operators=[], prefix_operators=[], qualifier=LoggingScopeFactory, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Configuration] identifier[getClientConfiguration] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[BindException] , identifier[InjectionException] , identifier[IOException] {
Keyword[try] operator[SEP] Keyword[final] identifier[LoggingScope] identifier[ls] operator[=] identifier[LoggingScopeFactory] operator[SEP] identifier[getNewLoggingScope] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] , literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[Configuration] identifier[commandLineConf] operator[=] identifier[parseCommandLine] operator[SEP] identifier[args] operator[SEP] operator[SEP] Keyword[final] identifier[Configuration] identifier[clientConfiguration] operator[=] identifier[ClientConfiguration] operator[SEP] identifier[CONF] operator[SEP] identifier[set] operator[SEP] identifier[ClientConfiguration] operator[SEP] identifier[ON_JOB_COMPLETED] , identifier[JobClient] operator[SEP] identifier[CompletedJobHandler] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[ClientConfiguration] operator[SEP] identifier[ON_JOB_FAILED] , identifier[JobClient] operator[SEP] identifier[FailedJobHandler] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[ClientConfiguration] operator[SEP] identifier[ON_RUNTIME_ERROR] , identifier[JobClient] operator[SEP] identifier[RuntimeErrorHandler] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Injector] identifier[commandLineInjector] operator[=] identifier[Tang] operator[SEP] identifier[Factory] operator[SEP] identifier[getTang] operator[SEP] operator[SEP] operator[SEP] identifier[newInjector] operator[SEP] identifier[commandLineConf] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isLocal] operator[=] identifier[commandLineInjector] operator[SEP] identifier[getNamedInstance] operator[SEP] identifier[Local] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] identifier[Configuration] identifier[runtimeConfiguration] operator[SEP] Keyword[if] operator[SEP] identifier[isLocal] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] , literal[String] operator[SEP] operator[SEP] identifier[runtimeConfiguration] operator[=] identifier[LocalRuntimeConfiguration] operator[SEP] identifier[CONF] operator[SEP] identifier[set] operator[SEP] identifier[LocalRuntimeConfiguration] operator[SEP] identifier[MAX_NUMBER_OF_EVALUATORS] , identifier[MAX_NUMBER_OF_EVALUATORS] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] , literal[String] operator[SEP] operator[SEP] identifier[runtimeConfiguration] operator[=] identifier[YarnClientConfiguration] operator[SEP] identifier[CONF] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Tang] operator[SEP] identifier[Factory] operator[SEP] identifier[getTang] operator[SEP] operator[SEP] operator[SEP] identifier[newConfigurationBuilder] operator[SEP] identifier[runtimeConfiguration] , identifier[clientConfiguration] , identifier[cloneCommandLineConfiguration] operator[SEP] identifier[commandLineConf] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static int findFirstQuotable(byte[] data, int offset, int end) {
while (offset < end) {
switch (data[offset]) {
case '<':
case '>':
case '&':
return offset;
default:
offset += 1;
}
}
return offset;
} | class class_name[name] begin[{]
method[findFirstQuotable, return_type[type[int]], modifier[private static], parameter[data, offset, end]] begin[{]
while[binary_operation[member[.offset], <, member[.end]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='&')], statements=[ReturnStatement(expression=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])], expression=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)
end[}]
return[member[.offset]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[findFirstQuotable] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[int] identifier[offset] , Keyword[int] identifier[end] operator[SEP] {
Keyword[while] operator[SEP] identifier[offset] operator[<] identifier[end] operator[SEP] {
Keyword[switch] operator[SEP] identifier[data] operator[SEP] identifier[offset] operator[SEP] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] identifier[offset] operator[SEP] Keyword[default] operator[:] identifier[offset] operator[+=] Other[1] operator[SEP]
}
}
Keyword[return] identifier[offset] operator[SEP]
}
|
public void init(BaseField owner)
{
m_bScreenMove = true;
m_bInitMove = true;
m_bReadMove = true;
super.init(owner);
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[owner]] begin[{]
assign[member[.m_bScreenMove], literal[true]]
assign[member[.m_bInitMove], literal[true]]
assign[member[.m_bReadMove], literal[true]]
SuperMethodInvocation(arguments=[MemberReference(member=owner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[BaseField] identifier[owner] operator[SEP] {
identifier[m_bScreenMove] operator[=] literal[boolean] operator[SEP] identifier[m_bInitMove] operator[=] literal[boolean] operator[SEP] identifier[m_bReadMove] operator[=] literal[boolean] operator[SEP] Keyword[super] operator[SEP] identifier[init] operator[SEP] identifier[owner] operator[SEP] operator[SEP]
}
|
public void serialize(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration, Map<String, Configuration> configurations) throws XMLStreamException {
writer.writeStartDocument();
writer.writeStartElement("infinispan");
Serializer serializer = new Serializer();
serializer.serialize(writer, new ConfigurationHolder(globalConfiguration, configurations));
writer.writeEndElement();
writer.writeEndDocument();
} | class class_name[name] begin[{]
method[serialize, return_type[void], modifier[public], parameter[writer, globalConfiguration, configurations]] begin[{]
call[writer.writeStartDocument, parameter[]]
call[writer.writeStartElement, parameter[literal["infinispan"]]]
local_variable[type[Serializer], serializer]
call[serializer.serialize, parameter[member[.writer], ClassCreator(arguments=[MemberReference(member=globalConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=configurations, 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=ConfigurationHolder, sub_type=None))]]
call[writer.writeEndElement, parameter[]]
call[writer.writeEndDocument, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[serialize] operator[SEP] identifier[XMLExtendedStreamWriter] identifier[writer] , identifier[GlobalConfiguration] identifier[globalConfiguration] , identifier[Map] operator[<] identifier[String] , identifier[Configuration] operator[>] identifier[configurations] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
identifier[writer] operator[SEP] identifier[writeStartDocument] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeStartElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Serializer] identifier[serializer] operator[=] Keyword[new] identifier[Serializer] operator[SEP] operator[SEP] operator[SEP] identifier[serializer] operator[SEP] identifier[serialize] operator[SEP] identifier[writer] , Keyword[new] identifier[ConfigurationHolder] operator[SEP] identifier[globalConfiguration] , identifier[configurations] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeEndElement] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeEndDocument] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object invokeMethod(String name, Object args) {
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 0) {
return setAndGetContent(name, new HashMap<String, Object>());
} else if (arr.length == 1) {
if (arr[0] instanceof Closure) {
return setAndGetContent(name, JsonDelegate.cloneDelegateAndGetContent((Closure) arr[0]));
} else if (arr[0] instanceof Map) {
return setAndGetContent(name, arr[0]);
}
} else if (arr.length == 2) {
final Object first = arr[0];
final Object second = arr[1];
if (second instanceof Closure) {
final Closure closure = (Closure)second;
if (first instanceof Map) {
Map subMap = new LinkedHashMap();
subMap.putAll((Map) first);
subMap.putAll(JsonDelegate.cloneDelegateAndGetContent(closure));
return setAndGetContent(name, subMap);
} else if (first instanceof Iterable) {
List<Map<String, Object>> list = collectContentForEachEntry((Iterable) first, closure);
return setAndGetContent(name, list);
} else if (first != null && first.getClass().isArray()) {
final Iterable coll = Arrays.asList((Object[])first);
List<Map<String, Object>> list = collectContentForEachEntry(coll, closure);
return setAndGetContent(name, list);
}
}
}
throw new JsonException("Expected no arguments, a single map, a single closure, or a map and closure as arguments.");
} else {
return setAndGetContent(name, new HashMap<String, Object>());
}
} | class class_name[name] begin[{]
method[invokeMethod, return_type[type[Object]], modifier[public], parameter[name, args]] begin[{]
if[binary_operation[binary_operation[member[.args], !=, literal[null]], &&, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[], type_arguments=None)], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
local_variable[type[Object], arr]
if[binary_operation[member[arr.length], ==, literal[0]]] begin[{]
return[call[.setAndGetContent, parameter[member[.name], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]]]
else begin[{]
if[binary_operation[member[arr.length], ==, literal[1]]] begin[{]
if[binary_operation[member[.arr], instanceof, type[Closure]]] begin[{]
return[call[.setAndGetContent, parameter[member[.name], call[JsonDelegate.cloneDelegateAndGetContent, parameter[Cast(expression=MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type=ReferenceType(arguments=None, dimensions=[], name=Closure, sub_type=None))]]]]]
else begin[{]
if[binary_operation[member[.arr], instanceof, type[Map]]] begin[{]
return[call[.setAndGetContent, parameter[member[.name], member[.arr]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
if[binary_operation[member[arr.length], ==, literal[2]]] begin[{]
local_variable[type[Object], first]
local_variable[type[Object], second]
if[binary_operation[member[.second], instanceof, type[Closure]]] begin[{]
local_variable[type[Closure], closure]
if[binary_operation[member[.first], instanceof, type[Map]]] begin[{]
local_variable[type[Map], subMap]
call[subMap.putAll, parameter[Cast(expression=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=None))]]
call[subMap.putAll, parameter[call[JsonDelegate.cloneDelegateAndGetContent, parameter[member[.closure]]]]]
return[call[.setAndGetContent, parameter[member[.name], member[.subMap]]]]
else begin[{]
if[binary_operation[member[.first], instanceof, type[Iterable]]] begin[{]
local_variable[type[List], list]
return[call[.setAndGetContent, parameter[member[.name], member[.list]]]]
else begin[{]
if[binary_operation[binary_operation[member[.first], !=, literal[null]], &&, call[first.getClass, parameter[]]]] begin[{]
local_variable[type[Iterable], coll]
local_variable[type[List], list]
return[call[.setAndGetContent, parameter[member[.name], member[.list]]]]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected no arguments, a single map, a single closure, or a map and closure as arguments.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonException, sub_type=None)), label=None)
else begin[{]
return[call[.setAndGetContent, parameter[member[.name], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[invokeMethod] operator[SEP] identifier[String] identifier[name] , identifier[Object] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[!=] Other[null] operator[&&] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[args] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[arr] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[if] operator[SEP] identifier[arr] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[arr] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[arr] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[Closure] operator[SEP] {
Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , identifier[JsonDelegate] operator[SEP] identifier[cloneDelegateAndGetContent] operator[SEP] operator[SEP] identifier[Closure] operator[SEP] identifier[arr] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[arr] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[Map] operator[SEP] {
Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , identifier[arr] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[arr] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
Keyword[final] identifier[Object] identifier[first] operator[=] identifier[arr] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[second] operator[=] identifier[arr] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[second] Keyword[instanceof] identifier[Closure] operator[SEP] {
Keyword[final] identifier[Closure] identifier[closure] operator[=] operator[SEP] identifier[Closure] operator[SEP] identifier[second] operator[SEP] Keyword[if] operator[SEP] identifier[first] Keyword[instanceof] identifier[Map] operator[SEP] {
identifier[Map] identifier[subMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[SEP] operator[SEP] operator[SEP] identifier[subMap] operator[SEP] identifier[putAll] operator[SEP] operator[SEP] identifier[Map] operator[SEP] identifier[first] operator[SEP] operator[SEP] identifier[subMap] operator[SEP] identifier[putAll] operator[SEP] identifier[JsonDelegate] operator[SEP] identifier[cloneDelegateAndGetContent] operator[SEP] identifier[closure] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , identifier[subMap] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[first] Keyword[instanceof] identifier[Iterable] operator[SEP] {
identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[list] operator[=] identifier[collectContentForEachEntry] operator[SEP] operator[SEP] identifier[Iterable] operator[SEP] identifier[first] , identifier[closure] operator[SEP] operator[SEP] Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , identifier[list] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[first] operator[!=] Other[null] operator[&&] identifier[first] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Iterable] identifier[coll] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[first] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[list] operator[=] identifier[collectContentForEachEntry] operator[SEP] identifier[coll] , identifier[closure] operator[SEP] operator[SEP] Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , identifier[list] operator[SEP] operator[SEP]
}
}
}
Keyword[throw] Keyword[new] identifier[JsonException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[setAndGetContent] operator[SEP] identifier[name] , Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected Double getDouble(final String key, final JSONObject jsonObject) {
Double value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getDouble(key);
}
catch(JSONException e) {
LOGGER.error("Could not get Double from JSONObject for key: " + key, e);
}
}
return value;
} | class class_name[name] begin[{]
method[getDouble, return_type[type[Double]], modifier[protected], parameter[key, jsonObject]] begin[{]
local_variable[type[Double], value]
if[call[.hasKey, parameter[member[.key], member[.jsonObject]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=jsonObject, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not get Double from JSONObject for key: "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), 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=['JSONException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[protected] identifier[Double] identifier[getDouble] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] identifier[JSONObject] identifier[jsonObject] operator[SEP] {
identifier[Double] identifier[value] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[hasKey] operator[SEP] identifier[key] , identifier[jsonObject] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[value] operator[=] identifier[jsonObject] operator[SEP] identifier[getDouble] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[key] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[value] operator[SEP]
}
|
private void handleMatch(Point match)
{
if (match == null)
{
int caretPosition = textComponent.getCaretPosition();
Document document = textComponent.getDocument();
caretPosition = Math.max(0, Math.min(
document.getLength(), caretPosition));
textComponent.setCaretPosition(caretPosition);
textComponent.moveCaretPosition(caretPosition);
textComponent.getCaret().setSelectionVisible(false);
}
else
{
textComponent.setCaretPosition(match.y);
textComponent.moveCaretPosition(match.x);
textComponent.getCaret().setSelectionVisible(true);
}
} | class class_name[name] begin[{]
method[handleMatch, return_type[void], modifier[private], parameter[match]] begin[{]
if[binary_operation[member[.match], ==, literal[null]]] begin[{]
local_variable[type[int], caretPosition]
local_variable[type[Document], document]
assign[member[.caretPosition], call[Math.max, parameter[literal[0], call[Math.min, parameter[call[document.getLength, parameter[]], member[.caretPosition]]]]]]
call[textComponent.setCaretPosition, parameter[member[.caretPosition]]]
call[textComponent.moveCaretPosition, parameter[member[.caretPosition]]]
call[textComponent.getCaret, parameter[]]
else begin[{]
call[textComponent.setCaretPosition, parameter[member[match.y]]]
call[textComponent.moveCaretPosition, parameter[member[match.x]]]
call[textComponent.getCaret, parameter[]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleMatch] operator[SEP] identifier[Point] identifier[match] operator[SEP] {
Keyword[if] operator[SEP] identifier[match] operator[==] Other[null] operator[SEP] {
Keyword[int] identifier[caretPosition] operator[=] identifier[textComponent] operator[SEP] identifier[getCaretPosition] operator[SEP] operator[SEP] operator[SEP] identifier[Document] identifier[document] operator[=] identifier[textComponent] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[caretPosition] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[0] , identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[document] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] , identifier[caretPosition] operator[SEP] operator[SEP] operator[SEP] identifier[textComponent] operator[SEP] identifier[setCaretPosition] operator[SEP] identifier[caretPosition] operator[SEP] operator[SEP] identifier[textComponent] operator[SEP] identifier[moveCaretPosition] operator[SEP] identifier[caretPosition] operator[SEP] operator[SEP] identifier[textComponent] operator[SEP] identifier[getCaret] operator[SEP] operator[SEP] operator[SEP] identifier[setSelectionVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[textComponent] operator[SEP] identifier[setCaretPosition] operator[SEP] identifier[match] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[textComponent] operator[SEP] identifier[moveCaretPosition] operator[SEP] identifier[match] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[textComponent] operator[SEP] identifier[getCaret] operator[SEP] operator[SEP] operator[SEP] identifier[setSelectionVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
public void updatePermissions() {
final String[] accessViewerList =
this.accessViewer.trim().split(ACCESS_LIST_SPLIT_REGEX);
final String[] accessExecutorList =
this.accessExecutor.trim().split(ACCESS_LIST_SPLIT_REGEX);
final String[] accessOwnerList =
this.accessOwner.trim().split(ACCESS_LIST_SPLIT_REGEX);
// Prepare permission types
final Permission admin = new Permission();
admin.addPermission(Type.READ);
admin.addPermission(Type.EXECUTE);
admin.addPermission(Type.ADMIN);
final Permission executor = new Permission();
executor.addPermission(Type.READ);
executor.addPermission(Type.EXECUTE);
final Permission viewer = new Permission();
viewer.addPermission(Type.READ);
// Sets the permissions
this.project.clearUserPermission();
for (String user : accessViewerList) {
user = user.trim();
if (!user.isEmpty()) {
this.project.setUserPermission(user, viewer);
}
}
for (String user : accessExecutorList) {
user = user.trim();
if (!user.isEmpty()) {
this.project.setUserPermission(user, executor);
}
}
for (String user : accessOwnerList) {
user = user.trim();
if (!user.isEmpty()) {
this.project.setUserPermission(user, admin);
}
}
this.project.setUserPermission(this.reportalUser, admin);
} | class class_name[name] begin[{]
method[updatePermissions, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[String], accessViewerList]
local_variable[type[String], accessExecutorList]
local_variable[type[String], accessOwnerList]
local_variable[type[Permission], admin]
call[admin.addPermission, parameter[member[Type.READ]]]
call[admin.addPermission, parameter[member[Type.EXECUTE]]]
call[admin.addPermission, parameter[member[Type.ADMIN]]]
local_variable[type[Permission], executor]
call[executor.addPermission, parameter[member[Type.READ]]]
call[executor.addPermission, parameter[member[Type.EXECUTE]]]
local_variable[type[Permission], viewer]
call[viewer.addPermission, parameter[member[Type.READ]]]
THIS[member[None.project]call[None.clearUserPermission, parameter[]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=user, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=project, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=viewer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUserPermission, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=accessViewerList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=user)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=user, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=project, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=executor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUserPermission, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=accessExecutorList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=user)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=user, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=project, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=admin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUserPermission, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=accessOwnerList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=user)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
THIS[member[None.project]call[None.setUserPermission, parameter[THIS[member[None.reportalUser]], member[.admin]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updatePermissions] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[accessViewerList] operator[=] Keyword[this] operator[SEP] identifier[accessViewer] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[ACCESS_LIST_SPLIT_REGEX] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[accessExecutorList] operator[=] Keyword[this] operator[SEP] identifier[accessExecutor] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[ACCESS_LIST_SPLIT_REGEX] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[accessOwnerList] operator[=] Keyword[this] operator[SEP] identifier[accessOwner] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[ACCESS_LIST_SPLIT_REGEX] operator[SEP] operator[SEP] Keyword[final] identifier[Permission] identifier[admin] operator[=] Keyword[new] identifier[Permission] operator[SEP] operator[SEP] operator[SEP] identifier[admin] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[READ] operator[SEP] operator[SEP] identifier[admin] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[EXECUTE] operator[SEP] operator[SEP] identifier[admin] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[ADMIN] operator[SEP] operator[SEP] Keyword[final] identifier[Permission] identifier[executor] operator[=] Keyword[new] identifier[Permission] operator[SEP] operator[SEP] operator[SEP] identifier[executor] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[READ] operator[SEP] operator[SEP] identifier[executor] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[EXECUTE] operator[SEP] operator[SEP] Keyword[final] identifier[Permission] identifier[viewer] operator[=] Keyword[new] identifier[Permission] operator[SEP] operator[SEP] operator[SEP] identifier[viewer] operator[SEP] identifier[addPermission] operator[SEP] identifier[Type] operator[SEP] identifier[READ] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[project] operator[SEP] identifier[clearUserPermission] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[user] operator[:] identifier[accessViewerList] operator[SEP] {
identifier[user] operator[=] identifier[user] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[user] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[project] operator[SEP] identifier[setUserPermission] operator[SEP] identifier[user] , identifier[viewer] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[String] identifier[user] operator[:] identifier[accessExecutorList] operator[SEP] {
identifier[user] operator[=] identifier[user] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[user] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[project] operator[SEP] identifier[setUserPermission] operator[SEP] identifier[user] , identifier[executor] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[String] identifier[user] operator[:] identifier[accessOwnerList] operator[SEP] {
identifier[user] operator[=] identifier[user] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[user] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[project] operator[SEP] identifier[setUserPermission] operator[SEP] identifier[user] , identifier[admin] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[project] operator[SEP] identifier[setUserPermission] operator[SEP] Keyword[this] operator[SEP] identifier[reportalUser] , identifier[admin] operator[SEP] operator[SEP]
}
|
private Path[] globPathsLevel(Path[] parents, String[] filePattern,
int level, boolean[] hasGlob) throws IOException {
if (level == filePattern.length - 1)
return parents;
if (parents == null || parents.length == 0) {
return null;
}
GlobFilter fp = new GlobFilter(filePattern[level]);
if (fp.hasPattern()) {
parents = FileUtil.stat2Paths(listStatus(parents, fp));
hasGlob[0] = true;
} else {
for (int i = 0; i < parents.length; i++) {
parents[i] = new Path(parents[i], filePattern[level]);
}
}
return globPathsLevel(parents, filePattern, level + 1, hasGlob);
} | class class_name[name] begin[{]
method[globPathsLevel, return_type[type[Path]], modifier[private], parameter[parents, filePattern, level, hasGlob]] begin[{]
if[binary_operation[member[.level], ==, binary_operation[member[filePattern.length], -, literal[1]]]] begin[{]
return[member[.parents]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.parents], ==, literal[null]], ||, binary_operation[member[parents.length], ==, literal[0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[GlobFilter], fp]
if[call[fp.hasPattern, parameter[]]] begin[{]
assign[member[.parents], call[FileUtil.stat2Paths, parameter[call[.listStatus, parameter[member[.parents], member[.fp]]]]]]
assign[member[.hasGlob], literal[true]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[MemberReference(member=parents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=filePattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=level, 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=Path, sub_type=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=parents, 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[}]
return[call[.globPathsLevel, parameter[member[.parents], member[.filePattern], binary_operation[member[.level], +, literal[1]], member[.hasGlob]]]]
end[}]
END[}] | Keyword[private] identifier[Path] operator[SEP] operator[SEP] identifier[globPathsLevel] operator[SEP] identifier[Path] operator[SEP] operator[SEP] identifier[parents] , identifier[String] operator[SEP] operator[SEP] identifier[filePattern] , Keyword[int] identifier[level] , Keyword[boolean] operator[SEP] operator[SEP] identifier[hasGlob] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[level] operator[==] identifier[filePattern] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] Keyword[return] identifier[parents] operator[SEP] Keyword[if] operator[SEP] identifier[parents] operator[==] Other[null] operator[||] identifier[parents] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[GlobFilter] identifier[fp] operator[=] Keyword[new] identifier[GlobFilter] operator[SEP] identifier[filePattern] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fp] operator[SEP] identifier[hasPattern] operator[SEP] operator[SEP] operator[SEP] {
identifier[parents] operator[=] identifier[FileUtil] operator[SEP] identifier[stat2Paths] operator[SEP] identifier[listStatus] operator[SEP] identifier[parents] , identifier[fp] operator[SEP] operator[SEP] operator[SEP] identifier[hasGlob] operator[SEP] Other[0] operator[SEP] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[parents] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[parents] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[Path] operator[SEP] identifier[parents] operator[SEP] identifier[i] operator[SEP] , identifier[filePattern] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[globPathsLevel] operator[SEP] identifier[parents] , identifier[filePattern] , identifier[level] operator[+] Other[1] , identifier[hasGlob] operator[SEP] operator[SEP]
}
|
@Override
public synchronized ChainGroupData[] getAllChainGroups(String chainName) throws ChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getAllChainGroups chainName=" + chainName);
}
if (null == chainName) {
throw new InvalidChainNameException("Null chain name");
}
// Ensure the chain exists.
ChainData chain = this.chainDataMap.get(chainName);
if (null == chain) {
throw new ChainException("Unable to find chain: " + chainName);
}
int index = 0;
int numGroups = getNumGroupsUsingChain(chainName);
ChainGroupData[] groupArray = new ChainGroupData[numGroups];
for (ChainGroupData group : this.chainGroups.values()) {
if (group.containsChain(chainName)) {
groupArray[index++] = group;
}
}
return groupArray;
} | class class_name[name] begin[{]
method[getAllChainGroups, return_type[type[ChainGroupData]], modifier[synchronized public], parameter[chainName]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["getAllChainGroups chainName="], +, member[.chainName]]]]
else begin[{]
None
end[}]
if[binary_operation[literal[null], ==, member[.chainName]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null chain name")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidChainNameException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ChainData], chain]
if[binary_operation[literal[null], ==, member[.chain]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to find chain: "), operandr=MemberReference(member=chainName, 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=ChainException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], index]
local_variable[type[int], numGroups]
local_variable[type[ChainGroupData], groupArray]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=chainName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsChain, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=groupArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=chainGroups, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=group)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChainGroupData, sub_type=None))), label=None)
return[member[.groupArray]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] identifier[ChainGroupData] operator[SEP] operator[SEP] identifier[getAllChainGroups] operator[SEP] identifier[String] identifier[chainName] operator[SEP] Keyword[throws] identifier[ChainException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[chainName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[==] identifier[chainName] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidChainNameException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ChainData] identifier[chain] operator[=] Keyword[this] operator[SEP] identifier[chainDataMap] operator[SEP] identifier[get] operator[SEP] identifier[chainName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[chain] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ChainException] operator[SEP] literal[String] operator[+] identifier[chainName] operator[SEP] operator[SEP]
}
Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] Keyword[int] identifier[numGroups] operator[=] identifier[getNumGroupsUsingChain] operator[SEP] identifier[chainName] operator[SEP] operator[SEP] identifier[ChainGroupData] operator[SEP] operator[SEP] identifier[groupArray] operator[=] Keyword[new] identifier[ChainGroupData] operator[SEP] identifier[numGroups] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ChainGroupData] identifier[group] operator[:] Keyword[this] operator[SEP] identifier[chainGroups] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[group] operator[SEP] identifier[containsChain] operator[SEP] identifier[chainName] operator[SEP] operator[SEP] {
identifier[groupArray] operator[SEP] identifier[index] operator[++] operator[SEP] operator[=] identifier[group] operator[SEP]
}
}
Keyword[return] identifier[groupArray] operator[SEP]
}
|
private static final Object convertCollectionToProtobufs(Collection<Object> collectionOfNonProtobufs) throws JException
{
if (collectionOfNonProtobufs.isEmpty())
{
return collectionOfNonProtobufs;
}
final Object first = collectionOfNonProtobufs.toArray()[0];
if (!ProtobufSerializerUtils.isProtbufEntity(first))
{
return collectionOfNonProtobufs;
}
final Collection<Object> newCollectionValues;
/**
* Maintain the Collection type of value at this stage (if it is a Set), and if conversion is required to a
* different Collection type, that will be handled by a converter later on
*/
if (collectionOfNonProtobufs instanceof Set)
{
newCollectionValues = new HashSet<>();
}
else
{
newCollectionValues = new ArrayList<>();
}
for (Object iProtobufGenObj : collectionOfNonProtobufs)
{
newCollectionValues.add(serializeToProtobufEntity(iProtobufGenObj));
}
return newCollectionValues;
} | class class_name[name] begin[{]
method[convertCollectionToProtobufs, return_type[type[Object]], modifier[final private static], parameter[collectionOfNonProtobufs]] begin[{]
if[call[collectionOfNonProtobufs.isEmpty, parameter[]]] begin[{]
return[member[.collectionOfNonProtobufs]]
else begin[{]
None
end[}]
local_variable[type[Object], first]
if[call[ProtobufSerializerUtils.isProtbufEntity, parameter[member[.first]]]] begin[{]
return[member[.collectionOfNonProtobufs]]
else begin[{]
None
end[}]
local_variable[type[Collection], newCollectionValues]
if[binary_operation[member[.collectionOfNonProtobufs], instanceof, type[Set]]] begin[{]
assign[member[.newCollectionValues], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None))]
else begin[{]
assign[member[.newCollectionValues], 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))]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=iProtobufGenObj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serializeToProtobufEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=newCollectionValues, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=collectionOfNonProtobufs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iProtobufGenObj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.newCollectionValues]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] identifier[Object] identifier[convertCollectionToProtobufs] operator[SEP] identifier[Collection] operator[<] identifier[Object] operator[>] identifier[collectionOfNonProtobufs] operator[SEP] Keyword[throws] identifier[JException] {
Keyword[if] operator[SEP] identifier[collectionOfNonProtobufs] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[collectionOfNonProtobufs] operator[SEP]
}
Keyword[final] identifier[Object] identifier[first] operator[=] identifier[collectionOfNonProtobufs] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ProtobufSerializerUtils] operator[SEP] identifier[isProtbufEntity] operator[SEP] identifier[first] operator[SEP] operator[SEP] {
Keyword[return] identifier[collectionOfNonProtobufs] operator[SEP]
}
Keyword[final] identifier[Collection] operator[<] identifier[Object] operator[>] identifier[newCollectionValues] operator[SEP] Keyword[if] operator[SEP] identifier[collectionOfNonProtobufs] Keyword[instanceof] identifier[Set] operator[SEP] {
identifier[newCollectionValues] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[newCollectionValues] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Object] identifier[iProtobufGenObj] operator[:] identifier[collectionOfNonProtobufs] operator[SEP] {
identifier[newCollectionValues] operator[SEP] identifier[add] operator[SEP] identifier[serializeToProtobufEntity] operator[SEP] identifier[iProtobufGenObj] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newCollectionValues] operator[SEP]
}
|
public static List<CommerceWishListItem> findByCommerceWishListId(
long commerceWishListId, int start, int end) {
return getPersistence()
.findByCommerceWishListId(commerceWishListId, start, end);
} | class class_name[name] begin[{]
method[findByCommerceWishListId, return_type[type[List]], modifier[public static], parameter[commerceWishListId, start, end]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[CommerceWishListItem] operator[>] identifier[findByCommerceWishListId] operator[SEP] Keyword[long] identifier[commerceWishListId] , Keyword[int] identifier[start] , Keyword[int] identifier[end] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCommerceWishListId] operator[SEP] identifier[commerceWishListId] , identifier[start] , identifier[end] operator[SEP] operator[SEP]
}
|
public static void printStackTrace(StackTraceElement[] trace, java.io.PrintWriter out) {
Strand.printStackTrace(trace, out);
} | class class_name[name] begin[{]
method[printStackTrace, return_type[void], modifier[public static], parameter[trace, out]] begin[{]
call[Strand.printStackTrace, parameter[member[.trace], member[.out]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printStackTrace] operator[SEP] identifier[StackTraceElement] operator[SEP] operator[SEP] identifier[trace] , identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[PrintWriter] identifier[out] operator[SEP] {
identifier[Strand] operator[SEP] identifier[printStackTrace] operator[SEP] identifier[trace] , identifier[out] operator[SEP] operator[SEP]
}
|
@InterfaceAudience.Public
public SavedRevision createRevision(Map<String, Object> properties) throws CouchbaseLiteException {
boolean allowConflict = false;
return document.putProperties(properties, revisionInternal.getRevID(), allowConflict);
} | class class_name[name] begin[{]
method[createRevision, return_type[type[SavedRevision]], modifier[public], parameter[properties]] begin[{]
local_variable[type[boolean], allowConflict]
return[call[document.putProperties, parameter[member[.properties], call[revisionInternal.getRevID, parameter[]], member[.allowConflict]]]]
end[}]
END[}] | annotation[@] identifier[InterfaceAudience] operator[SEP] identifier[Public] Keyword[public] identifier[SavedRevision] identifier[createRevision] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[SEP] Keyword[throws] identifier[CouchbaseLiteException] {
Keyword[boolean] identifier[allowConflict] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[document] operator[SEP] identifier[putProperties] operator[SEP] identifier[properties] , identifier[revisionInternal] operator[SEP] identifier[getRevID] operator[SEP] operator[SEP] , identifier[allowConflict] operator[SEP] operator[SEP]
}
|
private void deliverReadyTxns() {
// First, pull all the sequenced messages, if any.
VoltMessage m = m_replaySequencer.poll();
while(m != null) {
deliver(m);
m = m_replaySequencer.poll();
}
// Then, try to pull all the drainable messages, if any.
m = m_replaySequencer.drain();
while (m != null) {
if (m instanceof Iv2InitiateTaskMessage) {
// Send IGNORED response for all SPs
Iv2InitiateTaskMessage task = (Iv2InitiateTaskMessage) m;
final InitiateResponseMessage response = new InitiateResponseMessage(task);
response.setResults(new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE,
new VoltTable[0],
ClientResponseImpl.IGNORED_TRANSACTION));
m_mailbox.send(response.getInitiatorHSId(), response);
}
m = m_replaySequencer.drain();
}
} | class class_name[name] begin[{]
method[deliverReadyTxns, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[VoltMessage], m]
while[binary_operation[member[.m], !=, literal[null]]] begin[{]
call[.deliver, parameter[member[.m]]]
assign[member[.m], call[m_replaySequencer.poll, parameter[]]]
end[}]
assign[member[.m], call[m_replaySequencer.drain, parameter[]]]
while[binary_operation[member[.m], !=, literal[null]]] begin[{]
if[binary_operation[member[.m], instanceof, type[Iv2InitiateTaskMessage]]] begin[{]
local_variable[type[Iv2InitiateTaskMessage], task]
local_variable[type[InitiateResponseMessage], response]
call[response.setResults, parameter[ClassCreator(arguments=[MemberReference(member=UNEXPECTED_FAILURE, postfix_operators=[], prefix_operators=[], qualifier=ClientResponse, selectors=[]), 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=VoltTable, sub_type=None)), MemberReference(member=IGNORED_TRANSACTION, postfix_operators=[], prefix_operators=[], qualifier=ClientResponseImpl, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClientResponseImpl, sub_type=None))]]
call[m_mailbox.send, parameter[call[response.getInitiatorHSId, parameter[]], member[.response]]]
else begin[{]
None
end[}]
assign[member[.m], call[m_replaySequencer.drain, parameter[]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[deliverReadyTxns] operator[SEP] operator[SEP] {
identifier[VoltMessage] identifier[m] operator[=] identifier[m_replaySequencer] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[m] operator[!=] Other[null] operator[SEP] {
identifier[deliver] operator[SEP] identifier[m] operator[SEP] operator[SEP] identifier[m] operator[=] identifier[m_replaySequencer] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP]
}
identifier[m] operator[=] identifier[m_replaySequencer] operator[SEP] identifier[drain] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[m] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[m] Keyword[instanceof] identifier[Iv2InitiateTaskMessage] operator[SEP] {
identifier[Iv2InitiateTaskMessage] identifier[task] operator[=] operator[SEP] identifier[Iv2InitiateTaskMessage] operator[SEP] identifier[m] operator[SEP] Keyword[final] identifier[InitiateResponseMessage] identifier[response] operator[=] Keyword[new] identifier[InitiateResponseMessage] operator[SEP] identifier[task] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setResults] operator[SEP] Keyword[new] identifier[ClientResponseImpl] operator[SEP] identifier[ClientResponse] operator[SEP] identifier[UNEXPECTED_FAILURE] , Keyword[new] identifier[VoltTable] operator[SEP] Other[0] operator[SEP] , identifier[ClientResponseImpl] operator[SEP] identifier[IGNORED_TRANSACTION] operator[SEP] operator[SEP] operator[SEP] identifier[m_mailbox] operator[SEP] identifier[send] operator[SEP] identifier[response] operator[SEP] identifier[getInitiatorHSId] operator[SEP] operator[SEP] , identifier[response] operator[SEP] operator[SEP]
}
identifier[m] operator[=] identifier[m_replaySequencer] operator[SEP] identifier[drain] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void _backupChar (final int c)
{
if (c != EOI)
try
{
m_aReader.unread (c);
m_nBackupChars++;
}
catch (final IOException ex)
{
throw new IllegalStateException ("Failed to unread character " + _getPrintableChar (c));
}
} | class class_name[name] begin[{]
method[_backupChar, return_type[void], modifier[private], parameter[c]] begin[{]
if[binary_operation[member[.c], !=, member[.EOI]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unread, postfix_operators=[], prefix_operators=[], qualifier=m_aReader, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=m_nBackupChars, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to unread character "), operandr=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=_getPrintableChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[_backupChar] operator[SEP] Keyword[final] Keyword[int] identifier[c] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[!=] identifier[EOI] operator[SEP] Keyword[try] {
identifier[m_aReader] operator[SEP] identifier[unread] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[m_nBackupChars] operator[++] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[_getPrintableChar] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static DateInterval parse(
CharSequence text,
ChronoParser<PlainDate> startFormat,
char separator,
ChronoParser<PlainDate> endFormat,
BracketPolicy policy,
ParseLog status
) {
return IntervalParser.of(
DateIntervalFactory.INSTANCE,
startFormat,
endFormat,
policy,
separator
).parse(text, status, startFormat.getAttributes());
} | class class_name[name] begin[{]
method[parse, return_type[type[DateInterval]], modifier[public static], parameter[text, startFormat, separator, endFormat, policy, status]] begin[{]
return[call[IntervalParser.of, parameter[member[DateIntervalFactory.INSTANCE], member[.startFormat], member[.endFormat], member[.policy], member[.separator]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DateInterval] identifier[parse] operator[SEP] identifier[CharSequence] identifier[text] , identifier[ChronoParser] operator[<] identifier[PlainDate] operator[>] identifier[startFormat] , Keyword[char] identifier[separator] , identifier[ChronoParser] operator[<] identifier[PlainDate] operator[>] identifier[endFormat] , identifier[BracketPolicy] identifier[policy] , identifier[ParseLog] identifier[status] operator[SEP] {
Keyword[return] identifier[IntervalParser] operator[SEP] identifier[of] operator[SEP] identifier[DateIntervalFactory] operator[SEP] identifier[INSTANCE] , identifier[startFormat] , identifier[endFormat] , identifier[policy] , identifier[separator] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[text] , identifier[status] , identifier[startFormat] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public int compareTo(MrMachineTransientUsage other) {
return new CompareToBuilder()
.append(machineCapacity, other.machineCapacity)
.append(usage, other.usage)
.toComparison();
} | class class_name[name] begin[{]
method[compareTo, return_type[type[int]], modifier[public], parameter[other]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=machineCapacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=machineCapacity, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=usage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=usage, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toComparison, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=CompareToBuilder, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compareTo] operator[SEP] identifier[MrMachineTransientUsage] identifier[other] operator[SEP] {
Keyword[return] Keyword[new] identifier[CompareToBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[machineCapacity] , identifier[other] operator[SEP] identifier[machineCapacity] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[usage] , identifier[other] operator[SEP] identifier[usage] operator[SEP] operator[SEP] identifier[toComparison] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Element makeArrow(SVGPlot svgp, Direction dir, double x, double y, double size) {
final double hs = size / 2.;
switch(dir){
case LEFT:
return new SVGPath().drawTo(x + hs, y + hs).drawTo(x - hs, y).drawTo(x + hs, y - hs).drawTo(x + hs, y + hs).close().makeElement(svgp);
case DOWN:
return new SVGPath().drawTo(x - hs, y - hs).drawTo(x + hs, y - hs).drawTo(x, y + hs).drawTo(x - hs, y - hs).close().makeElement(svgp);
case RIGHT:
return new SVGPath().drawTo(x - hs, y - hs).drawTo(x + hs, y).drawTo(x - hs, y + hs).drawTo(x - hs, y - hs).close().makeElement(svgp);
case UP:
return new SVGPath().drawTo(x - hs, y + hs).drawTo(x, y - hs).drawTo(x + hs, y + hs).drawTo(x - hs, y + hs).close().makeElement(svgp);
default:
throw new IllegalArgumentException("Unexpected direction: " + dir);
}
} | class class_name[name] begin[{]
method[makeArrow, return_type[type[Element]], modifier[public static], parameter[svgp, dir, x, y, size]] begin[{]
local_variable[type[double], hs]
SwitchStatement(cases=[SwitchStatementCase(case=['LEFT'], statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=svgp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SVGPath, sub_type=None)), label=None)]), SwitchStatementCase(case=['DOWN'], statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=svgp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SVGPath, sub_type=None)), label=None)]), SwitchStatementCase(case=['RIGHT'], statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=svgp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SVGPath, sub_type=None)), label=None)]), SwitchStatementCase(case=['UP'], statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=drawTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=svgp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SVGPath, sub_type=None)), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected direction: "), operandr=MemberReference(member=dir, 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)])], expression=MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Element] identifier[makeArrow] operator[SEP] identifier[SVGPlot] identifier[svgp] , identifier[Direction] identifier[dir] , Keyword[double] identifier[x] , Keyword[double] identifier[y] , Keyword[double] identifier[size] operator[SEP] {
Keyword[final] Keyword[double] identifier[hs] operator[=] identifier[size] operator[/] literal[Float] operator[SEP] Keyword[switch] operator[SEP] identifier[dir] operator[SEP] {
Keyword[case] identifier[LEFT] operator[:] Keyword[return] Keyword[new] identifier[SVGPath] operator[SEP] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[makeElement] operator[SEP] identifier[svgp] operator[SEP] operator[SEP] Keyword[case] identifier[DOWN] operator[:] Keyword[return] Keyword[new] identifier[SVGPath] operator[SEP] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[makeElement] operator[SEP] identifier[svgp] operator[SEP] operator[SEP] Keyword[case] identifier[RIGHT] operator[:] Keyword[return] Keyword[new] identifier[SVGPath] operator[SEP] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[makeElement] operator[SEP] identifier[svgp] operator[SEP] operator[SEP] Keyword[case] identifier[UP] operator[:] Keyword[return] Keyword[new] identifier[SVGPath] operator[SEP] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] , identifier[y] operator[-] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[+] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[drawTo] operator[SEP] identifier[x] operator[-] identifier[hs] , identifier[y] operator[+] identifier[hs] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[makeElement] operator[SEP] identifier[svgp] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[dir] operator[SEP] operator[SEP]
}
}
|
public static void addViewToFrame(final JInternalFrame internalFrame, final View<?, ?> view)
{
internalFrame.add(view.getComponent(), BorderLayout.CENTER);
internalFrame.pack();
} | class class_name[name] begin[{]
method[addViewToFrame, return_type[void], modifier[public static], parameter[internalFrame, view]] begin[{]
call[internalFrame.add, parameter[call[view.getComponent, parameter[]], member[BorderLayout.CENTER]]]
call[internalFrame.pack, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addViewToFrame] operator[SEP] Keyword[final] identifier[JInternalFrame] identifier[internalFrame] , Keyword[final] identifier[View] operator[<] operator[?] , operator[?] operator[>] identifier[view] operator[SEP] {
identifier[internalFrame] operator[SEP] identifier[add] operator[SEP] identifier[view] operator[SEP] identifier[getComponent] operator[SEP] operator[SEP] , identifier[BorderLayout] operator[SEP] identifier[CENTER] operator[SEP] operator[SEP] identifier[internalFrame] operator[SEP] identifier[pack] operator[SEP] operator[SEP] operator[SEP]
}
|
private Collection<Node> checkNegationSpecifier(final NegationSpecifier specifier) throws NodeSelectorException {
Collection<Selector> parts = new LinkedHashSet<Selector>(1);
parts.add(specifier.getSelector());
return check(parts);
} | class class_name[name] begin[{]
method[checkNegationSpecifier, return_type[type[Collection]], modifier[private], parameter[specifier]] begin[{]
local_variable[type[Collection], parts]
call[parts.add, parameter[call[specifier.getSelector, parameter[]]]]
return[call[.check, parameter[member[.parts]]]]
end[}]
END[}] | Keyword[private] identifier[Collection] operator[<] identifier[Node] operator[>] identifier[checkNegationSpecifier] operator[SEP] Keyword[final] identifier[NegationSpecifier] identifier[specifier] operator[SEP] Keyword[throws] identifier[NodeSelectorException] {
identifier[Collection] operator[<] identifier[Selector] operator[>] identifier[parts] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[Selector] operator[>] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[parts] operator[SEP] identifier[add] operator[SEP] identifier[specifier] operator[SEP] identifier[getSelector] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[check] operator[SEP] identifier[parts] operator[SEP] operator[SEP]
}
|
@Override
public void execute(final JobExecutionContext context) throws JobExecutionException {
try {
easyBatchJob.call();
} catch (Exception e) {
throw new JobExecutionException("An exception occurred during the execution of job " + easyBatchJob, e);
}
} | class class_name[name] begin[{]
method[execute, return_type[void], modifier[public], parameter[context]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=call, postfix_operators=[], prefix_operators=[], qualifier=easyBatchJob, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An exception occurred during the execution of job "), operandr=MemberReference(member=easyBatchJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobExecutionException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] Keyword[final] identifier[JobExecutionContext] identifier[context] operator[SEP] Keyword[throws] identifier[JobExecutionException] {
Keyword[try] {
identifier[easyBatchJob] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JobExecutionException] operator[SEP] literal[String] operator[+] identifier[easyBatchJob] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String readString()
throws IOException
{
int tag = is.read();
if (tag == 'N')
return null;
if (tag != 'S')
throw expect("string", tag);
int b16 = is.read();
int b8 = is.read();
int len = (b16 << 8) + b8;
return readStringImpl(len);
} | class class_name[name] begin[{]
method[readString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[int], tag]
if[binary_operation[member[.tag], ==, literal['N']]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.tag], !=, literal['S']]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="string"), MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=expect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[int], b16]
local_variable[type[int], b8]
local_variable[type[int], len]
return[call[.readStringImpl, parameter[member[.len]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[readString] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[tag] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[==] literal[String] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[!=] literal[String] operator[SEP] Keyword[throw] identifier[expect] operator[SEP] literal[String] , identifier[tag] operator[SEP] operator[SEP] Keyword[int] identifier[b16] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[b8] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] operator[SEP] identifier[b16] operator[<<] Other[8] operator[SEP] operator[+] identifier[b8] operator[SEP] Keyword[return] identifier[readStringImpl] operator[SEP] identifier[len] operator[SEP] operator[SEP]
}
|
final void continuouslyRestart(long interval) throws IOException, InterruptedException {
LOGGER.entering(interval);
while (true) {
if (!isInitialized()) {
FileDownloader.checkForDownloads(getType(), getLauncherOptions()
.isFileDownloadCheckTimeStampOnInvocation(), getLauncherOptions()
.isFileDownloadCleanupOnInvocation());
}
startProcess(false);
while (!handler.hasResult()) {
LOGGER.fine("Child process still running. Going back to sleep.");
Thread.sleep(interval);
}
if (handler.hasResult()) {
ExecuteException e = handler.getException();
if (e != null) {
LOGGER.log(Level.SEVERE, handler.getException().getMessage(), handler.getException());
}
}
LOGGER.info("Child process quit. Restarting it.");
setInitialized(false);
}
} | class class_name[name] begin[{]
method[continuouslyRestart, return_type[void], modifier[final], parameter[interval]] begin[{]
call[LOGGER.entering, parameter[member[.interval]]]
while[literal[true]] begin[{]
if[call[.isInitialized, parameter[]]] begin[{]
call[FileDownloader.checkForDownloads, parameter[call[.getType, parameter[]], call[.getLauncherOptions, parameter[]], call[.getLauncherOptions, parameter[]]]]
else begin[{]
None
end[}]
call[.startProcess, parameter[literal[false]]]
while[call[handler.hasResult, parameter[]]] begin[{]
call[LOGGER.fine, parameter[literal["Child process still running. Going back to sleep."]]]
call[Thread.sleep, parameter[member[.interval]]]
end[}]
if[call[handler.hasResult, parameter[]]] begin[{]
local_variable[type[ExecuteException], e]
if[binary_operation[member[.e], !=, literal[null]]] begin[{]
call[LOGGER.log, parameter[member[Level.SEVERE], call[handler.getException, parameter[]], call[handler.getException, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[LOGGER.info, parameter[literal["Child process quit. Restarting it."]]]
call[.setInitialized, parameter[literal[false]]]
end[}]
end[}]
END[}] | Keyword[final] Keyword[void] identifier[continuouslyRestart] operator[SEP] Keyword[long] identifier[interval] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[LOGGER] operator[SEP] identifier[entering] operator[SEP] identifier[interval] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isInitialized] operator[SEP] operator[SEP] operator[SEP] {
identifier[FileDownloader] operator[SEP] identifier[checkForDownloads] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[getLauncherOptions] operator[SEP] operator[SEP] operator[SEP] identifier[isFileDownloadCheckTimeStampOnInvocation] operator[SEP] operator[SEP] , identifier[getLauncherOptions] operator[SEP] operator[SEP] operator[SEP] identifier[isFileDownloadCleanupOnInvocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[startProcess] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[handler] operator[SEP] identifier[hasResult] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[interval] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[handler] operator[SEP] identifier[hasResult] operator[SEP] operator[SEP] operator[SEP] {
identifier[ExecuteException] identifier[e] operator[=] identifier[handler] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , identifier[handler] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[handler] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[setInitialized] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
@Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, final char cSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
if (nTextLength >= 1)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, cSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + 1;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | class class_name[name] begin[{]
method[getOccurrenceCount, return_type[type[int]], modifier[public static], parameter[sText, cSearch]] begin[{]
local_variable[type[int], ret]
local_variable[type[int], nTextLength]
if[binary_operation[member[.nTextLength], >=, literal[1]]] begin[{]
local_variable[type[int], nLastIndex]
local_variable[type[int], nIndex]
do[binary_operation[member[.nIndex], !=, member[.STRING_NOT_FOUND]]] begin[{]
assign[member[.nIndex], call[.getIndexOf, parameter[member[.sText], member[.nLastIndex], member[.cSearch]]]]
if[binary_operation[member[.nIndex], !=, member[.STRING_NOT_FOUND]]] begin[{]
member[.ret]
assign[member[.nLastIndex], binary_operation[member[.nIndex], +, literal[1]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.ret]]
end[}]
END[}] | annotation[@] identifier[Nonnegative] Keyword[public] Keyword[static] Keyword[int] identifier[getOccurrenceCount] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sText] , Keyword[final] Keyword[char] identifier[cSearch] operator[SEP] {
Keyword[int] identifier[ret] operator[=] Other[0] operator[SEP] Keyword[final] Keyword[int] identifier[nTextLength] operator[=] identifier[getLength] operator[SEP] identifier[sText] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nTextLength] operator[>=] Other[1] operator[SEP] {
Keyword[int] identifier[nLastIndex] operator[=] Other[0] operator[SEP] Keyword[int] identifier[nIndex] operator[SEP] Keyword[do] {
identifier[nIndex] operator[=] identifier[getIndexOf] operator[SEP] identifier[sText] , identifier[nLastIndex] , identifier[cSearch] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nIndex] operator[!=] identifier[STRING_NOT_FOUND] operator[SEP] {
operator[++] identifier[ret] operator[SEP] identifier[nLastIndex] operator[=] identifier[nIndex] operator[+] Other[1] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[nIndex] operator[!=] identifier[STRING_NOT_FOUND] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public Response deleteTemplate(String id)
throws RequestException, LocalOperationException {
Request request = new Request(this);
return new Response(request.delete("/templates/" + id, new HashMap<String, Object>()));
} | class class_name[name] begin[{]
method[deleteTemplate, return_type[type[Response]], modifier[public], parameter[id]] begin[{]
local_variable[type[Request], request]
return[ClassCreator(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/templates/"), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], member=delete, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Response, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Response] identifier[deleteTemplate] operator[SEP] identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[RequestException] , identifier[LocalOperationException] {
identifier[Request] identifier[request] operator[=] Keyword[new] identifier[Request] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Response] operator[SEP] identifier[request] operator[SEP] identifier[delete] operator[SEP] literal[String] operator[+] identifier[id] , Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void
build(DapDataset dmr, byte[] serialdata, ByteOrder order)
throws DapException
{
setDMR(dmr);
// "Compile" the databuffer section of the server response
this.databuffer = ByteBuffer.wrap(serialdata).order(order);
D4DataCompiler compiler = new D4DataCompiler(this, getChecksumMode(), getOrder(), this.databuffer);
compiler.compile();
} | class class_name[name] begin[{]
method[build, return_type[void], modifier[protected], parameter[dmr, serialdata, order]] begin[{]
call[.setDMR, parameter[member[.dmr]]]
assign[THIS[member[None.databuffer]], call[ByteBuffer.wrap, parameter[member[.serialdata]]]]
local_variable[type[D4DataCompiler], compiler]
call[compiler.compile, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[build] operator[SEP] identifier[DapDataset] identifier[dmr] , Keyword[byte] operator[SEP] operator[SEP] identifier[serialdata] , identifier[ByteOrder] identifier[order] operator[SEP] Keyword[throws] identifier[DapException] {
identifier[setDMR] operator[SEP] identifier[dmr] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[databuffer] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[serialdata] operator[SEP] operator[SEP] identifier[order] operator[SEP] identifier[order] operator[SEP] operator[SEP] identifier[D4DataCompiler] identifier[compiler] operator[=] Keyword[new] identifier[D4DataCompiler] operator[SEP] Keyword[this] , identifier[getChecksumMode] operator[SEP] operator[SEP] , identifier[getOrder] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[databuffer] operator[SEP] operator[SEP] identifier[compiler] operator[SEP] identifier[compile] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean canOptimizeObjectCreate(Node firstParam) {
Node curParam = firstParam;
while (curParam != null) {
if (!isOptimizableKey(curParam)) {
return false;
}
curParam = curParam.getNext();
// Check for an odd number of parameters.
if (curParam == null) {
return false;
}
curParam = curParam.getNext();
}
return true;
} | class class_name[name] begin[{]
method[canOptimizeObjectCreate, return_type[type[boolean]], modifier[private], parameter[firstParam]] begin[{]
local_variable[type[Node], curParam]
while[binary_operation[member[.curParam], !=, literal[null]]] begin[{]
if[call[.isOptimizableKey, parameter[member[.curParam]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.curParam], call[curParam.getNext, parameter[]]]
if[binary_operation[member[.curParam], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.curParam], call[curParam.getNext, parameter[]]]
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[canOptimizeObjectCreate] operator[SEP] identifier[Node] identifier[firstParam] operator[SEP] {
identifier[Node] identifier[curParam] operator[=] identifier[firstParam] operator[SEP] Keyword[while] operator[SEP] identifier[curParam] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isOptimizableKey] operator[SEP] identifier[curParam] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[curParam] operator[=] identifier[curParam] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[curParam] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[curParam] operator[=] identifier[curParam] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void marshall(ParameterConstraints parameterConstraints, ProtocolMarshaller protocolMarshaller) {
if (parameterConstraints == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(parameterConstraints.getRequired(), REQUIRED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[parameterConstraints, protocolMarshaller]] begin[{]
if[binary_operation[member[.parameterConstraints], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRequired, postfix_operators=[], prefix_operators=[], qualifier=parameterConstraints, selectors=[], type_arguments=None), MemberReference(member=REQUIRED_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ParameterConstraints] identifier[parameterConstraints] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[parameterConstraints] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[parameterConstraints] operator[SEP] identifier[getRequired] operator[SEP] operator[SEP] , identifier[REQUIRED_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public boolean findInList(byte[] address) {
int len = address.length;
int a[] = new int[len];
for (int i = 0; i < len; i++) {
// convert possible negative byte value to positive int
a[i] = address[i] & 0x00FF;
}
return findInList(a);
} | class class_name[name] begin[{]
method[findInList, return_type[type[boolean]], modifier[public], parameter[address]] begin[{]
local_variable[type[int], len]
local_variable[type[int], a]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=address, 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=0x00FF), operator=&)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[.findInList, parameter[member[.a]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[findInList] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[address] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[address] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[a] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[a] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[address] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP]
}
Keyword[return] identifier[findInList] operator[SEP] identifier[a] operator[SEP] operator[SEP]
}
|
static QuerySpecification getCheckSelect(Session session, Table t,
Expression e) {
CompileContext compileContext = new CompileContext(session);
QuerySpecification s = new QuerySpecification(compileContext);
s.exprColumns = new Expression[1];
s.exprColumns[0] = EXPR_TRUE;
RangeVariable range = new RangeVariable(t, null, null, null,
compileContext);
s.rangeVariables = new RangeVariable[]{ range };
HsqlList unresolved = e.resolveColumnReferences(s.rangeVariables,
null);
ExpressionColumn.checkColumnsResolved(unresolved);
e.resolveTypes(session, null);
if (Type.SQL_BOOLEAN != e.getDataType()) {
throw Error.error(ErrorCode.X_42568);
}
Expression condition = new ExpressionLogical(OpTypes.NOT, e);
s.queryCondition = condition;
s.resolveReferences(session);
s.resolveTypes(session);
return s;
} | class class_name[name] begin[{]
method[getCheckSelect, return_type[type[QuerySpecification]], modifier[static], parameter[session, t, e]] begin[{]
local_variable[type[CompileContext], compileContext]
local_variable[type[QuerySpecification], s]
assign[member[s.exprColumns], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Expression, sub_type=None))]
assign[member[s.exprColumns], member[.EXPR_TRUE]]
local_variable[type[RangeVariable], range]
assign[member[s.rangeVariables], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RangeVariable, sub_type=None))]
local_variable[type[HsqlList], unresolved]
call[ExpressionColumn.checkColumnsResolved, parameter[member[.unresolved]]]
call[e.resolveTypes, parameter[member[.session], literal[null]]]
if[binary_operation[member[Type.SQL_BOOLEAN], !=, call[e.getDataType, parameter[]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=X_42568, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Error, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[Expression], condition]
assign[member[s.queryCondition], member[.condition]]
call[s.resolveReferences, parameter[member[.session]]]
call[s.resolveTypes, parameter[member[.session]]]
return[member[.s]]
end[}]
END[}] | Keyword[static] identifier[QuerySpecification] identifier[getCheckSelect] operator[SEP] identifier[Session] identifier[session] , identifier[Table] identifier[t] , identifier[Expression] identifier[e] operator[SEP] {
identifier[CompileContext] identifier[compileContext] operator[=] Keyword[new] identifier[CompileContext] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[QuerySpecification] identifier[s] operator[=] Keyword[new] identifier[QuerySpecification] operator[SEP] identifier[compileContext] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[exprColumns] operator[=] Keyword[new] identifier[Expression] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[exprColumns] operator[SEP] Other[0] operator[SEP] operator[=] identifier[EXPR_TRUE] operator[SEP] identifier[RangeVariable] identifier[range] operator[=] Keyword[new] identifier[RangeVariable] operator[SEP] identifier[t] , Other[null] , Other[null] , Other[null] , identifier[compileContext] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[rangeVariables] operator[=] Keyword[new] identifier[RangeVariable] operator[SEP] operator[SEP] {
identifier[range]
} operator[SEP] identifier[HsqlList] identifier[unresolved] operator[=] identifier[e] operator[SEP] identifier[resolveColumnReferences] operator[SEP] identifier[s] operator[SEP] identifier[rangeVariables] , Other[null] operator[SEP] operator[SEP] identifier[ExpressionColumn] operator[SEP] identifier[checkColumnsResolved] operator[SEP] identifier[unresolved] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[resolveTypes] operator[SEP] identifier[session] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Type] operator[SEP] identifier[SQL_BOOLEAN] operator[!=] identifier[e] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[Error] operator[SEP] identifier[error] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[X_42568] operator[SEP] operator[SEP]
}
identifier[Expression] identifier[condition] operator[=] Keyword[new] identifier[ExpressionLogical] operator[SEP] identifier[OpTypes] operator[SEP] identifier[NOT] , identifier[e] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[queryCondition] operator[=] identifier[condition] operator[SEP] identifier[s] operator[SEP] identifier[resolveReferences] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[resolveTypes] operator[SEP] identifier[session] operator[SEP] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
|
@Override
protected void handleTransliterate(Replaceable text,
Position pos, boolean isIncremental) {
int allStart = pos.start;
int allLimit = pos.limit;
ScriptRunIterator it =
new ScriptRunIterator(text, pos.contextStart, pos.contextLimit);
while (it.next()) {
// Ignore runs in the ante context
if (it.limit <= allStart) continue;
// Try to instantiate transliterator from it.scriptCode to
// our target or target/variant
Transliterator t = getTransliterator(it.scriptCode);
if (t == null) {
// We have no transliterator. Do nothing, but keep
// pos.start up to date.
pos.start = it.limit;
continue;
}
// If the run end is before the transliteration limit, do
// a non-incremental transliteration. Otherwise do an
// incremental one.
boolean incremental = isIncremental && (it.limit >= allLimit);
pos.start = Math.max(allStart, it.start);
pos.limit = Math.min(allLimit, it.limit);
int limit = pos.limit;
t.filteredTransliterate(text, pos, incremental);
int delta = pos.limit - limit;
allLimit += delta;
it.adjustLimit(delta);
// We're done if we enter the post context
if (it.limit >= allLimit) break;
}
// Restore limit. pos.start is fine where the last transliterator
// left it, or at the end of the last run.
pos.limit = allLimit;
} | class class_name[name] begin[{]
method[handleTransliterate, return_type[void], modifier[protected], parameter[text, pos, isIncremental]] begin[{]
local_variable[type[int], allStart]
local_variable[type[int], allLimit]
local_variable[type[ScriptRunIterator], it]
while[call[it.next, parameter[]]] begin[{]
if[binary_operation[member[it.limit], <=, member[.allStart]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[Transliterator], t]
if[binary_operation[member[.t], ==, literal[null]]] begin[{]
assign[member[pos.start], member[it.limit]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[boolean], incremental]
assign[member[pos.start], call[Math.max, parameter[member[.allStart], member[it.start]]]]
assign[member[pos.limit], call[Math.min, parameter[member[.allLimit], member[it.limit]]]]
local_variable[type[int], limit]
call[t.filteredTransliterate, parameter[member[.text], member[.pos], member[.incremental]]]
local_variable[type[int], delta]
assign[member[.allLimit], member[.delta]]
call[it.adjustLimit, parameter[member[.delta]]]
if[binary_operation[member[it.limit], >=, member[.allLimit]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
assign[member[pos.limit], member[.allLimit]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[handleTransliterate] operator[SEP] identifier[Replaceable] identifier[text] , identifier[Position] identifier[pos] , Keyword[boolean] identifier[isIncremental] operator[SEP] {
Keyword[int] identifier[allStart] operator[=] identifier[pos] operator[SEP] identifier[start] operator[SEP] Keyword[int] identifier[allLimit] operator[=] identifier[pos] operator[SEP] identifier[limit] operator[SEP] identifier[ScriptRunIterator] identifier[it] operator[=] Keyword[new] identifier[ScriptRunIterator] operator[SEP] identifier[text] , identifier[pos] operator[SEP] identifier[contextStart] , identifier[pos] operator[SEP] identifier[contextLimit] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[it] operator[SEP] identifier[limit] operator[<=] identifier[allStart] operator[SEP] Keyword[continue] operator[SEP] identifier[Transliterator] identifier[t] operator[=] identifier[getTransliterator] operator[SEP] identifier[it] operator[SEP] identifier[scriptCode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] {
identifier[pos] operator[SEP] identifier[start] operator[=] identifier[it] operator[SEP] identifier[limit] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[boolean] identifier[incremental] operator[=] identifier[isIncremental] operator[&&] operator[SEP] identifier[it] operator[SEP] identifier[limit] operator[>=] identifier[allLimit] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[start] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[allStart] , identifier[it] operator[SEP] identifier[start] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[limit] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[allLimit] , identifier[it] operator[SEP] identifier[limit] operator[SEP] operator[SEP] Keyword[int] identifier[limit] operator[=] identifier[pos] operator[SEP] identifier[limit] operator[SEP] identifier[t] operator[SEP] identifier[filteredTransliterate] operator[SEP] identifier[text] , identifier[pos] , identifier[incremental] operator[SEP] operator[SEP] Keyword[int] identifier[delta] operator[=] identifier[pos] operator[SEP] identifier[limit] operator[-] identifier[limit] operator[SEP] identifier[allLimit] operator[+=] identifier[delta] operator[SEP] identifier[it] operator[SEP] identifier[adjustLimit] operator[SEP] identifier[delta] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[it] operator[SEP] identifier[limit] operator[>=] identifier[allLimit] operator[SEP] Keyword[break] operator[SEP]
}
identifier[pos] operator[SEP] identifier[limit] operator[=] identifier[allLimit] operator[SEP]
}
|
@Nullable
public static BytesRange fromContentRangeHeader(@Nullable String header)
throws IllegalArgumentException {
if (header == null) {
return null;
}
if (sHeaderParsingRegEx == null) {
sHeaderParsingRegEx = Pattern.compile("[-/ ]");
}
try {
final String[] headerParts = sHeaderParsingRegEx.split(header);
Preconditions.checkArgument(headerParts.length == 4);
Preconditions.checkArgument(headerParts[0].equals("bytes"));
final int from = Integer.parseInt(headerParts[1]);
final int to = Integer.parseInt(headerParts[2]);
final int length = Integer.parseInt(headerParts[3]);
Preconditions.checkArgument(to > from);
Preconditions.checkArgument(length > to);
if (to < length - 1) {
return new BytesRange(from, to);
} else {
return new BytesRange(from, TO_END_OF_CONTENT);
}
} catch (IllegalArgumentException x) {
throw new IllegalArgumentException(
String.format((Locale) null, "Invalid Content-Range header value: \"%s\"", header),
x);
}
} | class class_name[name] begin[{]
method[fromContentRangeHeader, return_type[type[BytesRange]], modifier[public static], parameter[header]] begin[{]
if[binary_operation[member[.header], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.sHeaderParsingRegEx], ==, literal[null]]] begin[{]
assign[member[.sHeaderParsingRegEx], call[Pattern.compile, parameter[literal["[-/ ]"]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=header, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=sHeaderParsingRegEx, selectors=[], type_arguments=None), name=headerParts)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=headerParts, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator===)], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=headerParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="bytes")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=headerParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=from)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=headerParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=to)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=headerParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=length)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>)], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>)], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=TO_END_OF_CONTENT, 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=BytesRange, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=to, 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=BytesRange, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=Locale, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid Content-Range header value: \"%s\""), MemberReference(member=header, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=x, 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[BytesRange] identifier[fromContentRangeHeader] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[header] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] identifier[header] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sHeaderParsingRegEx] operator[==] Other[null] operator[SEP] {
identifier[sHeaderParsingRegEx] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[headerParts] operator[=] identifier[sHeaderParsingRegEx] operator[SEP] identifier[split] operator[SEP] identifier[header] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[headerParts] operator[SEP] identifier[length] operator[==] Other[4] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[headerParts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[from] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[headerParts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[to] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[headerParts] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[length] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[headerParts] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[to] operator[>] identifier[from] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[length] operator[>] identifier[to] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[to] operator[<] identifier[length] operator[-] Other[1] operator[SEP] {
Keyword[return] Keyword[new] identifier[BytesRange] operator[SEP] identifier[from] , identifier[to] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[BytesRange] operator[SEP] identifier[from] , identifier[TO_END_OF_CONTENT] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[x] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] operator[SEP] identifier[Locale] operator[SEP] Other[null] , literal[String] , identifier[header] operator[SEP] , identifier[x] operator[SEP] operator[SEP]
}
}
|
@Override
public List<HRegionInfo> getTableRegions(TableName tableName) throws IOException {
return connection.getAllRegionInfos(tableName);
} | class class_name[name] begin[{]
method[getTableRegions, return_type[type[List]], modifier[public], parameter[tableName]] begin[{]
return[call[connection.getAllRegionInfos, parameter[member[.tableName]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[HRegionInfo] operator[>] identifier[getTableRegions] operator[SEP] identifier[TableName] identifier[tableName] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[connection] operator[SEP] identifier[getAllRegionInfos] operator[SEP] identifier[tableName] operator[SEP] operator[SEP]
}
|
private List<FilterChangeListener> getAllListeners() {
@SuppressWarnings("deprecation") final List<FilterChangeListener> globalChangeListeners =
getAnalysisJobBuilder().getFilterChangeListeners();
final List<FilterChangeListener> list =
new ArrayList<>(globalChangeListeners.size() + _localChangeListeners.size());
list.addAll(globalChangeListeners);
list.addAll(_localChangeListeners);
return list;
} | class class_name[name] begin[{]
method[getAllListeners, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[List], globalChangeListeners]
local_variable[type[List], list]
call[list.addAll, parameter[member[.globalChangeListeners]]]
call[list.addAll, parameter[member[._localChangeListeners]]]
return[member[.list]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[FilterChangeListener] operator[>] identifier[getAllListeners] operator[SEP] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[FilterChangeListener] operator[>] identifier[globalChangeListeners] operator[=] identifier[getAnalysisJobBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[getFilterChangeListeners] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[FilterChangeListener] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[globalChangeListeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[_localChangeListeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[addAll] operator[SEP] identifier[globalChangeListeners] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[addAll] operator[SEP] identifier[_localChangeListeners] operator[SEP] operator[SEP] Keyword[return] identifier[list] operator[SEP]
}
|
@CheckReturnValue
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.NONE) // Supplied scheduler is only used for creating timestamps.
public final Flowable<Timed<T>> timestamp(final TimeUnit unit, final Scheduler scheduler) {
ObjectHelper.requireNonNull(unit, "unit is null");
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return map(Functions.<T>timestampWith(unit, scheduler));
} | class class_name[name] begin[{]
method[timestamp, return_type[type[Flowable]], modifier[final public], parameter[unit, scheduler]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.unit], literal["unit is null"]]]
call[ObjectHelper.requireNonNull, parameter[member[.scheduler], literal["scheduler is null"]]]
return[call[.map, parameter[call[.Functions, parameter[member[.unit], member[.scheduler]]]]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[PASS_THROUGH] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] identifier[Flowable] operator[<] identifier[Timed] operator[<] identifier[T] operator[>] operator[>] identifier[timestamp] operator[SEP] Keyword[final] identifier[TimeUnit] identifier[unit] , Keyword[final] identifier[Scheduler] identifier[scheduler] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[unit] , literal[String] operator[SEP] operator[SEP] identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[scheduler] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[map] operator[SEP] identifier[Functions] operator[SEP] operator[<] identifier[T] operator[>] identifier[timestampWith] operator[SEP] identifier[unit] , identifier[scheduler] operator[SEP] operator[SEP] operator[SEP]
}
|
public final void decreaseScheduledBytesAndMessages(WriteRequest request) {
Object message = request.getMessage();
if (message instanceof IoBuffer) {
IoBuffer b = (IoBuffer) message;
if (b.hasRemaining()) {
increaseScheduledWriteBytes(-((IoBuffer) message).remaining());
}
}
} | class class_name[name] begin[{]
method[decreaseScheduledBytesAndMessages, return_type[void], modifier[final public], parameter[request]] begin[{]
local_variable[type[Object], message]
if[binary_operation[member[.message], instanceof, type[IoBuffer]]] begin[{]
local_variable[type[IoBuffer], b]
if[call[b.hasRemaining, parameter[]]] begin[{]
call[.increaseScheduledWriteBytes, parameter[Cast(expression=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IoBuffer, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[decreaseScheduledBytesAndMessages] operator[SEP] identifier[WriteRequest] identifier[request] operator[SEP] {
identifier[Object] identifier[message] operator[=] identifier[request] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[message] Keyword[instanceof] identifier[IoBuffer] operator[SEP] {
identifier[IoBuffer] identifier[b] operator[=] operator[SEP] identifier[IoBuffer] operator[SEP] identifier[message] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP] {
identifier[increaseScheduledWriteBytes] operator[SEP] operator[-] operator[SEP] operator[SEP] identifier[IoBuffer] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@SneakyThrows
public static ZonedDateTime getDateTime() {
val clazz = CasVersion.class;
val resource = clazz.getResource(clazz.getSimpleName() + ".class");
if ("file".equals(resource.getProtocol())) {
return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified());
}
if ("jar".equals(resource.getProtocol())) {
val path = resource.getPath();
val file = new File(path.substring(JAR_PROTOCOL_STARTING_INDEX, path.indexOf('!')));
return DateTimeUtils.zonedDateTimeOf(file.lastModified());
}
if ("vfs".equals(resource.getProtocol())) {
val file = new VfsResource(resource.openConnection().getContent()).getFile();
return DateTimeUtils.zonedDateTimeOf(file.lastModified());
}
LOGGER.warn("Unhandled url protocol: [{}] resource: [{}]", resource.getProtocol(), resource);
return ZonedDateTime.now(ZoneOffset.UTC);
} | class class_name[name] begin[{]
method[getDateTime, return_type[type[ZonedDateTime]], modifier[public static], parameter[]] begin[{]
local_variable[type[val], clazz]
local_variable[type[val], resource]
if[literal["file"]] begin[{]
return[call[DateTimeUtils.zonedDateTimeOf, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=lastModified, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]]]
else begin[{]
None
end[}]
if[literal["jar"]] begin[{]
local_variable[type[val], path]
local_variable[type[val], file]
return[call[DateTimeUtils.zonedDateTimeOf, parameter[call[file.lastModified, parameter[]]]]]
else begin[{]
None
end[}]
if[literal["vfs"]] begin[{]
local_variable[type[val], file]
return[call[DateTimeUtils.zonedDateTimeOf, parameter[call[file.lastModified, parameter[]]]]]
else begin[{]
None
end[}]
call[LOGGER.warn, parameter[literal["Unhandled url protocol: [{}] resource: [{}]"], call[resource.getProtocol, parameter[]], member[.resource]]]
return[call[ZonedDateTime.now, parameter[member[ZoneOffset.UTC]]]]
end[}]
END[}] | annotation[@] identifier[SneakyThrows] Keyword[public] Keyword[static] identifier[ZonedDateTime] identifier[getDateTime] operator[SEP] operator[SEP] {
identifier[val] identifier[clazz] operator[=] identifier[CasVersion] operator[SEP] Keyword[class] operator[SEP] identifier[val] identifier[resource] operator[=] identifier[clazz] operator[SEP] identifier[getResource] operator[SEP] identifier[clazz] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[resource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[DateTimeUtils] operator[SEP] identifier[zonedDateTimeOf] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[resource] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[resource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[val] identifier[path] operator[=] identifier[resource] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[path] operator[SEP] identifier[substring] operator[SEP] identifier[JAR_PROTOCOL_STARTING_INDEX] , identifier[path] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[DateTimeUtils] operator[SEP] identifier[zonedDateTimeOf] operator[SEP] identifier[file] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[resource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[val] identifier[file] operator[=] Keyword[new] identifier[VfsResource] operator[SEP] identifier[resource] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[DateTimeUtils] operator[SEP] identifier[zonedDateTimeOf] operator[SEP] identifier[file] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[resource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] , identifier[resource] operator[SEP] operator[SEP] Keyword[return] identifier[ZonedDateTime] operator[SEP] identifier[now] operator[SEP] identifier[ZoneOffset] operator[SEP] identifier[UTC] operator[SEP] operator[SEP]
}
|
@Override
public void addInjectionTarget(Member member)
throws InjectionException
{
// If the beanName attribute was found in the constructor or merge
// method, then save the class of where it was located.
if (ivBeanName != null && ivBeanNameClass == null) {
ivBeanNameClass = member.getDeclaringClass();
}
super.addInjectionTarget(member);
} | class class_name[name] begin[{]
method[addInjectionTarget, return_type[void], modifier[public], parameter[member]] begin[{]
if[binary_operation[binary_operation[member[.ivBeanName], !=, literal[null]], &&, binary_operation[member[.ivBeanNameClass], ==, literal[null]]]] begin[{]
assign[member[.ivBeanNameClass], call[member.getDeclaringClass, parameter[]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addInjectionTarget, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addInjectionTarget] operator[SEP] identifier[Member] identifier[member] operator[SEP] Keyword[throws] identifier[InjectionException] {
Keyword[if] operator[SEP] identifier[ivBeanName] operator[!=] Other[null] operator[&&] identifier[ivBeanNameClass] operator[==] Other[null] operator[SEP] {
identifier[ivBeanNameClass] operator[=] identifier[member] operator[SEP] identifier[getDeclaringClass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[addInjectionTarget] operator[SEP] identifier[member] operator[SEP] operator[SEP]
}
|
private String compXmlString(byte[] xml, int sitOff, int stOff, int strInd) {
if (strInd < 0) return null;
int strOff = stOff + LEW(xml, sitOff + strInd * 4);
return compXmlStringAt(xml, strOff);
} | class class_name[name] begin[{]
method[compXmlString, return_type[type[String]], modifier[private], parameter[xml, sitOff, stOff, strInd]] begin[{]
if[binary_operation[member[.strInd], <, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], strOff]
return[call[.compXmlStringAt, parameter[member[.xml], member[.strOff]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[compXmlString] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[xml] , Keyword[int] identifier[sitOff] , Keyword[int] identifier[stOff] , Keyword[int] identifier[strInd] operator[SEP] {
Keyword[if] operator[SEP] identifier[strInd] operator[<] Other[0] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[int] identifier[strOff] operator[=] identifier[stOff] operator[+] identifier[LEW] operator[SEP] identifier[xml] , identifier[sitOff] operator[+] identifier[strInd] operator[*] Other[4] operator[SEP] operator[SEP] Keyword[return] identifier[compXmlStringAt] operator[SEP] identifier[xml] , identifier[strOff] operator[SEP] operator[SEP]
}
|
@Override
public boolean publish(String channel, IMessage<ID, DATA> msg) {
try {
eventBus.get(channel).post(msg);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
return true;
} | class class_name[name] begin[{]
method[publish, return_type[type[boolean]], modifier[public], parameter[channel, msg]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=eventBus, selectors=[MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=post, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ExecutionException']))], finally_block=None, label=None, resources=None)
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[publish] operator[SEP] identifier[String] identifier[channel] , identifier[IMessage] operator[<] identifier[ID] , identifier[DATA] operator[>] identifier[msg] operator[SEP] {
Keyword[try] {
identifier[eventBus] operator[SEP] identifier[get] operator[SEP] identifier[channel] operator[SEP] operator[SEP] identifier[post] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ExecutionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public final Optional<E> last() {
// Iterables#getLast was inlined here so we don't have to throw/catch a NSEE
// TODO(kevinb): Support a concurrently modified collection?
Iterable<E> iterable = getDelegate();
if (iterable instanceof List) {
List<E> list = (List<E>) iterable;
if (list.isEmpty()) {
return Optional.absent();
}
return Optional.of(list.get(list.size() - 1));
}
Iterator<E> iterator = iterable.iterator();
if (!iterator.hasNext()) {
return Optional.absent();
}
/*
* TODO(kevinb): consider whether this "optimization" is worthwhile. Users with SortedSets tend
* to know they are SortedSets and probably would not call this method.
*/
if (iterable instanceof SortedSet) {
SortedSet<E> sortedSet = (SortedSet<E>) iterable;
return Optional.of(sortedSet.last());
}
while (true) {
E current = iterator.next();
if (!iterator.hasNext()) {
return Optional.of(current);
}
}
} | class class_name[name] begin[{]
method[last, return_type[type[Optional]], modifier[final public], parameter[]] begin[{]
local_variable[type[Iterable], iterable]
if[binary_operation[member[.iterable], instanceof, type[List]]] begin[{]
local_variable[type[List], list]
if[call[list.isEmpty, parameter[]]] begin[{]
return[call[Optional.absent, parameter[]]]
else begin[{]
None
end[}]
return[call[Optional.of, parameter[call[list.get, parameter[binary_operation[call[list.size, parameter[]], -, literal[1]]]]]]]
else begin[{]
None
end[}]
local_variable[type[Iterator], iterator]
if[call[iterator.hasNext, parameter[]]] begin[{]
return[call[Optional.absent, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.iterable], instanceof, type[SortedSet]]] begin[{]
local_variable[type[SortedSet], sortedSet]
return[call[Optional.of, parameter[call[sortedSet.last, parameter[]]]]]
else begin[{]
None
end[}]
while[literal[true]] begin[{]
local_variable[type[E], current]
if[call[iterator.hasNext, parameter[]]] begin[{]
return[call[Optional.of, parameter[member[.current]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Optional] operator[<] identifier[E] operator[>] identifier[last] operator[SEP] operator[SEP] {
identifier[Iterable] operator[<] identifier[E] operator[>] identifier[iterable] operator[=] identifier[getDelegate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[List] operator[SEP] {
identifier[List] operator[<] identifier[E] operator[>] identifier[list] operator[=] operator[SEP] identifier[List] operator[<] identifier[E] operator[>] operator[SEP] identifier[iterable] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[absent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[list] operator[SEP] identifier[get] operator[SEP] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Iterator] operator[<] identifier[E] operator[>] identifier[iterator] operator[=] identifier[iterable] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[absent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[SortedSet] operator[SEP] {
identifier[SortedSet] operator[<] identifier[E] operator[>] identifier[sortedSet] operator[=] operator[SEP] identifier[SortedSet] operator[<] identifier[E] operator[>] operator[SEP] identifier[iterable] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[sortedSet] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[E] identifier[current] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[current] operator[SEP] operator[SEP]
}
}
}
|
public static float parseFloat (@Nullable final Object aObject, final float fDefault)
{
if (aObject == null)
return fDefault;
if (aObject instanceof Number)
return ((Number) aObject).floatValue ();
return parseFloat (aObject.toString (), fDefault);
} | class class_name[name] begin[{]
method[parseFloat, return_type[type[float]], modifier[public static], parameter[aObject, fDefault]] begin[{]
if[binary_operation[member[.aObject], ==, literal[null]]] begin[{]
return[member[.fDefault]]
else begin[{]
None
end[}]
if[binary_operation[member[.aObject], instanceof, type[Number]]] begin[{]
return[Cast(expression=MemberReference(member=aObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))]
else begin[{]
None
end[}]
return[call[.parseFloat, parameter[call[aObject.toString, parameter[]], member[.fDefault]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] identifier[parseFloat] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[Object] identifier[aObject] , Keyword[final] Keyword[float] identifier[fDefault] operator[SEP] {
Keyword[if] operator[SEP] identifier[aObject] operator[==] Other[null] operator[SEP] Keyword[return] identifier[fDefault] operator[SEP] Keyword[if] operator[SEP] identifier[aObject] Keyword[instanceof] identifier[Number] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[aObject] operator[SEP] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[parseFloat] operator[SEP] identifier[aObject] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[fDefault] operator[SEP] operator[SEP]
}
|
private static final String getKey(String apiVersion, String kind) {
if (kind == null) {
return null;
} else if (apiVersion == null) {
return kind;
} else {
return String.format("%s#%s", apiVersion, kind);
}
} | class class_name[name] begin[{]
method[getKey, return_type[type[String]], modifier[final private static], parameter[apiVersion, kind]] begin[{]
if[binary_operation[member[.kind], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
if[binary_operation[member[.apiVersion], ==, literal[null]]] begin[{]
return[member[.kind]]
else begin[{]
return[call[String.format, parameter[literal["%s#%s"], member[.apiVersion], member[.kind]]]]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] identifier[String] identifier[getKey] operator[SEP] identifier[String] identifier[apiVersion] , identifier[String] identifier[kind] operator[SEP] {
Keyword[if] operator[SEP] identifier[kind] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[apiVersion] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[kind] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[apiVersion] , identifier[kind] operator[SEP] operator[SEP]
}
}
|
public List<TargetRelationship> getRelatedLevelRelationships() {
final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>();
for (final TargetRelationship relationship : levelRelationships) {
if (relationship.getType() == RelationshipType.REFER_TO) {
relationships.add(relationship);
}
}
return relationships;
} | class class_name[name] begin[{]
method[getRelatedLevelRelationships, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], relationships]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=relationship, selectors=[], type_arguments=None), operandr=MemberReference(member=REFER_TO, postfix_operators=[], prefix_operators=[], qualifier=RelationshipType, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=relationship, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=relationships, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=levelRelationships, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=relationship)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TargetRelationship, sub_type=None))), label=None)
return[member[.relationships]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[TargetRelationship] operator[>] identifier[getRelatedLevelRelationships] operator[SEP] operator[SEP] {
Keyword[final] identifier[ArrayList] operator[<] identifier[TargetRelationship] operator[>] identifier[relationships] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TargetRelationship] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TargetRelationship] identifier[relationship] operator[:] identifier[levelRelationships] operator[SEP] {
Keyword[if] operator[SEP] identifier[relationship] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[RelationshipType] operator[SEP] identifier[REFER_TO] operator[SEP] {
identifier[relationships] operator[SEP] identifier[add] operator[SEP] identifier[relationship] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[relationships] operator[SEP]
}
|
public List<MethodNode> handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call) {
return Collections.emptyList();
} | class class_name[name] begin[{]
method[handleMissingMethod, return_type[type[List]], modifier[public], parameter[receiver, name, argumentList, argumentTypes, call]] begin[{]
return[call[Collections.emptyList, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[MethodNode] operator[>] identifier[handleMissingMethod] operator[SEP] identifier[ClassNode] identifier[receiver] , identifier[String] identifier[name] , identifier[ArgumentListExpression] identifier[argumentList] , identifier[ClassNode] operator[SEP] operator[SEP] identifier[argumentTypes] , identifier[MethodCall] identifier[call] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
|
public void forceFlush(SIBUuid12 streamID) throws SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forceFlush", streamID);
StreamSet streamSet = streamSets.get(streamID);
streamSet.dereferenceControlAdapter();
// Send out a flushed message. If this fails, make sure we get
// to at least invoke the callback.
try
{
// The Cellule argument is null as it is ignored by our parent handler
// this flush message should be broadcast downstream.
// This will also implicitly remove the streamSet
downControl.sendFlushedMessage(null, streamID);
} catch (Exception e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.gd.InternalOutputStreamManager.forceFlush",
"1:743:1.48.1.1",
this);
// Note that it doesn't make much sense to throw an exception here since
// this is a callback from stream array map.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forceFlush", e);
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forceFlush");
} | class class_name[name] begin[{]
method[forceFlush, return_type[void], modifier[public], parameter[streamID]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["forceFlush"], member[.streamID]]]
else begin[{]
None
end[}]
local_variable[type[StreamSet], streamSet]
call[streamSet.dereferenceControlAdapter, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=streamID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendFlushedMessage, postfix_operators=[], prefix_operators=[], qualifier=downControl, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.gd.InternalOutputStreamManager.forceFlush"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:743:1.48.1.1"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], 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=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="forceFlush"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["forceFlush"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[forceFlush] operator[SEP] identifier[SIBUuid12] identifier[streamID] operator[SEP] Keyword[throws] identifier[SIErrorException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[streamID] operator[SEP] operator[SEP] identifier[StreamSet] identifier[streamSet] operator[=] identifier[streamSets] operator[SEP] identifier[get] operator[SEP] identifier[streamID] operator[SEP] operator[SEP] identifier[streamSet] operator[SEP] identifier[dereferenceControlAdapter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[downControl] operator[SEP] identifier[sendFlushedMessage] operator[SEP] Other[null] , identifier[streamID] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public boolean hasDefaultValue() {
return (this.getDefaultValue() != null) || (this.getDefaultValueBoolean() != null) || (this
.getDefaultValueDate() != null) || (this.getDefaultValueNumeric() != null) || (this
.getDefaultValueComputed() != null) || (this.getDefaultValueSequenceNext() != null);
} | class class_name[name] begin[{]
method[hasDefaultValue, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[THIS[call[None.getDefaultValue, parameter[]]], !=, literal[null]], ||, binary_operation[THIS[call[None.getDefaultValueBoolean, parameter[]]], !=, literal[null]]], ||, binary_operation[THIS[call[None.getDefaultValueDate, parameter[]]], !=, literal[null]]], ||, binary_operation[THIS[call[None.getDefaultValueNumeric, parameter[]]], !=, literal[null]]], ||, binary_operation[THIS[call[None.getDefaultValueComputed, parameter[]]], !=, literal[null]]], ||, binary_operation[THIS[call[None.getDefaultValueSequenceNext, parameter[]]], !=, literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[hasDefaultValue] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValueBoolean] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValueDate] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValueNumeric] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValueComputed] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getDefaultValueSequenceNext] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP]
}
|
public void syntaxError(String state, String event, List<String> legalEvents, String uri, Integer line) {
formatter.syntaxError(state, event, legalEvents, uri, line);
} | class class_name[name] begin[{]
method[syntaxError, return_type[void], modifier[public], parameter[state, event, legalEvents, uri, line]] begin[{]
call[formatter.syntaxError, parameter[member[.state], member[.event], member[.legalEvents], member[.uri], member[.line]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[syntaxError] operator[SEP] identifier[String] identifier[state] , identifier[String] identifier[event] , identifier[List] operator[<] identifier[String] operator[>] identifier[legalEvents] , identifier[String] identifier[uri] , identifier[Integer] identifier[line] operator[SEP] {
identifier[formatter] operator[SEP] identifier[syntaxError] operator[SEP] identifier[state] , identifier[event] , identifier[legalEvents] , identifier[uri] , identifier[line] operator[SEP] operator[SEP]
}
|
public RequestHandler<I, O> end(RequestHandler<II, OO> handler) {
return interceptor.intercept(handler);
} | class class_name[name] begin[{]
method[end, return_type[type[RequestHandler]], modifier[public], parameter[handler]] begin[{]
return[call[interceptor.intercept, parameter[member[.handler]]]]
end[}]
END[}] | Keyword[public] identifier[RequestHandler] operator[<] identifier[I] , identifier[O] operator[>] identifier[end] operator[SEP] identifier[RequestHandler] operator[<] identifier[II] , identifier[OO] operator[>] identifier[handler] operator[SEP] {
Keyword[return] identifier[interceptor] operator[SEP] identifier[intercept] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
|
public void onActivate() {
menu = new Menu();
menu.addItem(new CancelMeasuringAction(this));
Layer selectedLayer = mapWidget.getMapModel().getSelectedLayer();
if (selectedLayer instanceof VectorLayer) {
menu.addItem(new ToggleSnappingAction((VectorLayer) selectedLayer, this));
}
mapWidget.setContextMenu(menu);
} | class class_name[name] begin[{]
method[onActivate, return_type[void], modifier[public], parameter[]] begin[{]
assign[member[.menu], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Menu, sub_type=None))]
call[menu.addItem, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CancelMeasuringAction, sub_type=None))]]
local_variable[type[Layer], selectedLayer]
if[binary_operation[member[.selectedLayer], instanceof, type[VectorLayer]]] begin[{]
call[menu.addItem, parameter[ClassCreator(arguments=[Cast(expression=MemberReference(member=selectedLayer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=VectorLayer, sub_type=None)), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ToggleSnappingAction, sub_type=None))]]
else begin[{]
None
end[}]
call[mapWidget.setContextMenu, parameter[member[.menu]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[onActivate] operator[SEP] operator[SEP] {
identifier[menu] operator[=] Keyword[new] identifier[Menu] operator[SEP] operator[SEP] operator[SEP] identifier[menu] operator[SEP] identifier[addItem] operator[SEP] Keyword[new] identifier[CancelMeasuringAction] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP] identifier[Layer] identifier[selectedLayer] operator[=] identifier[mapWidget] operator[SEP] identifier[getMapModel] operator[SEP] operator[SEP] operator[SEP] identifier[getSelectedLayer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[selectedLayer] Keyword[instanceof] identifier[VectorLayer] operator[SEP] {
identifier[menu] operator[SEP] identifier[addItem] operator[SEP] Keyword[new] identifier[ToggleSnappingAction] operator[SEP] operator[SEP] identifier[VectorLayer] operator[SEP] identifier[selectedLayer] , Keyword[this] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mapWidget] operator[SEP] identifier[setContextMenu] operator[SEP] identifier[menu] operator[SEP] operator[SEP]
}
|
public static InputStream inputStreamFromURL(URL url) throws IOException
{
if ("file".equals(url.getProtocol())) {
/* As per [WSTX-82], can not do this if the path refers
* to a network drive on windows. This fixes the problem;
* might not be needed on all platforms (NFS?), but should not
* matter a lot: performance penalty of extra wrapping is more
* relevant when accessing local file system.
*/
String host = url.getHost();
if (host == null || host.length() == 0) {
/* One more test: if there are quoted characters, need
* to decoded [WSTX-207]:
*/
String path = url.getPath();
if (path.indexOf('%') >= 0) {
path = URLDecoder.decode(path, "UTF-8");
}
return new FileInputStream(path);
}
}
return url.openStream();
} | class class_name[name] begin[{]
method[inputStreamFromURL, return_type[type[InputStream]], modifier[public static], parameter[url]] begin[{]
if[literal["file"]] begin[{]
local_variable[type[String], host]
if[binary_operation[binary_operation[member[.host], ==, literal[null]], ||, binary_operation[call[host.length, parameter[]], ==, literal[0]]]] begin[{]
local_variable[type[String], path]
if[binary_operation[call[path.indexOf, parameter[literal['%']]], >=, literal[0]]] begin[{]
assign[member[.path], call[URLDecoder.decode, parameter[member[.path], literal["UTF-8"]]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[url.openStream, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InputStream] identifier[inputStreamFromURL] operator[SEP] identifier[URL] identifier[url] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[url] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[host] operator[=] identifier[url] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[host] operator[==] Other[null] operator[||] identifier[host] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[path] operator[=] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[path] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[url] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final SimpleMutableDateTime now(Clock clock)
{
ZonedDateTime zdt = ZonedDateTime.now(clock);
SimpleMutableDateTime smt = SimpleMutableDateTime.from(zdt);
return smt;
} | class class_name[name] begin[{]
method[now, return_type[type[SimpleMutableDateTime]], modifier[final public static], parameter[clock]] begin[{]
local_variable[type[ZonedDateTime], zdt]
local_variable[type[SimpleMutableDateTime], smt]
return[member[.smt]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[SimpleMutableDateTime] identifier[now] operator[SEP] identifier[Clock] identifier[clock] operator[SEP] {
identifier[ZonedDateTime] identifier[zdt] operator[=] identifier[ZonedDateTime] operator[SEP] identifier[now] operator[SEP] identifier[clock] operator[SEP] operator[SEP] identifier[SimpleMutableDateTime] identifier[smt] operator[=] identifier[SimpleMutableDateTime] operator[SEP] identifier[from] operator[SEP] identifier[zdt] operator[SEP] operator[SEP] Keyword[return] identifier[smt] operator[SEP]
}
|
public List<ViterbiNode> search(ViterbiLattice lattice) {
ViterbiNode[][] endIndexArr = calculatePathCosts(lattice);
LinkedList<ViterbiNode> result = backtrackBestPath(endIndexArr[0][0]);
return result;
} | class class_name[name] begin[{]
method[search, return_type[type[List]], modifier[public], parameter[lattice]] begin[{]
local_variable[type[ViterbiNode], endIndexArr]
local_variable[type[LinkedList], result]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[ViterbiNode] operator[>] identifier[search] operator[SEP] identifier[ViterbiLattice] identifier[lattice] operator[SEP] {
identifier[ViterbiNode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[endIndexArr] operator[=] identifier[calculatePathCosts] operator[SEP] identifier[lattice] operator[SEP] operator[SEP] identifier[LinkedList] operator[<] identifier[ViterbiNode] operator[>] identifier[result] operator[=] identifier[backtrackBestPath] operator[SEP] identifier[endIndexArr] operator[SEP] Other[0] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private static void convertHexToUnicode(String str) {
try {
display("Hex to Unicode: " + Utils.toString(Utils.base64ToBinary(Utils.base64FromHex(str))));
} catch (Exception e) {
}
} | class class_name[name] begin[{]
method[convertHexToUnicode, return_type[void], modifier[private static], parameter[str]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Hex to Unicode: "), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=base64FromHex, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None)], member=base64ToBinary, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None)], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), operator=+)], member=display, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[convertHexToUnicode] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[try] {
identifier[display] operator[SEP] literal[String] operator[+] identifier[Utils] operator[SEP] identifier[toString] operator[SEP] identifier[Utils] operator[SEP] identifier[base64ToBinary] operator[SEP] identifier[Utils] operator[SEP] identifier[base64FromHex] operator[SEP] identifier[str] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
|
@SuppressWarnings("unchecked")
public Permission getPermission(final String name) {
final Query query = pm.newQuery(Permission.class, "name == :name");
final List<Permission> result = (List<Permission>) query.execute(name);
return Collections.isEmpty(result) ? null : result.get(0);
} | class class_name[name] begin[{]
method[getPermission, return_type[type[Permission]], modifier[public], parameter[name]] begin[{]
local_variable[type[Query], query]
local_variable[type[List], result]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Permission] identifier[getPermission] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[final] identifier[Query] identifier[query] operator[=] identifier[pm] operator[SEP] identifier[newQuery] operator[SEP] identifier[Permission] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Permission] operator[>] identifier[result] operator[=] operator[SEP] identifier[List] operator[<] identifier[Permission] operator[>] operator[SEP] identifier[query] operator[SEP] identifier[execute] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[isEmpty] operator[SEP] identifier[result] operator[SEP] operator[?] Other[null] operator[:] identifier[result] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
private boolean hasValidDateRange(String time_start, String time_end, String time_duration) {
// no range
if ((null == time_start) && (null == time_end) && (null == time_duration))
return false;
if ((null != time_start) && (null != time_end))
return true;
if ((null != time_start) && (null != time_duration))
return true;
if ((null != time_end) && (null != time_duration))
return true;
// misformed range
// errs.append("Must have 2 of 3 parameters: time_start, time_end, time_duration\n");
return false;
} | class class_name[name] begin[{]
method[hasValidDateRange, return_type[type[boolean]], modifier[private], parameter[time_start, time_end, time_duration]] begin[{]
if[binary_operation[binary_operation[binary_operation[literal[null], ==, member[.time_start]], &&, binary_operation[literal[null], ==, member[.time_end]]], &&, binary_operation[literal[null], ==, member[.time_duration]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[literal[null], !=, member[.time_start]], &&, binary_operation[literal[null], !=, member[.time_end]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[literal[null], !=, member[.time_start]], &&, binary_operation[literal[null], !=, member[.time_duration]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[literal[null], !=, member[.time_end]], &&, binary_operation[literal[null], !=, member[.time_duration]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[hasValidDateRange] operator[SEP] identifier[String] identifier[time_start] , identifier[String] identifier[time_end] , identifier[String] identifier[time_duration] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] Other[null] operator[==] identifier[time_start] operator[SEP] operator[&&] operator[SEP] Other[null] operator[==] identifier[time_end] operator[SEP] operator[&&] operator[SEP] Other[null] operator[==] identifier[time_duration] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Other[null] operator[!=] identifier[time_start] operator[SEP] operator[&&] operator[SEP] Other[null] operator[!=] identifier[time_end] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Other[null] operator[!=] identifier[time_start] operator[SEP] operator[&&] operator[SEP] Other[null] operator[!=] identifier[time_duration] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Other[null] operator[!=] identifier[time_end] operator[SEP] operator[&&] operator[SEP] Other[null] operator[!=] identifier[time_duration] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
private synchronized void fireConnector(final boolean isReconnect) {
if (active && connector == null) {
getLogger().debug("Starting a new connector thread.");
connector = new Connector(isReconnect);
connector.setDaemon(true);
connector.setPriority(Thread.MIN_PRIORITY);
connector.start();
}
} | class class_name[name] begin[{]
method[fireConnector, return_type[void], modifier[synchronized private], parameter[isReconnect]] begin[{]
if[binary_operation[member[.active], &&, binary_operation[member[.connector], ==, literal[null]]]] begin[{]
call[.getLogger, parameter[]]
assign[member[.connector], ClassCreator(arguments=[MemberReference(member=isReconnect, 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=Connector, sub_type=None))]
call[connector.setDaemon, parameter[literal[true]]]
call[connector.setPriority, parameter[member[Thread.MIN_PRIORITY]]]
call[connector.start, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[synchronized] Keyword[void] identifier[fireConnector] operator[SEP] Keyword[final] Keyword[boolean] identifier[isReconnect] operator[SEP] {
Keyword[if] operator[SEP] identifier[active] operator[&&] identifier[connector] operator[==] Other[null] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[connector] operator[=] Keyword[new] identifier[Connector] operator[SEP] identifier[isReconnect] operator[SEP] operator[SEP] identifier[connector] operator[SEP] identifier[setDaemon] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[connector] operator[SEP] identifier[setPriority] operator[SEP] identifier[Thread] operator[SEP] identifier[MIN_PRIORITY] operator[SEP] operator[SEP] identifier[connector] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public static GoogleLogger forInjectedClassName(String className) {
checkArgument(!className.isEmpty(), "injected class name is empty");
// The injected class name is in binary form (e.g. java/util/Map$Entry) to re-use
// constant pool entries.
return new GoogleLogger(Platform.getBackend(className.replace('/', '.')));
} | class class_name[name] begin[{]
method[forInjectedClassName, return_type[type[GoogleLogger]], modifier[public static], parameter[className]] begin[{]
call[.checkArgument, parameter[call[className.isEmpty, parameter[]], literal["injected class name is empty"]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=replace, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None)], member=getBackend, postfix_operators=[], prefix_operators=[], qualifier=Platform, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GoogleLogger, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[GoogleLogger] identifier[forInjectedClassName] operator[SEP] identifier[String] identifier[className] operator[SEP] {
identifier[checkArgument] operator[SEP] operator[!] identifier[className] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[GoogleLogger] operator[SEP] identifier[Platform] operator[SEP] identifier[getBackend] operator[SEP] identifier[className] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static ObjectType getInstanceOfCtor(@Nullable JSType t) {
if (t == null) {
return null;
}
FunctionType ctor = JSType.toMaybeFunctionType(t.dereference());
if (ctor != null && ctor.isConstructor()) {
return ctor.getInstanceType();
}
return null;
} | class class_name[name] begin[{]
method[getInstanceOfCtor, return_type[type[ObjectType]], modifier[static], parameter[t]] begin[{]
if[binary_operation[member[.t], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[FunctionType], ctor]
if[binary_operation[binary_operation[member[.ctor], !=, literal[null]], &&, call[ctor.isConstructor, parameter[]]]] begin[{]
return[call[ctor.getInstanceType, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[static] identifier[ObjectType] identifier[getInstanceOfCtor] operator[SEP] annotation[@] identifier[Nullable] identifier[JSType] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[FunctionType] identifier[ctor] operator[=] identifier[JSType] operator[SEP] identifier[toMaybeFunctionType] operator[SEP] identifier[t] operator[SEP] identifier[dereference] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctor] operator[!=] Other[null] operator[&&] identifier[ctor] operator[SEP] identifier[isConstructor] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ctor] operator[SEP] identifier[getInstanceType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
private static synchronized void setKlovReport() {
if (extentReports == null) {
//Extent reports object not found. call setExtentReport() first
return;
}
ExtentProperties extentProperties = ExtentProperties.INSTANCE;
//if reporter is not null that means it is already attached
if (klovReporter != null) {
//Already attached, attaching it again will create a new build/klov report
return;
}
if (extentProperties.getKlovServerUrl() != null) {
String hostname = extentProperties.getMongodbHost();
int port = extentProperties.getMongodbPort();
String database = extentProperties.getMongodbDatabase();
String username = extentProperties.getMongodbUsername();
String password = extentProperties.getMongodbPassword();
try {
//Create a new KlovReporter object
klovReporter = new KlovReporter();
if (username != null && password != null) {
MongoClientURI uri = new MongoClientURI("mongodb://" + username + ":" + password + "@" + hostname + ":" + port + "/?authSource=" + database);
klovReporter.initMongoDbConnection(uri);
} else {
klovReporter.initMongoDbConnection(hostname, port);
}
klovReporter.setProjectName(extentProperties.getKlovProjectName());
klovReporter.setReportName(extentProperties.getKlovReportName());
klovReporter.setKlovUrl(extentProperties.getKlovServerUrl());
extentReports.attachReporter(klovReporter);
} catch (Exception ex) {
klovReporter = null;
throw new IllegalArgumentException("Error setting up Klov Reporter", ex);
}
}
} | class class_name[name] begin[{]
method[setKlovReport, return_type[void], modifier[synchronized private static], parameter[]] begin[{]
if[binary_operation[member[.extentReports], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[ExtentProperties], extentProperties]
if[binary_operation[member[.klovReporter], !=, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[extentProperties.getKlovServerUrl, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], hostname]
local_variable[type[int], port]
local_variable[type[String], database]
local_variable[type[String], username]
local_variable[type[String], password]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=klovReporter, 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=KlovReporter, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hostname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initMongoDbConnection, postfix_operators=[], prefix_operators=[], qualifier=klovReporter, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mongodb://"), operandr=MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="@"), operator=+), operandr=MemberReference(member=hostname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/?authSource="), operator=+), operandr=MemberReference(member=database, 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=MongoClientURI, sub_type=None)), name=uri)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MongoClientURI, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initMongoDbConnection, postfix_operators=[], prefix_operators=[], qualifier=klovReporter, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKlovProjectName, postfix_operators=[], prefix_operators=[], qualifier=extentProperties, selectors=[], type_arguments=None)], member=setProjectName, postfix_operators=[], prefix_operators=[], qualifier=klovReporter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKlovReportName, postfix_operators=[], prefix_operators=[], qualifier=extentProperties, selectors=[], type_arguments=None)], member=setReportName, postfix_operators=[], prefix_operators=[], qualifier=klovReporter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKlovServerUrl, postfix_operators=[], prefix_operators=[], qualifier=extentProperties, selectors=[], type_arguments=None)], member=setKlovUrl, postfix_operators=[], prefix_operators=[], qualifier=klovReporter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=klovReporter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attachReporter, postfix_operators=[], prefix_operators=[], qualifier=extentReports, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=klovReporter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error setting up Klov Reporter"), 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[synchronized] Keyword[void] identifier[setKlovReport] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[extentReports] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[ExtentProperties] identifier[extentProperties] operator[=] identifier[ExtentProperties] operator[SEP] identifier[INSTANCE] operator[SEP] Keyword[if] operator[SEP] identifier[klovReporter] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[extentProperties] operator[SEP] identifier[getKlovServerUrl] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[hostname] operator[=] identifier[extentProperties] operator[SEP] identifier[getMongodbHost] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[port] operator[=] identifier[extentProperties] operator[SEP] identifier[getMongodbPort] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[database] operator[=] identifier[extentProperties] operator[SEP] identifier[getMongodbDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[username] operator[=] identifier[extentProperties] operator[SEP] identifier[getMongodbUsername] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[password] operator[=] identifier[extentProperties] operator[SEP] identifier[getMongodbPassword] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[klovReporter] operator[=] Keyword[new] identifier[KlovReporter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[username] operator[!=] Other[null] operator[&&] identifier[password] operator[!=] Other[null] operator[SEP] {
identifier[MongoClientURI] identifier[uri] operator[=] Keyword[new] identifier[MongoClientURI] operator[SEP] literal[String] operator[+] identifier[username] operator[+] literal[String] operator[+] identifier[password] operator[+] literal[String] operator[+] identifier[hostname] operator[+] literal[String] operator[+] identifier[port] operator[+] literal[String] operator[+] identifier[database] operator[SEP] operator[SEP] identifier[klovReporter] operator[SEP] identifier[initMongoDbConnection] operator[SEP] identifier[uri] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[klovReporter] operator[SEP] identifier[initMongoDbConnection] operator[SEP] identifier[hostname] , identifier[port] operator[SEP] operator[SEP]
}
identifier[klovReporter] operator[SEP] identifier[setProjectName] operator[SEP] identifier[extentProperties] operator[SEP] identifier[getKlovProjectName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[klovReporter] operator[SEP] identifier[setReportName] operator[SEP] identifier[extentProperties] operator[SEP] identifier[getKlovReportName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[klovReporter] operator[SEP] identifier[setKlovUrl] operator[SEP] identifier[extentProperties] operator[SEP] identifier[getKlovServerUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[extentReports] operator[SEP] identifier[attachReporter] operator[SEP] identifier[klovReporter] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[klovReporter] operator[=] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
}
|
private static boolean compareUnorderedCollection(Collection col1, Collection col2, Deque stack, Set visited)
{
// Same instance check already performed...
if (col1.size() != col2.size())
{
return false;
}
Map<Integer, Collection> fastLookup = new HashMap<>();
for (Object o : col2)
{
int hash = deepHashCode(o);
Collection items = fastLookup.get(hash);
if (items == null)
{
items = new ArrayList();
fastLookup.put(hash, items);
}
items.add(o);
}
for (Object o : col1)
{
Collection other = fastLookup.get(deepHashCode(o));
if (other == null || other.isEmpty())
{ // fail fast: item not even found in other Collection, no need to continue.
return false;
}
if (other.size() == 1)
{ // no hash collision, items must be equivalent or deepEquals is false
DualKey dk = new DualKey(o, other.iterator().next());
if (!visited.contains(dk))
{ // Place items on 'stack' for future equality comparison.
stack.addFirst(dk);
}
}
else
{ // hash collision: try all collided items against the current item (if 1 equals, we are good - remove it
// from collision list, making further comparisons faster)
if (!isContained(o, other))
{
return false;
}
}
}
return true;
} | class class_name[name] begin[{]
method[compareUnorderedCollection, return_type[type[boolean]], modifier[private static], parameter[col1, col2, stack, visited]] begin[{]
if[binary_operation[call[col1.size, parameter[]], !=, call[col2.size, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Map], fastLookup]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deepHashCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=hash)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=fastLookup, selectors=[], type_arguments=None), name=items)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=items, 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=items, 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=ArrayList, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=fastLookup, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=col2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deepHashCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=fastLookup, selectors=[], type_arguments=None), name=other)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=other, 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=false), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isContained, 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)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[MethodInvocation(arguments=[], member=next, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DualKey, sub_type=None)), name=dk)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DualKey, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=dk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=visited, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addFirst, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=col1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[compareUnorderedCollection] operator[SEP] identifier[Collection] identifier[col1] , identifier[Collection] identifier[col2] , identifier[Deque] identifier[stack] , identifier[Set] identifier[visited] operator[SEP] {
Keyword[if] operator[SEP] identifier[col1] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[col2] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Map] operator[<] identifier[Integer] , identifier[Collection] operator[>] identifier[fastLookup] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[col2] operator[SEP] {
Keyword[int] identifier[hash] operator[=] identifier[deepHashCode] operator[SEP] identifier[o] operator[SEP] operator[SEP] identifier[Collection] identifier[items] operator[=] identifier[fastLookup] operator[SEP] identifier[get] operator[SEP] identifier[hash] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
identifier[items] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[fastLookup] operator[SEP] identifier[put] operator[SEP] identifier[hash] , identifier[items] operator[SEP] operator[SEP]
}
identifier[items] operator[SEP] identifier[add] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[col1] operator[SEP] {
identifier[Collection] identifier[other] operator[=] identifier[fastLookup] operator[SEP] identifier[get] operator[SEP] identifier[deepHashCode] operator[SEP] identifier[o] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[other] operator[==] Other[null] operator[||] identifier[other] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[other] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[DualKey] identifier[dk] operator[=] Keyword[new] identifier[DualKey] operator[SEP] identifier[o] , identifier[other] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[visited] operator[SEP] identifier[contains] operator[SEP] identifier[dk] operator[SEP] operator[SEP] {
identifier[stack] operator[SEP] identifier[addFirst] operator[SEP] identifier[dk] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[isContained] operator[SEP] identifier[o] , identifier[other] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Ticket[] take() throws InterruptedException {
Ticket[] tickets = new Ticket[buckets.size()];
for (int i=0; i<tickets.length; i++) {
tickets[i] = buckets.get(i).take();
}
return tickets;
} | class class_name[name] begin[{]
method[take, return_type[type[Ticket]], modifier[public], parameter[]] begin[{]
local_variable[type[Ticket], tickets]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tickets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=buckets, selectors=[MethodInvocation(arguments=[], member=take, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tickets, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.tickets]]
end[}]
END[}] | Keyword[public] identifier[Ticket] operator[SEP] operator[SEP] identifier[take] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] {
identifier[Ticket] operator[SEP] operator[SEP] identifier[tickets] operator[=] Keyword[new] identifier[Ticket] operator[SEP] identifier[buckets] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[tickets] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[tickets] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[buckets] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[take] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tickets] operator[SEP]
}
|
public static Builder forClass(Class clazz) {
if (clazz == null) {
throw new IllegalArgumentException("class can not be null");
}
return new Builder(Collections.singletonList(clazz));
} | class class_name[name] begin[{]
method[forClass, return_type[type[Builder]], modifier[public static], parameter[clazz]] begin[{]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="class can not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=singletonList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Builder] identifier[forClass] operator[SEP] identifier[Class] identifier[clazz] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Builder] operator[SEP] identifier[Collections] operator[SEP] identifier[singletonList] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String javaRepeatedEnumValueGetterByIndexName(Field field) {
if (field.isRepeated()) {
return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + VALUE;
}
throw new IllegalArgumentException(field.toString());
} | class class_name[name] begin[{]
method[javaRepeatedEnumValueGetterByIndexName, return_type[type[String]], modifier[public static], parameter[field]] begin[{]
if[call[field.isRepeated, parameter[]]] begin[{]
return[binary_operation[binary_operation[member[.GETTER_PREFIX], +, call[Formatter.toPascalCase, parameter[call[field.getName, parameter[]]]]], +, member[.VALUE]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[javaRepeatedEnumValueGetterByIndexName] operator[SEP] identifier[Field] identifier[field] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[SEP] identifier[isRepeated] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[GETTER_PREFIX] operator[+] identifier[Formatter] operator[SEP] identifier[toPascalCase] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[+] identifier[VALUE] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[field] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String readSettings(String root, String index, String jsonFile) {
logger.trace("Reading [{}] for [{}] in [{}]...", jsonFile, index, root);
String settingsFile = root + "/" + index + "/" + jsonFile;
return readFileFromClasspath(settingsFile);
} | class class_name[name] begin[{]
method[readSettings, return_type[type[String]], modifier[public static], parameter[root, index, jsonFile]] begin[{]
call[logger.trace, parameter[literal["Reading [{}] for [{}] in [{}]..."], member[.jsonFile], member[.index], member[.root]]]
local_variable[type[String], settingsFile]
return[call[.readFileFromClasspath, parameter[member[.settingsFile]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[readSettings] operator[SEP] identifier[String] identifier[root] , identifier[String] identifier[index] , identifier[String] identifier[jsonFile] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[jsonFile] , identifier[index] , identifier[root] operator[SEP] operator[SEP] identifier[String] identifier[settingsFile] operator[=] identifier[root] operator[+] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[+] identifier[jsonFile] operator[SEP] Keyword[return] identifier[readFileFromClasspath] operator[SEP] identifier[settingsFile] operator[SEP] operator[SEP]
}
|
public Observable<CertificateBundle> restoreCertificateAsync(String vaultBaseUrl, byte[] certificateBundleBackup) {
return restoreCertificateWithServiceResponseAsync(vaultBaseUrl, certificateBundleBackup).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() {
@Override
public CertificateBundle call(ServiceResponse<CertificateBundle> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[restoreCertificateAsync, return_type[type[Observable]], modifier[public], parameter[vaultBaseUrl, certificateBundleBackup]] begin[{]
return[call[.restoreCertificateWithServiceResponseAsync, parameter[member[.vaultBaseUrl], member[.certificateBundleBackup]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[CertificateBundle] operator[>] identifier[restoreCertificateAsync] operator[SEP] identifier[String] identifier[vaultBaseUrl] , Keyword[byte] operator[SEP] operator[SEP] identifier[certificateBundleBackup] operator[SEP] {
Keyword[return] identifier[restoreCertificateWithServiceResponseAsync] operator[SEP] identifier[vaultBaseUrl] , identifier[certificateBundleBackup] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[CertificateBundle] operator[>] , identifier[CertificateBundle] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[CertificateBundle] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[CertificateBundle] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Trivial
public PriorityConverter addConverter(PriorityConverter converter) {
PriorityConverter existing = _addConverter(converter);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Converter added to map @ priority {0}: {1}={2}", existing.getPriority(), existing.getType(), existing);
}
return existing;
} | class class_name[name] begin[{]
method[addConverter, return_type[type[PriorityConverter]], modifier[public], parameter[converter]] begin[{]
local_variable[type[PriorityConverter], existing]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Converter added to map @ priority {0}: {1}={2}"], call[existing.getPriority, parameter[]], call[existing.getType, parameter[]], member[.existing]]]
else begin[{]
None
end[}]
return[member[.existing]]
end[}]
END[}] | annotation[@] identifier[Trivial] Keyword[public] identifier[PriorityConverter] identifier[addConverter] operator[SEP] identifier[PriorityConverter] identifier[converter] operator[SEP] {
identifier[PriorityConverter] identifier[existing] operator[=] identifier[_addConverter] operator[SEP] identifier[converter] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[existing] operator[SEP] identifier[getPriority] operator[SEP] operator[SEP] , identifier[existing] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[existing] operator[SEP] operator[SEP]
}
Keyword[return] identifier[existing] operator[SEP]
}
|
static char regularize(char input,boolean lowercase){
if (input == 12288) {
input = (char) 32;
}else if (input > 65280 && input < 65375) {
input = (char) (input - 65248);
}else if (input >= 'A' && input <= 'Z' && lowercase) {
input += 32;
}
return input;
} | class class_name[name] begin[{]
method[regularize, return_type[type[char]], modifier[static], parameter[input, lowercase]] begin[{]
if[binary_operation[member[.input], ==, literal[12288]]] begin[{]
assign[member[.input], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), type=BasicType(dimensions=[], name=char))]
else begin[{]
if[binary_operation[binary_operation[member[.input], >, literal[65280]], &&, binary_operation[member[.input], <, literal[65375]]]] begin[{]
assign[member[.input], Cast(expression=BinaryOperation(operandl=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=65248), operator=-), type=BasicType(dimensions=[], name=char))]
else begin[{]
if[binary_operation[binary_operation[binary_operation[member[.input], >=, literal['A']], &&, binary_operation[member[.input], <=, literal['Z']]], &&, member[.lowercase]]] begin[{]
assign[member[.input], literal[32]]
else begin[{]
None
end[}]
end[}]
end[}]
return[member[.input]]
end[}]
END[}] | Keyword[static] Keyword[char] identifier[regularize] operator[SEP] Keyword[char] identifier[input] , Keyword[boolean] identifier[lowercase] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[==] Other[12288] operator[SEP] {
identifier[input] operator[=] operator[SEP] Keyword[char] operator[SEP] Other[32] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] operator[>] Other[65280] operator[&&] identifier[input] operator[<] Other[65375] operator[SEP] {
identifier[input] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[input] operator[-] Other[65248] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] operator[>=] literal[String] operator[&&] identifier[input] operator[<=] literal[String] operator[&&] identifier[lowercase] operator[SEP] {
identifier[input] operator[+=] Other[32] operator[SEP]
}
Keyword[return] identifier[input] operator[SEP]
}
|
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final File file = new File(model);
String key;
boolean ok;
switch (this.type) {
case MUST_EXIST:
key = "FILE_DOES_NOT_EXIST"; // NOI18N
ok = file.exists();
break;
case MUST_BE_DIRECTORY:
key = "FILE_IS_NOT_A_DIRECTORY"; // NOI18N
ok = file.isDirectory();
break;
case MUST_BE_FILE:
key = "FILE_IS_NOT_A_FILE"; // NOI18N
ok = file.isFile();
break;
case MUST_NOT_EXIST:
key = "FILE_EXISTS"; // NOI18N
ok = !file.exists();
break;
default:
throw new AssertionError();
}
if (!ok) {
final String problem = ValidationBundle.getMessage(FileValidator.class, key, file.getName());
problems.add(problem, Severity.FATAL);
}
return ok;
} | class class_name[name] begin[{]
method[validate, return_type[type[boolean]], modifier[public], parameter[problems, compName, model]] begin[{]
local_variable[type[File], file]
local_variable[type[String], key]
local_variable[type[boolean], ok]
SwitchStatement(cases=[SwitchStatementCase(case=['MUST_EXIST'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FILE_DOES_NOT_EXIST")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MUST_BE_DIRECTORY'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FILE_IS_NOT_A_DIRECTORY")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MUST_BE_FILE'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FILE_IS_NOT_A_FILE")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=isFile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MUST_NOT_EXIST'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FILE_EXISTS")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=file, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssertionError, sub_type=None)), label=None)])], expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=type, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)
if[member[.ok]] begin[{]
local_variable[type[String], problem]
call[problems.add, parameter[member[.problem], member[Severity.FATAL]]]
else begin[{]
None
end[}]
return[member[.ok]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[validate] operator[SEP] Keyword[final] identifier[Problems] identifier[problems] , Keyword[final] identifier[String] identifier[compName] , Keyword[final] identifier[String] identifier[model] operator[SEP] {
Keyword[final] identifier[File] identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[String] identifier[key] operator[SEP] Keyword[boolean] identifier[ok] operator[SEP] Keyword[switch] operator[SEP] Keyword[this] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[MUST_EXIST] operator[:] identifier[key] operator[=] literal[String] operator[SEP] identifier[ok] operator[=] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MUST_BE_DIRECTORY] operator[:] identifier[key] operator[=] literal[String] operator[SEP] identifier[ok] operator[=] identifier[file] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MUST_BE_FILE] operator[:] identifier[key] operator[=] literal[String] operator[SEP] identifier[ok] operator[=] identifier[file] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MUST_NOT_EXIST] operator[:] identifier[key] operator[=] literal[String] operator[SEP] identifier[ok] operator[=] operator[!] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[AssertionError] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[ok] operator[SEP] {
Keyword[final] identifier[String] identifier[problem] operator[=] identifier[ValidationBundle] operator[SEP] identifier[getMessage] operator[SEP] identifier[FileValidator] operator[SEP] Keyword[class] , identifier[key] , identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[problems] operator[SEP] identifier[add] operator[SEP] identifier[problem] , identifier[Severity] operator[SEP] identifier[FATAL] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ok] operator[SEP]
}
|
public BufferSizePredictor getBufferSizePredictor(Class<?> type) {
MarshallingType marshallingType = typeHints.get(type);
if (marshallingType == null) {
// Initialise with isMarshallable to null, meaning it's unknown
marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredictor());
MarshallingType prev = typeHints.putIfAbsent(type, marshallingType);
if (prev != null) {
marshallingType = prev;
} else {
if (trace) {
log.tracef("Cache a buffer size predictor for '%s' assuming " +
"its serializability is unknown", type.getName());
}
}
}
return marshallingType.sizePredictor;
} | class class_name[name] begin[{]
method[getBufferSizePredictor, return_type[type[BufferSizePredictor]], modifier[public], parameter[type]] begin[{]
local_variable[type[MarshallingType], marshallingType]
if[binary_operation[member[.marshallingType], ==, literal[null]]] begin[{]
assign[member[.marshallingType], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AdaptiveBufferSizePredictor, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MarshallingType, sub_type=None))]
local_variable[type[MarshallingType], prev]
if[binary_operation[member[.prev], !=, literal[null]]] begin[{]
assign[member[.marshallingType], member[.prev]]
else begin[{]
if[member[.trace]] begin[{]
call[log.tracef, parameter[binary_operation[literal["Cache a buffer size predictor for '%s' assuming "], +, literal["its serializability is unknown"]], call[type.getName, parameter[]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[marshallingType.sizePredictor]]
end[}]
END[}] | Keyword[public] identifier[BufferSizePredictor] identifier[getBufferSizePredictor] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
identifier[MarshallingType] identifier[marshallingType] operator[=] identifier[typeHints] operator[SEP] identifier[get] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[marshallingType] operator[==] Other[null] operator[SEP] {
identifier[marshallingType] operator[=] Keyword[new] identifier[MarshallingType] operator[SEP] Other[null] , Keyword[new] identifier[AdaptiveBufferSizePredictor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MarshallingType] identifier[prev] operator[=] identifier[typeHints] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[type] , identifier[marshallingType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prev] operator[!=] Other[null] operator[SEP] {
identifier[marshallingType] operator[=] identifier[prev] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[trace] operator[SEP] {
identifier[log] operator[SEP] identifier[tracef] operator[SEP] literal[String] operator[+] literal[String] , identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[marshallingType] operator[SEP] identifier[sizePredictor] operator[SEP]
}
|
private static String registryGet32StringValue(com.sun.jna.platform.win32.WinReg.HKEY root, String key, String value)
throws com.sun.jna.platform.win32.Win32Exception {
com.sun.jna.platform.win32.WinReg.HKEYByReference phkKey = new com.sun.jna.platform.win32.WinReg.HKEYByReference();
int rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0,
com.sun.jna.platform.win32.WinNT.KEY_READ | com.sun.jna.platform.win32.WinNT.KEY_WOW64_32KEY, phkKey);
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
try {
return com.sun.jna.platform.win32.Advapi32Util.registryGetStringValue(phkKey.getValue(), value);
} finally {
rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
}
} | class class_name[name] begin[{]
method[registryGet32StringValue, return_type[type[String]], modifier[private static], parameter[root, key, value]] begin[{]
local_variable[type[com], phkKey]
local_variable[type[int], rc]
if[binary_operation[member[.rc], !=, member[com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=rc, 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=sun, sub_type=ReferenceType(arguments=None, dimensions=None, name=jna, sub_type=ReferenceType(arguments=None, dimensions=None, name=platform, sub_type=ReferenceType(arguments=None, dimensions=None, name=win32, sub_type=ReferenceType(arguments=None, dimensions=None, name=Win32Exception, sub_type=None))))))), label=None)
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=phkKey, selectors=[], type_arguments=None), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registryGetStringValue, postfix_operators=[], prefix_operators=[], qualifier=com.sun.jna.platform.win32.Advapi32Util, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=phkKey, selectors=[], type_arguments=None)], member=RegCloseKey, postfix_operators=[], prefix_operators=[], qualifier=com.sun.jna.platform.win32.Advapi32.INSTANCE, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ERROR_SUCCESS, postfix_operators=[], prefix_operators=[], qualifier=com.sun.jna.platform.win32.W32Errors, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=rc, 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=sun, sub_type=ReferenceType(arguments=None, dimensions=None, name=jna, sub_type=ReferenceType(arguments=None, dimensions=None, name=platform, sub_type=ReferenceType(arguments=None, dimensions=None, name=win32, sub_type=ReferenceType(arguments=None, dimensions=None, name=Win32Exception, sub_type=None))))))), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[registryGet32StringValue] operator[SEP] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[WinReg] operator[SEP] identifier[HKEY] identifier[root] , identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Win32Exception] {
identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[WinReg] operator[SEP] identifier[HKEYByReference] identifier[phkKey] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[WinReg] operator[SEP] identifier[HKEYByReference] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[rc] operator[=] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Advapi32] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[RegOpenKeyEx] operator[SEP] identifier[root] , identifier[key] , Other[0] , identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[WinNT] operator[SEP] identifier[KEY_READ] operator[|] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[WinNT] operator[SEP] identifier[KEY_WOW64_32KEY] , identifier[phkKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[!=] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[W32Errors] operator[SEP] identifier[ERROR_SUCCESS] operator[SEP] {
Keyword[throw] Keyword[new] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Win32Exception] operator[SEP] identifier[rc] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Advapi32Util] operator[SEP] identifier[registryGetStringValue] operator[SEP] identifier[phkKey] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[rc] operator[=] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Advapi32] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[RegCloseKey] operator[SEP] identifier[phkKey] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[!=] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[W32Errors] operator[SEP] identifier[ERROR_SUCCESS] operator[SEP] {
Keyword[throw] Keyword[new] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[jna] operator[SEP] identifier[platform] operator[SEP] identifier[win32] operator[SEP] identifier[Win32Exception] operator[SEP] identifier[rc] operator[SEP] operator[SEP]
}
}
}
|
public void openFLACStream() throws IOException {
streamLock.lock();
try {
//reset all data.
reset();
flacStreamIsOpen = true;
//write FLAC stream identifier
out.write(FLAC_id.getData(), 0, FLAC_id.getUsableBits()/8);
//write stream headers. These must be updated at close of stream
byte[] md5Hash = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//blank hash. Don't know it yet.
EncodedElement streamInfo = MetadataBlockStreamInfo.getStreamInfo(
streamConfig, minFrameSize, maxFrameSize, samplesInStream, md5Hash);
//mark stream info location(so we can return to it and re-write headers,
// assuming stream is seekable. Then write header.
int size = streamInfo.getUsableBits()/8;
EncodedElement metadataBlockHeader =
MetadataBlockHeader.getMetadataBlockHeader(false,
MetadataBlockHeader.MetadataBlockType.STREAMINFO, size);
this.writeDataToOutput(metadataBlockHeader);
streamHeaderPos = out.getPos();
out.write(streamInfo.getData(), 0, size);
writePaddingToFoolJFlac();
}finally {
streamLock.unlock();
}
} | class class_name[name] begin[{]
method[openFLACStream, return_type[void], modifier[public], parameter[]] begin[{]
call[streamLock.lock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=flacStreamIsOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=FLAC_id, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getUsableBits, postfix_operators=[], prefix_operators=[], qualifier=FLAC_id, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=/)], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)]), name=md5Hash)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=streamConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minFrameSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxFrameSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=samplesInStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=md5Hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getStreamInfo, postfix_operators=[], prefix_operators=[], qualifier=MetadataBlockStreamInfo, selectors=[], type_arguments=None), name=streamInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EncodedElement, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getUsableBits, postfix_operators=[], prefix_operators=[], qualifier=streamInfo, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=/), name=size)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=STREAMINFO, postfix_operators=[], prefix_operators=[], qualifier=MetadataBlockHeader.MetadataBlockType, selectors=[]), MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMetadataBlockHeader, postfix_operators=[], prefix_operators=[], qualifier=MetadataBlockHeader, selectors=[], type_arguments=None), name=metadataBlockHeader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EncodedElement, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=metadataBlockHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeDataToOutput, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=streamHeaderPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getPos, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=streamInfo, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writePaddingToFoolJFlac, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=streamLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[openFLACStream] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[streamLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[flacStreamIsOpen] operator[=] literal[boolean] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[FLAC_id] operator[SEP] identifier[getData] operator[SEP] operator[SEP] , Other[0] , identifier[FLAC_id] operator[SEP] identifier[getUsableBits] operator[SEP] operator[SEP] operator[/] Other[8] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[md5Hash] operator[=] {
Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0] , Other[0]
} operator[SEP] identifier[EncodedElement] identifier[streamInfo] operator[=] identifier[MetadataBlockStreamInfo] operator[SEP] identifier[getStreamInfo] operator[SEP] identifier[streamConfig] , identifier[minFrameSize] , identifier[maxFrameSize] , identifier[samplesInStream] , identifier[md5Hash] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[streamInfo] operator[SEP] identifier[getUsableBits] operator[SEP] operator[SEP] operator[/] Other[8] operator[SEP] identifier[EncodedElement] identifier[metadataBlockHeader] operator[=] identifier[MetadataBlockHeader] operator[SEP] identifier[getMetadataBlockHeader] operator[SEP] literal[boolean] , identifier[MetadataBlockHeader] operator[SEP] identifier[MetadataBlockType] operator[SEP] identifier[STREAMINFO] , identifier[size] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writeDataToOutput] operator[SEP] identifier[metadataBlockHeader] operator[SEP] operator[SEP] identifier[streamHeaderPos] operator[=] identifier[out] operator[SEP] identifier[getPos] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[streamInfo] operator[SEP] identifier[getData] operator[SEP] operator[SEP] , Other[0] , identifier[size] operator[SEP] operator[SEP] identifier[writePaddingToFoolJFlac] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[streamLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void addComponentInterceptors(List<InterceptorFactory> factory, int priority, boolean publicOnly) {
for (Method method : (Iterable<Method>)classIndex.getClassMethods()) {
if (publicOnly && !Modifier.isPublic(method.getModifiers())) {
continue;
}
OrderedItemContainer<List<InterceptorFactory>> interceptors = componentInterceptors.get(method);
if (interceptors == null) {
componentInterceptors.put(method, interceptors = new OrderedItemContainer<List<InterceptorFactory>>());
}
interceptors.add(factory, priority);
}
} | class class_name[name] begin[{]
method[addComponentInterceptors, return_type[void], modifier[public], parameter[factory, priority, publicOnly]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=publicOnly, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getModifiers, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)], member=isPublic, postfix_operators=[], prefix_operators=['!'], qualifier=Modifier, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=componentInterceptors, selectors=[], type_arguments=None), name=interceptors)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InterceptorFactory, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=OrderedItemContainer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interceptors, 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=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Assignment(expressionl=MemberReference(member=interceptors, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InterceptorFactory, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=OrderedItemContainer, sub_type=None)))], member=put, postfix_operators=[], prefix_operators=[], qualifier=componentInterceptors, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=factory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=priority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=interceptors, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=Cast(expression=MethodInvocation(arguments=[], member=getClassMethods, postfix_operators=[], prefix_operators=[], qualifier=classIndex, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))], dimensions=[], name=Iterable, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addComponentInterceptors] operator[SEP] identifier[List] operator[<] identifier[InterceptorFactory] operator[>] identifier[factory] , Keyword[int] identifier[priority] , Keyword[boolean] identifier[publicOnly] operator[SEP] {
Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] operator[SEP] identifier[Iterable] operator[<] identifier[Method] operator[>] operator[SEP] identifier[classIndex] operator[SEP] identifier[getClassMethods] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[publicOnly] operator[&&] operator[!] identifier[Modifier] operator[SEP] identifier[isPublic] operator[SEP] identifier[method] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[OrderedItemContainer] operator[<] identifier[List] operator[<] identifier[InterceptorFactory] operator[>] operator[>] identifier[interceptors] operator[=] identifier[componentInterceptors] operator[SEP] identifier[get] operator[SEP] identifier[method] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interceptors] operator[==] Other[null] operator[SEP] {
identifier[componentInterceptors] operator[SEP] identifier[put] operator[SEP] identifier[method] , identifier[interceptors] operator[=] Keyword[new] identifier[OrderedItemContainer] operator[<] identifier[List] operator[<] identifier[InterceptorFactory] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[interceptors] operator[SEP] identifier[add] operator[SEP] identifier[factory] , identifier[priority] operator[SEP] operator[SEP]
}
}
|
protected static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent, JSONConfig config) throws JSONException, IOException {
if (value == null || value instanceof JSONNull) {
writer.write(JSONNull.NULL.toString());
} else if (value instanceof JSON) {
((JSON) value).write(writer, indentFactor, indent);
} else if (value instanceof Map) {
new JSONObject((Map<?, ?>) value).write(writer, indentFactor, indent);
} else if (value instanceof Iterable || value instanceof Iterator || value.getClass().isArray()) {
new JSONArray(value).write(writer, indentFactor, indent);
} else if (value instanceof Number) {
writer.write(NumberUtil.toStr((Number) value));
} else if (value instanceof Date || value instanceof Calendar) {
final String format = (null == config) ? null : config.getDateFormat();
writer.write(formatDate(value, format));
} else if (value instanceof Boolean) {
writer.write(value.toString());
} else if (value instanceof JSONString) {
Object o;
try {
o = ((JSONString) value).toJSONString();
} catch (Exception e) {
throw new JSONException(e);
}
writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
} else {
JSONUtil.quote(value.toString(), writer);
}
return writer;
} | class class_name[name] begin[{]
method[writeValue, return_type[type[Writer]], modifier[final static protected], parameter[writer, value, indentFactor, indent, config]] begin[{]
if[binary_operation[binary_operation[member[.value], ==, literal[null]], ||, binary_operation[member[.value], instanceof, type[JSONNull]]]] begin[{]
call[writer.write, parameter[call[JSONNull.NULL.toString, parameter[]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[JSON]]] begin[{]
Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSON, sub_type=None))
else begin[{]
if[binary_operation[member[.value], instanceof, type[Map]]] begin[{]
ClassCreator(arguments=[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Map, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=indentFactor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JSONObject, sub_type=None))
else begin[{]
if[binary_operation[binary_operation[binary_operation[member[.value], instanceof, type[Iterable]], ||, binary_operation[member[.value], instanceof, type[Iterator]]], ||, call[value.getClass, parameter[]]]] begin[{]
ClassCreator(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=indentFactor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JSONArray, sub_type=None))
else begin[{]
if[binary_operation[member[.value], instanceof, type[Number]]] begin[{]
call[writer.write, parameter[call[NumberUtil.toStr, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))]]]]
else begin[{]
if[binary_operation[binary_operation[member[.value], instanceof, type[Date]], ||, binary_operation[member[.value], instanceof, type[Calendar]]]] begin[{]
local_variable[type[String], format]
call[writer.write, parameter[call[.formatDate, parameter[member[.value], member[.format]]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Boolean]]] begin[{]
call[writer.write, parameter[call[value.toString, parameter[]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[JSONString]]] begin[{]
local_variable[type[Object], o]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSONString, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[writer.write, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=quote, postfix_operators=[], prefix_operators=[], qualifier=JSONUtil, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None))]]
else begin[{]
call[JSONUtil.quote, parameter[call[value.toString, parameter[]], member[.writer]]]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
return[member[.writer]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[final] identifier[Writer] identifier[writeValue] operator[SEP] identifier[Writer] identifier[writer] , identifier[Object] identifier[value] , Keyword[int] identifier[indentFactor] , Keyword[int] identifier[indent] , identifier[JSONConfig] identifier[config] operator[SEP] Keyword[throws] identifier[JSONException] , identifier[IOException] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[||] identifier[value] Keyword[instanceof] identifier[JSONNull] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[JSONNull] operator[SEP] identifier[NULL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[JSON] operator[SEP] {
operator[SEP] operator[SEP] identifier[JSON] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[writer] , identifier[indentFactor] , identifier[indent] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Map] operator[SEP] {
Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] identifier[Map] operator[<] operator[?] , operator[?] operator[>] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[writer] , identifier[indentFactor] , identifier[indent] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Iterable] operator[||] identifier[value] Keyword[instanceof] identifier[Iterator] operator[||] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[new] identifier[JSONArray] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[writer] , identifier[indentFactor] , identifier[indent] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Number] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[NumberUtil] operator[SEP] identifier[toStr] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Date] operator[||] identifier[value] Keyword[instanceof] identifier[Calendar] operator[SEP] {
Keyword[final] identifier[String] identifier[format] operator[=] operator[SEP] Other[null] operator[==] identifier[config] operator[SEP] operator[?] Other[null] operator[:] identifier[config] operator[SEP] identifier[getDateFormat] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[formatDate] operator[SEP] identifier[value] , identifier[format] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Boolean] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[JSONString] operator[SEP] {
identifier[Object] identifier[o] operator[SEP] Keyword[try] {
identifier[o] operator[=] operator[SEP] operator[SEP] identifier[JSONString] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[o] operator[!=] Other[null] operator[?] identifier[o] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] identifier[JSONUtil] operator[SEP] identifier[quote] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[JSONUtil] operator[SEP] identifier[quote] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[writer] operator[SEP] operator[SEP]
}
Keyword[return] identifier[writer] operator[SEP]
}
|
public static void setFieldValue(final Object obj, final String fieldName, final Object value) {
Field field = getField(obj.getClass(), fieldName);
if (field == null) {
throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + ']');
}
setField(obj, field, value);
} | class class_name[name] begin[{]
method[setFieldValue, return_type[void], modifier[public static], parameter[obj, fieldName, value]] begin[{]
local_variable[type[Field], field]
if[binary_operation[member[.field], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not find field ["), operandr=MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] on target ["), operator=+), operandr=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.setField, parameter[member[.obj], member[.field], member[.value]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setFieldValue] operator[SEP] Keyword[final] identifier[Object] identifier[obj] , Keyword[final] identifier[String] identifier[fieldName] , Keyword[final] identifier[Object] identifier[value] operator[SEP] {
identifier[Field] identifier[field] operator[=] identifier[getField] operator[SEP] identifier[obj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[fieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[fieldName] operator[+] literal[String] operator[+] identifier[obj] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[setField] operator[SEP] identifier[obj] , identifier[field] , identifier[value] operator[SEP] operator[SEP]
}
|
public String getFirst(String key)
{
if(key == null)
throw new IllegalArgumentException("Null keys not allowed.");
List<String> vals = map.get(key);
if(vals == null || vals.size() == 0)
return null;
return vals.get(0);
} | class class_name[name] begin[{]
method[getFirst, return_type[type[String]], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.key], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null keys not allowed.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[List], vals]
if[binary_operation[binary_operation[member[.vals], ==, literal[null]], ||, binary_operation[call[vals.size, parameter[]], ==, literal[0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[vals.get, parameter[literal[0]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getFirst] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[vals] operator[=] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vals] operator[==] Other[null] operator[||] identifier[vals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[vals] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
protected IScheduler schedule() {
if(scheduler == null) {
scheduler = ServiceContext.getContext().find(IScheduler.class);
}
return scheduler;
} | class class_name[name] begin[{]
method[schedule, return_type[type[IScheduler]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.scheduler], ==, literal[null]]] begin[{]
assign[member[.scheduler], call[ServiceContext.getContext, parameter[]]]
else begin[{]
None
end[}]
return[member[.scheduler]]
end[}]
END[}] | Keyword[protected] identifier[IScheduler] identifier[schedule] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[scheduler] operator[==] Other[null] operator[SEP] {
identifier[scheduler] operator[=] identifier[ServiceContext] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[find] operator[SEP] identifier[IScheduler] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[return] identifier[scheduler] operator[SEP]
}
|
public void setMETerminated()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setMETerminated");
hasMETerminated = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setMETerminated");
} | class class_name[name] begin[{]
method[setMETerminated, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setMETerminated"]]]
else begin[{]
None
end[}]
assign[member[.hasMETerminated], literal[true]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setMETerminated"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setMETerminated] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[hasMETerminated] operator[=] literal[boolean] 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 SearchResult<TaskSummary> search(int start, int size, String sort, String freeText, String query) {
return executionService.getSearchTasks(query, freeText, start, size, sort);
} | class class_name[name] begin[{]
method[search, return_type[type[SearchResult]], modifier[public], parameter[start, size, sort, freeText, query]] begin[{]
return[call[executionService.getSearchTasks, parameter[member[.query], member[.freeText], member[.start], member[.size], member[.sort]]]]
end[}]
END[}] | Keyword[public] identifier[SearchResult] operator[<] identifier[TaskSummary] operator[>] identifier[search] operator[SEP] Keyword[int] identifier[start] , Keyword[int] identifier[size] , identifier[String] identifier[sort] , identifier[String] identifier[freeText] , identifier[String] identifier[query] operator[SEP] {
Keyword[return] identifier[executionService] operator[SEP] identifier[getSearchTasks] operator[SEP] identifier[query] , identifier[freeText] , identifier[start] , identifier[size] , identifier[sort] operator[SEP] operator[SEP]
}
|
public void setJPAExPcBindingContext(Object exPc) //d468174
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.debug(tc, "setJPAExPcBindingContext: " + exPc);
ivExPcContext = exPc;
} | class class_name[name] begin[{]
method[setJPAExPcBindingContext, return_type[void], modifier[public], parameter[exPc]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["setJPAExPcBindingContext: "], +, member[.exPc]]]]
else begin[{]
None
end[}]
assign[member[.ivExPcContext], member[.exPc]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setJPAExPcBindingContext] operator[SEP] identifier[Object] identifier[exPc] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[exPc] operator[SEP] operator[SEP] identifier[ivExPcContext] operator[=] identifier[exPc] operator[SEP]
}
|
public ArrayList<OvhShippingAddress> packName_shippingAddresses_GET(String packName, OvhShippingAddressContextEnum context) throws IOException {
String qPath = "/pack/xdsl/{packName}/shippingAddresses";
StringBuilder sb = path(qPath, packName);
query(sb, "context", context);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | class class_name[name] begin[{]
method[packName_shippingAddresses_GET, return_type[type[ArrayList]], modifier[public], parameter[packName, context]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
call[.query, parameter[member[.sb], literal["context"], member[.context]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], member[.t4]]]]
end[}]
END[}] | Keyword[public] identifier[ArrayList] operator[<] identifier[OvhShippingAddress] operator[>] identifier[packName_shippingAddresses_GET] operator[SEP] identifier[String] identifier[packName] , identifier[OvhShippingAddressContextEnum] identifier[context] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[packName] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[sb] , literal[String] , identifier[context] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[t4] operator[SEP] operator[SEP]
}
|
public static MSICredentials getMSICredentials(String managementEndpoint) {
//check if we are running in a web app
String websiteName = System.getenv("WEBSITE_SITE_NAME");
if (websiteName != null && !websiteName.isEmpty()) {
// We are in a web app...
MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint);
return forAppService(config);
} else {
//We are in a vm/container
MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint);
return forVirtualMachine(config);
}
} | class class_name[name] begin[{]
method[getMSICredentials, return_type[type[MSICredentials]], modifier[public static], parameter[managementEndpoint]] begin[{]
local_variable[type[String], websiteName]
if[binary_operation[binary_operation[member[.websiteName], !=, literal[null]], &&, call[websiteName.isEmpty, parameter[]]]] begin[{]
local_variable[type[MSIConfigurationForAppService], config]
return[call[.forAppService, parameter[member[.config]]]]
else begin[{]
local_variable[type[MSIConfigurationForVirtualMachine], config]
return[call[.forVirtualMachine, parameter[member[.config]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MSICredentials] identifier[getMSICredentials] operator[SEP] identifier[String] identifier[managementEndpoint] operator[SEP] {
identifier[String] identifier[websiteName] operator[=] identifier[System] operator[SEP] identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[websiteName] operator[!=] Other[null] operator[&&] operator[!] identifier[websiteName] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[MSIConfigurationForAppService] identifier[config] operator[=] Keyword[new] identifier[MSIConfigurationForAppService] operator[SEP] identifier[managementEndpoint] operator[SEP] operator[SEP] Keyword[return] identifier[forAppService] operator[SEP] identifier[config] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MSIConfigurationForVirtualMachine] identifier[config] operator[=] Keyword[new] identifier[MSIConfigurationForVirtualMachine] operator[SEP] identifier[managementEndpoint] operator[SEP] operator[SEP] Keyword[return] identifier[forVirtualMachine] operator[SEP] identifier[config] operator[SEP] operator[SEP]
}
}
|
private InternalLocaleBuilder setExtensions(List<String> bcpExtensions, String privateuse) {
clearExtensions();
if (bcpExtensions != null && bcpExtensions.size() > 0) {
HashSet<CaseInsensitiveChar> processedExtensions = new HashSet<CaseInsensitiveChar>(bcpExtensions.size());
for (String bcpExt : bcpExtensions) {
CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt.charAt(0));
// ignore duplicates
if (!processedExtensions.contains(key)) {
// each extension string contains singleton, e.g. "a-abc-def"
if (UnicodeLocaleExtension.isSingletonChar(key.value())) {
setUnicodeLocaleExtension(bcpExt.substring(2));
} else {
if (_extensions == null) {
_extensions = new HashMap<CaseInsensitiveChar, String>(4);
}
_extensions.put(key, bcpExt.substring(2));
}
}
}
}
if (privateuse != null && privateuse.length() > 0) {
// privateuse string contains prefix, e.g. "x-abc-def"
if (_extensions == null) {
_extensions = new HashMap<CaseInsensitiveChar, String>(1);
}
_extensions.put(new CaseInsensitiveChar(privateuse.charAt(0)), privateuse.substring(2));
}
return this;
} | class class_name[name] begin[{]
method[setExtensions, return_type[type[InternalLocaleBuilder]], modifier[private], parameter[bcpExtensions, privateuse]] begin[{]
call[.clearExtensions, parameter[]]
if[binary_operation[binary_operation[member[.bcpExtensions], !=, literal[null]], &&, binary_operation[call[bcpExtensions.size, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[HashSet], processedExtensions]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=bcpExt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CaseInsensitiveChar, sub_type=None)), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CaseInsensitiveChar, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=processedExtensions, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=value, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None)], member=isSingletonChar, postfix_operators=[], prefix_operators=[], qualifier=UnicodeLocaleExtension, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=_extensions, 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=_extensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], 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=CaseInsensitiveChar, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=bcpExt, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=_extensions, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=bcpExt, selectors=[], type_arguments=None)], member=setUnicodeLocaleExtension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=bcpExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bcpExt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.privateuse], !=, literal[null]], &&, binary_operation[call[privateuse.length, parameter[]], >, literal[0]]]] begin[{]
if[binary_operation[member[._extensions], ==, literal[null]]] begin[{]
assign[member[._extensions], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], 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=CaseInsensitiveChar, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
call[_extensions.put, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=privateuse, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CaseInsensitiveChar, sub_type=None)), call[privateuse.substring, parameter[literal[2]]]]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[private] identifier[InternalLocaleBuilder] identifier[setExtensions] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[bcpExtensions] , identifier[String] identifier[privateuse] operator[SEP] {
identifier[clearExtensions] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bcpExtensions] operator[!=] Other[null] operator[&&] identifier[bcpExtensions] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[HashSet] operator[<] identifier[CaseInsensitiveChar] operator[>] identifier[processedExtensions] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[CaseInsensitiveChar] operator[>] operator[SEP] identifier[bcpExtensions] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[bcpExt] operator[:] identifier[bcpExtensions] operator[SEP] {
identifier[CaseInsensitiveChar] identifier[key] operator[=] Keyword[new] identifier[CaseInsensitiveChar] operator[SEP] identifier[bcpExt] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[processedExtensions] operator[SEP] identifier[contains] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[UnicodeLocaleExtension] operator[SEP] identifier[isSingletonChar] operator[SEP] identifier[key] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[setUnicodeLocaleExtension] operator[SEP] identifier[bcpExt] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[_extensions] operator[==] Other[null] operator[SEP] {
identifier[_extensions] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[CaseInsensitiveChar] , identifier[String] operator[>] operator[SEP] Other[4] operator[SEP] operator[SEP]
}
identifier[_extensions] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[bcpExt] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[privateuse] operator[!=] Other[null] operator[&&] identifier[privateuse] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[_extensions] operator[==] Other[null] operator[SEP] {
identifier[_extensions] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[CaseInsensitiveChar] , identifier[String] operator[>] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
identifier[_extensions] operator[SEP] identifier[put] operator[SEP] Keyword[new] identifier[CaseInsensitiveChar] operator[SEP] identifier[privateuse] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] , identifier[privateuse] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static final void intToBytes( int i, byte[] data, int[] offset ) {
/**
* TODO: We use network-order within OceanStore, but temporarily
* supporting intel-order to work with some JNI code until JNI code is
* set to interoperate with network-order.
*/
if (data != null) {
for( int j = (offset[0] + SIZE_INT) - 1; j >= offset[0]; --j ) {
data[j] = (byte) i;
i >>= 8;
}
}
offset[0] += SIZE_INT;
} | class class_name[name] begin[{]
method[intToBytes, return_type[void], modifier[final public static], parameter[i, data, offset]] begin[{]
if[binary_operation[member[.data], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=>>=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=SIZE_INT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), 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)
else begin[{]
None
end[}]
assign[member[.offset], member[.SIZE_INT]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[void] identifier[intToBytes] operator[SEP] Keyword[int] identifier[i] , Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[int] operator[SEP] operator[SEP] identifier[offset] operator[SEP] {
Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] operator[SEP] identifier[offset] operator[SEP] Other[0] operator[SEP] operator[+] identifier[SIZE_INT] operator[SEP] operator[-] Other[1] operator[SEP] identifier[j] operator[>=] identifier[offset] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[--] identifier[j] operator[SEP] {
identifier[data] operator[SEP] identifier[j] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[i] operator[SEP] identifier[i] operator[>>=] Other[8] operator[SEP]
}
}
identifier[offset] operator[SEP] Other[0] operator[SEP] operator[+=] identifier[SIZE_INT] operator[SEP]
}
|
public static Logger getLogger(final Object value) {
return getLogger(value != null ? value.getClass() : StackLocatorUtil.getCallerClass(2));
} | class class_name[name] begin[{]
method[getLogger, return_type[type[Logger]], modifier[public static], parameter[value]] begin[{]
return[call[.getLogger, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=getCallerClass, postfix_operators=[], prefix_operators=[], qualifier=StackLocatorUtil, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Logger] identifier[getLogger] operator[SEP] Keyword[final] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] identifier[getLogger] operator[SEP] identifier[value] operator[!=] Other[null] operator[?] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[:] identifier[StackLocatorUtil] operator[SEP] identifier[getCallerClass] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
|
public static com.liferay.commerce.account.model.CommerceAccount createCommerceAccount(
long commerceAccountId) {
return getService().createCommerceAccount(commerceAccountId);
} | class class_name[name] begin[{]
method[createCommerceAccount, return_type[type[com]], modifier[public static], parameter[commerceAccountId]] begin[{]
return[call[.getService, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[account] operator[SEP] identifier[model] operator[SEP] identifier[CommerceAccount] identifier[createCommerceAccount] operator[SEP] Keyword[long] identifier[commerceAccountId] operator[SEP] {
Keyword[return] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[createCommerceAccount] operator[SEP] identifier[commerceAccountId] operator[SEP] operator[SEP]
}
|
public JSONStringer toJSONStringerV2(JSONStringer js) throws JSONException{
// array of row data
VoltTableRow row = cloneRow();
row.resetRowPosition();
js.array();
while (row.advanceRow()) {
js.object();
for (int i = 0; i < getColumnCount(); i++) {
js.key(getColumnName(i));
row.putJSONRep(i, js);
}
js.endObject();
}
js.endArray();
return js;
} | class class_name[name] begin[{]
method[toJSONStringerV2, return_type[type[JSONStringer]], modifier[public], parameter[js]] begin[{]
local_variable[type[VoltTableRow], row]
call[row.resetRowPosition, parameter[]]
call[js.array, parameter[]]
while[call[row.advanceRow, parameter[]]] begin[{]
call[js.object, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=js, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=js, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putJSONRep, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=, 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)
call[js.endObject, parameter[]]
end[}]
call[js.endArray, parameter[]]
return[member[.js]]
end[}]
END[}] | Keyword[public] identifier[JSONStringer] identifier[toJSONStringerV2] operator[SEP] identifier[JSONStringer] identifier[js] operator[SEP] Keyword[throws] identifier[JSONException] {
identifier[VoltTableRow] identifier[row] operator[=] identifier[cloneRow] operator[SEP] operator[SEP] operator[SEP] identifier[row] operator[SEP] identifier[resetRowPosition] operator[SEP] operator[SEP] operator[SEP] identifier[js] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[row] operator[SEP] identifier[advanceRow] operator[SEP] operator[SEP] operator[SEP] {
identifier[js] operator[SEP] identifier[object] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[getColumnCount] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[js] operator[SEP] identifier[key] operator[SEP] identifier[getColumnName] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[row] operator[SEP] identifier[putJSONRep] operator[SEP] identifier[i] , identifier[js] operator[SEP] operator[SEP]
}
identifier[js] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP]
}
identifier[js] operator[SEP] identifier[endArray] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[js] operator[SEP]
}
|
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Shake shake = (Shake) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = shake.getClientId();
rw.startElement("script", shake);
rw.writeAttribute("id", clientId, null);
rw.write("\nvar myShakeEvent = new Shake({\n");
rw.write(" threshold: " + shake.getThreshold() + ",\n");
rw.write(" timeout: " + shake.getInterval() + "\n");
rw.write("});\n");
if (!shake.isDisabled()) {
// Start listening to device motion:
rw.write("myShakeEvent.start();\n");
}
// Register a shake event listener on window with your callback:
rw.write("window.addEventListener('shake', function(){\n");
String code = new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForAnMobileEvent(context, shake, rw, "shake");
rw.write(code + "\n");
rw.write("}, false);\n");
rw.endElement("script");
} | 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[Shake], shake]
local_variable[type[ResponseWriter], rw]
local_variable[type[String], clientId]
call[rw.startElement, parameter[literal["script"], member[.shake]]]
call[rw.writeAttribute, parameter[literal["id"], member[.clientId], literal[null]]]
call[rw.write, parameter[literal["\nvar myShakeEvent = new Shake({\n"]]]
call[rw.write, parameter[binary_operation[binary_operation[literal[" threshold: "], +, call[shake.getThreshold, parameter[]]], +, literal[",\n"]]]]
call[rw.write, parameter[binary_operation[binary_operation[literal[" timeout: "], +, call[shake.getInterval, parameter[]]], +, literal["\n"]]]]
call[rw.write, parameter[literal["});\n"]]]
if[call[shake.isDisabled, parameter[]]] begin[{]
call[rw.write, parameter[literal["myShakeEvent.start();\n"]]]
else begin[{]
None
end[}]
call[rw.write, parameter[literal["window.addEventListener('shake', function(){\n"]]]
local_variable[type[String], code]
call[rw.write, parameter[binary_operation[member[.code], +, literal["\n"]]]]
call[rw.write, parameter[literal["}, false);\n"]]]
call[rw.endElement, parameter[literal["script"]]]
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[Shake] identifier[shake] operator[=] operator[SEP] identifier[Shake] 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[shake] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[startElement] operator[SEP] literal[String] , identifier[shake] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[writeAttribute] operator[SEP] literal[String] , identifier[clientId] , Other[null] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[+] identifier[shake] operator[SEP] identifier[getThreshold] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[+] identifier[shake] operator[SEP] identifier[getInterval] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[shake] operator[SEP] identifier[isDisabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[code] operator[=] Keyword[new] identifier[AJAXRenderer] operator[SEP] operator[SEP] operator[SEP] identifier[generateBootsFacesAJAXAndJavaScriptForAnMobileEvent] operator[SEP] identifier[context] , identifier[shake] , identifier[rw] , literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] identifier[code] operator[+] literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[rw] operator[SEP] identifier[endElement] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public void upload(String trainingDir, String apiKey, String algorithmId) {
JSONObject json = new JSONObject().put("training_dir", trainingDir).put("api_key", apiKey).put("algorithm_id",
algorithmId);
uploadPost(json);
} | class class_name[name] begin[{]
method[upload, return_type[void], modifier[public], parameter[trainingDir, apiKey, algorithmId]] begin[{]
local_variable[type[JSONObject], json]
call[.uploadPost, parameter[member[.json]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[upload] operator[SEP] identifier[String] identifier[trainingDir] , identifier[String] identifier[apiKey] , identifier[String] identifier[algorithmId] operator[SEP] {
identifier[JSONObject] identifier[json] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[trainingDir] operator[SEP] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[apiKey] operator[SEP] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[algorithmId] operator[SEP] operator[SEP] identifier[uploadPost] operator[SEP] identifier[json] operator[SEP] operator[SEP]
}
|
protected void parse() {
// have we already parsed the input?
if (_parsed)
return;
_parsed = true;
try {
// initialize
_parts = new MultiMap<>();
// if its not a multipart request, don't parse it
if (_contentType == null || !_contentType.startsWith("multipart/form-data"))
return;
// sort out the location to which to write the files
if (_config.getLocation() == null)
_tmpDir = _contextTmpDir;
else if ("".equals(_config.getLocation()))
_tmpDir = _contextTmpDir;
else {
File f = new File(_config.getLocation());
if (f.isAbsolute())
_tmpDir = f;
else
_tmpDir = new File(_contextTmpDir, _config.getLocation());
}
if (!_tmpDir.exists())
_tmpDir.mkdirs();
String contentTypeBoundary = "";
int bstart = _contentType.indexOf("boundary=");
if (bstart >= 0) {
int bend = _contentType.indexOf(";", bstart);
bend = (bend < 0 ? _contentType.length() : bend);
contentTypeBoundary = QuotedStringTokenizer.unquote(value(_contentType.substring(bstart, bend)).trim());
}
Handler handler = new Handler();
MultiPartParser parser = new MultiPartParser(handler, contentTypeBoundary);
byte[] data = new byte[_bufferSize];
int len;
long total = 0;
while (true) {
len = _in.read(data);
if (len > 0) {
// keep running total of size of bytes read from input and throw an exception if exceeds MultipartConfigElement._maxRequestSize
total += len;
if (_config.getMaxRequestSize() > 0 && total > _config.getMaxRequestSize()) {
_err = new IllegalStateException("Request exceeds maxRequestSize (" + _config.getMaxRequestSize() + ")");
return;
}
ByteBuffer buffer = BufferUtils.toBuffer(data);
buffer.limit(len);
if (parser.parse(buffer, false))
break;
if (buffer.hasRemaining())
throw new IllegalStateException("Buffer did not fully consume");
} else if (len == -1) {
parser.parse(BufferUtils.EMPTY_BUFFER, true);
break;
}
}
// check for exceptions
if (_err != null) {
return;
}
// check we read to the end of the message
if (parser.getState() != MultiPartParser.State.END) {
if (parser.getState() == MultiPartParser.State.PREAMBLE)
_err = new IOException("Missing initial multi part boundary");
else
_err = new IOException("Incomplete Multipart");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Parsing Complete {} err={}", parser, _err);
}
} catch (Throwable e) {
_err = e;
}
} | class class_name[name] begin[{]
method[parse, return_type[void], modifier[protected], parameter[]] begin[{]
if[member[._parsed]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[._parsed], literal[true]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_parts, 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=[], dimensions=None, name=MultiMap, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_contentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="multipart/form-data")], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=_contentType, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=_config, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=_config, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=""), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=_config, 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)), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isAbsolute, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_tmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=_contextTmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=_config, 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))), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_tmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None))]), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_tmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=_contextTmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_tmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=_contextTmpDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=_tmpDir, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=mkdirs, postfix_operators=[], prefix_operators=[], qualifier=_tmpDir, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), name=contentTypeBoundary)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="boundary=")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=_contentType, selectors=[], type_arguments=None), name=bstart)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bstart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";"), MemberReference(member=bstart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=_contentType, selectors=[], type_arguments=None), name=bend)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=bend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=bend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=_contentType, selectors=[], type_arguments=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=contentTypeBoundary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=bstart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=_contentType, selectors=[], type_arguments=None)], member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=unquote, postfix_operators=[], prefix_operators=[], qualifier=QuotedStringTokenizer, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Handler, sub_type=None)), name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Handler, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentTypeBoundary, 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=MultiPartParser, sub_type=None)), name=parser)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MultiPartParser, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=_bufferSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=data)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=len)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=total)], modifiers=set(), type=BasicType(dimensions=[], name=long)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=_in, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=EMPTY_BUFFER, postfix_operators=[], prefix_operators=[], qualifier=BufferUtils, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=parse, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMaxRequestSize, postfix_operators=[], prefix_operators=[], qualifier=_config, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=BinaryOperation(operandl=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getMaxRequestSize, postfix_operators=[], prefix_operators=[], qualifier=_config, selectors=[], type_arguments=None), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Request exceeds maxRequestSize ("), operandr=MethodInvocation(arguments=[], member=getMaxRequestSize, postfix_operators=[], prefix_operators=[], qualifier=_config, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None))), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBuffer, postfix_operators=[], prefix_operators=[], qualifier=BufferUtils, selectors=[], type_arguments=None), name=buffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=limit, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=parse, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasRemaining, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Buffer did not fully consume")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None))]))]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=_err, 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=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getState, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=END, postfix_operators=[], prefix_operators=[], qualifier=MultiPartParser.State, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getState, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=PREAMBLE, postfix_operators=[], prefix_operators=[], qualifier=MultiPartParser.State, selectors=[]), operator===), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Incomplete Multipart")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None))), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=_err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing initial multi part boundary")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None))), label=None))])), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, 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="Parsing Complete {} err={}"), MemberReference(member=parser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[parse] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_parsed] operator[SEP] Keyword[return] operator[SEP] identifier[_parsed] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[_parts] operator[=] Keyword[new] identifier[MultiMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_contentType] operator[==] Other[null] operator[||] operator[!] identifier[_contentType] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[_config] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] identifier[_tmpDir] operator[=] identifier[_contextTmpDir] operator[SEP] Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[_config] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[_tmpDir] operator[=] identifier[_contextTmpDir] operator[SEP] Keyword[else] {
identifier[File] identifier[f] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[_config] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] identifier[_tmpDir] operator[=] identifier[f] operator[SEP] Keyword[else] identifier[_tmpDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[_contextTmpDir] , identifier[_config] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[_tmpDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] identifier[_tmpDir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[contentTypeBoundary] operator[=] literal[String] operator[SEP] Keyword[int] identifier[bstart] operator[=] identifier[_contentType] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bstart] operator[>=] Other[0] operator[SEP] {
Keyword[int] identifier[bend] operator[=] identifier[_contentType] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[bstart] operator[SEP] operator[SEP] identifier[bend] operator[=] operator[SEP] identifier[bend] operator[<] Other[0] operator[?] identifier[_contentType] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[:] identifier[bend] operator[SEP] operator[SEP] identifier[contentTypeBoundary] operator[=] identifier[QuotedStringTokenizer] operator[SEP] identifier[unquote] operator[SEP] identifier[value] operator[SEP] identifier[_contentType] operator[SEP] identifier[substring] operator[SEP] identifier[bstart] , identifier[bend] operator[SEP] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Handler] identifier[handler] operator[=] Keyword[new] identifier[Handler] operator[SEP] operator[SEP] operator[SEP] identifier[MultiPartParser] identifier[parser] operator[=] Keyword[new] identifier[MultiPartParser] operator[SEP] identifier[handler] , identifier[contentTypeBoundary] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[_bufferSize] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[SEP] Keyword[long] identifier[total] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[len] operator[=] identifier[_in] operator[SEP] identifier[read] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[>] Other[0] operator[SEP] {
identifier[total] operator[+=] identifier[len] operator[SEP] Keyword[if] operator[SEP] identifier[_config] operator[SEP] identifier[getMaxRequestSize] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] identifier[total] operator[>] identifier[_config] operator[SEP] identifier[getMaxRequestSize] operator[SEP] operator[SEP] operator[SEP] {
identifier[_err] operator[=] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[_config] operator[SEP] identifier[getMaxRequestSize] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[ByteBuffer] identifier[buffer] operator[=] identifier[BufferUtils] operator[SEP] identifier[toBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[limit] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[buffer] , literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[len] operator[==] operator[-] Other[1] operator[SEP] {
identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[BufferUtils] operator[SEP] identifier[EMPTY_BUFFER] , literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[_err] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parser] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[!=] identifier[MultiPartParser] operator[SEP] identifier[State] operator[SEP] identifier[END] operator[SEP] {
Keyword[if] operator[SEP] identifier[parser] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[==] identifier[MultiPartParser] operator[SEP] identifier[State] operator[SEP] identifier[PREAMBLE] operator[SEP] identifier[_err] operator[=] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] identifier[_err] operator[=] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[parser] , identifier[_err] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[_err] operator[=] identifier[e] operator[SEP]
}
}
|
public static base_response update(nitro_service client, nslimitidentifier resource) throws Exception {
nslimitidentifier updateresource = new nslimitidentifier();
updateresource.limitidentifier = resource.limitidentifier;
updateresource.threshold = resource.threshold;
updateresource.timeslice = resource.timeslice;
updateresource.mode = resource.mode;
updateresource.limittype = resource.limittype;
updateresource.selectorname = resource.selectorname;
updateresource.maxbandwidth = resource.maxbandwidth;
updateresource.trapsintimeslice = resource.trapsintimeslice;
return updateresource.update_resource(client);
} | class class_name[name] begin[{]
method[update, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[nslimitidentifier], updateresource]
assign[member[updateresource.limitidentifier], member[resource.limitidentifier]]
assign[member[updateresource.threshold], member[resource.threshold]]
assign[member[updateresource.timeslice], member[resource.timeslice]]
assign[member[updateresource.mode], member[resource.mode]]
assign[member[updateresource.limittype], member[resource.limittype]]
assign[member[updateresource.selectorname], member[resource.selectorname]]
assign[member[updateresource.maxbandwidth], member[resource.maxbandwidth]]
assign[member[updateresource.trapsintimeslice], member[resource.trapsintimeslice]]
return[call[updateresource.update_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[nslimitidentifier] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[nslimitidentifier] identifier[updateresource] operator[=] Keyword[new] identifier[nslimitidentifier] operator[SEP] operator[SEP] operator[SEP] identifier[updateresource] operator[SEP] identifier[limitidentifier] operator[=] identifier[resource] operator[SEP] identifier[limitidentifier] operator[SEP] identifier[updateresource] operator[SEP] identifier[threshold] operator[=] identifier[resource] operator[SEP] identifier[threshold] operator[SEP] identifier[updateresource] operator[SEP] identifier[timeslice] operator[=] identifier[resource] operator[SEP] identifier[timeslice] operator[SEP] identifier[updateresource] operator[SEP] identifier[mode] operator[=] identifier[resource] operator[SEP] identifier[mode] operator[SEP] identifier[updateresource] operator[SEP] identifier[limittype] operator[=] identifier[resource] operator[SEP] identifier[limittype] operator[SEP] identifier[updateresource] operator[SEP] identifier[selectorname] operator[=] identifier[resource] operator[SEP] identifier[selectorname] operator[SEP] identifier[updateresource] operator[SEP] identifier[maxbandwidth] operator[=] identifier[resource] operator[SEP] identifier[maxbandwidth] operator[SEP] identifier[updateresource] operator[SEP] identifier[trapsintimeslice] operator[=] identifier[resource] operator[SEP] identifier[trapsintimeslice] operator[SEP] Keyword[return] identifier[updateresource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public DataBuffer asNd4jBuffer(DataType type, int elementSize) {
int length = content.length / elementSize;
DataBuffer ret = Nd4j.createBuffer(ByteBuffer.allocateDirect(content.length),type,length,0);
for(int i = 0; i < length; i++) {
switch(type) {
case DOUBLE:
ret.put(i,getDouble(i));
break;
case INT:
ret.put(i,getInt(i));
break;
case FLOAT:
ret.put(i,getFloat(i));
break;
case LONG:
ret.put(i,getLong(i));
break;
}
}
return ret;
} | class class_name[name] begin[{]
method[asNd4jBuffer, return_type[type[DataBuffer]], modifier[public], parameter[type, elementSize]] begin[{]
local_variable[type[int], length]
local_variable[type[DataBuffer], ret]
ForStatement(body=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=['DOUBLE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['INT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['FLOAT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFloat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['LONG'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=type, 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=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[DataBuffer] identifier[asNd4jBuffer] operator[SEP] identifier[DataType] identifier[type] , Keyword[int] identifier[elementSize] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[content] operator[SEP] identifier[length] operator[/] identifier[elementSize] operator[SEP] identifier[DataBuffer] identifier[ret] operator[=] identifier[Nd4j] operator[SEP] identifier[createBuffer] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[allocateDirect] operator[SEP] identifier[content] operator[SEP] identifier[length] operator[SEP] , identifier[type] , identifier[length] , Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[DOUBLE] operator[:] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[getDouble] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[INT] operator[:] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[getInt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FLOAT] operator[:] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[getFloat] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[LONG] operator[:] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[getLong] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
protected Locator byIdSuffix(String suffix) {
if (tableId == null) {
tableId = innerTable.getAttribute("id");
}
return byInner(By.id(tableId + "_" + suffix));
} | class class_name[name] begin[{]
method[byIdSuffix, return_type[type[Locator]], modifier[protected], parameter[suffix]] begin[{]
if[binary_operation[member[.tableId], ==, literal[null]]] begin[{]
assign[member[.tableId], call[innerTable.getAttribute, parameter[literal["id"]]]]
else begin[{]
None
end[}]
return[call[.byInner, parameter[call[By.id, parameter[binary_operation[binary_operation[member[.tableId], +, literal["_"]], +, member[.suffix]]]]]]]
end[}]
END[}] | Keyword[protected] identifier[Locator] identifier[byIdSuffix] operator[SEP] identifier[String] identifier[suffix] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableId] operator[==] Other[null] operator[SEP] {
identifier[tableId] operator[=] identifier[innerTable] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[byInner] operator[SEP] identifier[By] operator[SEP] identifier[id] operator[SEP] identifier[tableId] operator[+] literal[String] operator[+] identifier[suffix] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void assignCoordinateSystemsExplicit(NetcdfDataset ncDataset) {
// look for explicit references to coord sys variables
for (VarProcess vp : varList) {
if (vp.coordSys != null && !vp.isCoordinateTransform) {
StringTokenizer stoker = new StringTokenizer(vp.coordSys);
while (stoker.hasMoreTokens()) {
String vname = stoker.nextToken();
VarProcess ap = findVarProcess(vname, vp);
if (ap == null) {
parseInfo.format("***Cant find Coordinate System variable %s referenced from var= %s%n", vname, vp.v.getFullName());
userAdvice.format("***Cant find Coordinate System variable %s referenced from var= %s%n", vname, vp.v.getFullName());
continue;
}
if (ap.cs == null) {
parseInfo.format("***Not a Coordinate System variable %s referenced from var= %s%n", vname, vp.v.getFullName());
userAdvice.format("***Not a Coordinate System variable %s referenced from var= %s%n", vname, vp.v.getFullName());
continue;
}
VariableEnhanced ve = (VariableEnhanced) vp.v;
ve.addCoordinateSystem(ap.cs);
}
}
}
// look for explicit references from coord sys variables to data variables
for (VarProcess csVar : varList) {
if (!csVar.isCoordinateSystem || (csVar.coordSysFor == null))
continue;
// get list of dimensions from '_CoordinateSystemFor' attribute
List<Dimension> dimList = new ArrayList<>(6);
StringTokenizer stoker = new StringTokenizer(csVar.coordSysFor);
while (stoker.hasMoreTokens()) {
String dname = stoker.nextToken();
Dimension dim = ncDataset.getRootGroup().findDimension(dname);
if (dim == null) {
parseInfo.format("***Cant find Dimension %s referenced from CoordSys var= %s%n", dname, csVar.v.getFullName());
userAdvice.format("***Cant find Dimension %s referenced from CoordSys var= %s%n", dname, csVar.v.getFullName());
} else
dimList.add(dim);
}
// look for vars with those dimensions
for (VarProcess vp : varList) {
if (!vp.hasCoordinateSystem() && vp.isData() && (csVar.cs != null)) {
VariableEnhanced ve = (VariableEnhanced) vp.v;
if (CoordinateSystem.isSubset(dimList, vp.v.getDimensionsAll()) && CoordinateSystem.isSubset(vp.v.getDimensionsAll(), dimList))
ve.addCoordinateSystem(csVar.cs);
}
}
}
// look for explicit listings of coordinate axes
for (VarProcess vp : varList) {
VariableEnhanced ve = (VariableEnhanced) vp.v;
if (!vp.hasCoordinateSystem() && (vp.coordAxes != null) && vp.isData()) {
List<CoordinateAxis> dataAxesList = getAxes(vp, vp.coordAxes, vp.v.getFullName());
if (dataAxesList.size() > 1) {
String coordSysName = CoordinateSystem.makeName(dataAxesList);
CoordinateSystem cs = ncDataset.findCoordinateSystem(coordSysName);
if (cs != null) {
ve.addCoordinateSystem(cs);
parseInfo.format(" assigned explicit CoordSystem '%s' for var= %s%n", cs.getName(), vp.v.getFullName());
} else {
CoordinateSystem csnew = new CoordinateSystem(ncDataset, dataAxesList, null);
ve.addCoordinateSystem(csnew);
ncDataset.addCoordinateSystem(csnew);
parseInfo.format(" created explicit CoordSystem '%s' for var= %s%n", csnew.getName(), vp.v.getFullName());
}
}
}
}
} | class class_name[name] begin[{]
method[assignCoordinateSystemsExplicit, return_type[void], modifier[protected], parameter[ncDataset]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=coordSys, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MemberReference(member=isCoordinateTransform, postfix_operators=[], prefix_operators=['!'], qualifier=vp, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=coordSys, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringTokenizer, sub_type=None)), name=stoker)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTokenizer, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=stoker, selectors=[], type_arguments=None), name=vname)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findVarProcess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=ap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarProcess, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ap, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Cant find Coordinate System variable %s referenced from var= %s%n"), MemberReference(member=vname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=parseInfo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Cant find Coordinate System variable %s referenced from var= %s%n"), MemberReference(member=vname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=userAdvice, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=ap, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Not a Coordinate System variable %s referenced from var= %s%n"), MemberReference(member=vname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=parseInfo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Not a Coordinate System variable %s referenced from var= %s%n"), MemberReference(member=vname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=userAdvice, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), name=ve)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=ap, selectors=[])], member=addCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ve, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreTokens, postfix_operators=[], prefix_operators=[], qualifier=stoker, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=varList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarProcess, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=isCoordinateSystem, postfix_operators=[], prefix_operators=['!'], qualifier=csVar, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=coordSysFor, postfix_operators=[], prefix_operators=[], qualifier=csVar, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=||), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=dimList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Dimension, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=coordSysFor, postfix_operators=[], prefix_operators=[], qualifier=csVar, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringTokenizer, sub_type=None)), name=stoker)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTokenizer, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=stoker, selectors=[], type_arguments=None), name=dname)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRootGroup, postfix_operators=[], prefix_operators=[], qualifier=ncDataset, selectors=[MethodInvocation(arguments=[MemberReference(member=dname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findDimension, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=dim)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Dimension, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=dimList, selectors=[], type_arguments=None), label=None), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Cant find Dimension %s referenced from CoordSys var= %s%n"), MemberReference(member=dname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=csVar.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=parseInfo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="***Cant find Dimension %s referenced from CoordSys var= %s%n"), MemberReference(member=dname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=csVar.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=userAdvice, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasMoreTokens, postfix_operators=[], prefix_operators=[], qualifier=stoker, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasCoordinateSystem, postfix_operators=[], prefix_operators=['!'], qualifier=vp, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isData, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=csVar, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), name=ve)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=dimList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDimensionsAll, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=isSubset, postfix_operators=[], prefix_operators=[], qualifier=CoordinateSystem, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDimensionsAll, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None), MemberReference(member=dimList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSubset, postfix_operators=[], prefix_operators=[], qualifier=CoordinateSystem, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=csVar, selectors=[])], member=addCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ve, selectors=[], type_arguments=None), label=None))]))]), control=EnhancedForControl(iterable=MemberReference(member=varList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarProcess, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=varList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=csVar)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarProcess, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), name=ve)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableEnhanced, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasCoordinateSystem, postfix_operators=[], prefix_operators=['!'], qualifier=vp, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=coordAxes, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=MethodInvocation(arguments=[], member=isData, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=coordAxes, postfix_operators=[], prefix_operators=[], qualifier=vp, selectors=[]), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=getAxes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=dataAxesList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CoordinateAxis, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=dataAxesList, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dataAxesList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeName, postfix_operators=[], prefix_operators=[], qualifier=CoordinateSystem, selectors=[], type_arguments=None), name=coordSysName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=coordSysName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ncDataset, selectors=[], type_arguments=None), name=cs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CoordinateSystem, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ncDataset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataAxesList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CoordinateSystem, sub_type=None)), name=csnew)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CoordinateSystem, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=csnew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ve, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=csnew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ncDataset, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" created explicit CoordSystem '%s' for var= %s%n"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=csnew, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=parseInfo, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCoordinateSystem, postfix_operators=[], prefix_operators=[], qualifier=ve, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" assigned explicit CoordSystem '%s' for var= %s%n"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cs, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFullName, postfix_operators=[], prefix_operators=[], qualifier=vp.v, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=parseInfo, selectors=[], type_arguments=None), label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=varList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarProcess, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[assignCoordinateSystemsExplicit] operator[SEP] identifier[NetcdfDataset] identifier[ncDataset] operator[SEP] {
Keyword[for] operator[SEP] identifier[VarProcess] identifier[vp] operator[:] identifier[varList] operator[SEP] {
Keyword[if] operator[SEP] identifier[vp] operator[SEP] identifier[coordSys] operator[!=] Other[null] operator[&&] operator[!] identifier[vp] operator[SEP] identifier[isCoordinateTransform] operator[SEP] {
identifier[StringTokenizer] identifier[stoker] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[vp] operator[SEP] identifier[coordSys] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[stoker] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[vname] operator[=] identifier[stoker] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[VarProcess] identifier[ap] operator[=] identifier[findVarProcess] operator[SEP] identifier[vname] , identifier[vp] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ap] operator[==] Other[null] operator[SEP] {
identifier[parseInfo] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[vname] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[userAdvice] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[vname] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ap] operator[SEP] identifier[cs] operator[==] Other[null] operator[SEP] {
identifier[parseInfo] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[vname] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[userAdvice] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[vname] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[VariableEnhanced] identifier[ve] operator[=] operator[SEP] identifier[VariableEnhanced] operator[SEP] identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[ve] operator[SEP] identifier[addCoordinateSystem] operator[SEP] identifier[ap] operator[SEP] identifier[cs] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[VarProcess] identifier[csVar] operator[:] identifier[varList] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[csVar] operator[SEP] identifier[isCoordinateSystem] operator[||] operator[SEP] identifier[csVar] operator[SEP] identifier[coordSysFor] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] identifier[List] operator[<] identifier[Dimension] operator[>] identifier[dimList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[StringTokenizer] identifier[stoker] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[csVar] operator[SEP] identifier[coordSysFor] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[stoker] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[dname] operator[=] identifier[stoker] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[Dimension] identifier[dim] operator[=] identifier[ncDataset] operator[SEP] identifier[getRootGroup] operator[SEP] operator[SEP] operator[SEP] identifier[findDimension] operator[SEP] identifier[dname] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dim] operator[==] Other[null] operator[SEP] {
identifier[parseInfo] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[dname] , identifier[csVar] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[userAdvice] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[dname] , identifier[csVar] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] identifier[dimList] operator[SEP] identifier[add] operator[SEP] identifier[dim] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[VarProcess] identifier[vp] operator[:] identifier[varList] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[vp] operator[SEP] identifier[hasCoordinateSystem] operator[SEP] operator[SEP] operator[&&] identifier[vp] operator[SEP] identifier[isData] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[csVar] operator[SEP] identifier[cs] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[VariableEnhanced] identifier[ve] operator[=] operator[SEP] identifier[VariableEnhanced] operator[SEP] identifier[vp] operator[SEP] identifier[v] operator[SEP] Keyword[if] operator[SEP] identifier[CoordinateSystem] operator[SEP] identifier[isSubset] operator[SEP] identifier[dimList] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getDimensionsAll] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[CoordinateSystem] operator[SEP] identifier[isSubset] operator[SEP] identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getDimensionsAll] operator[SEP] operator[SEP] , identifier[dimList] operator[SEP] operator[SEP] identifier[ve] operator[SEP] identifier[addCoordinateSystem] operator[SEP] identifier[csVar] operator[SEP] identifier[cs] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[VarProcess] identifier[vp] operator[:] identifier[varList] operator[SEP] {
identifier[VariableEnhanced] identifier[ve] operator[=] operator[SEP] identifier[VariableEnhanced] operator[SEP] identifier[vp] operator[SEP] identifier[v] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[vp] operator[SEP] identifier[hasCoordinateSystem] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[vp] operator[SEP] identifier[coordAxes] operator[!=] Other[null] operator[SEP] operator[&&] identifier[vp] operator[SEP] identifier[isData] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[CoordinateAxis] operator[>] identifier[dataAxesList] operator[=] identifier[getAxes] operator[SEP] identifier[vp] , identifier[vp] operator[SEP] identifier[coordAxes] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataAxesList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[String] identifier[coordSysName] operator[=] identifier[CoordinateSystem] operator[SEP] identifier[makeName] operator[SEP] identifier[dataAxesList] operator[SEP] operator[SEP] identifier[CoordinateSystem] identifier[cs] operator[=] identifier[ncDataset] operator[SEP] identifier[findCoordinateSystem] operator[SEP] identifier[coordSysName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cs] operator[!=] Other[null] operator[SEP] {
identifier[ve] operator[SEP] identifier[addCoordinateSystem] operator[SEP] identifier[cs] operator[SEP] operator[SEP] identifier[parseInfo] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[cs] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CoordinateSystem] identifier[csnew] operator[=] Keyword[new] identifier[CoordinateSystem] operator[SEP] identifier[ncDataset] , identifier[dataAxesList] , Other[null] operator[SEP] operator[SEP] identifier[ve] operator[SEP] identifier[addCoordinateSystem] operator[SEP] identifier[csnew] operator[SEP] operator[SEP] identifier[ncDataset] operator[SEP] identifier[addCoordinateSystem] operator[SEP] identifier[csnew] operator[SEP] operator[SEP] identifier[parseInfo] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[csnew] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[vp] operator[SEP] identifier[v] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
|
public static String shortUuid() {
// source: java.util.UUID.randomUUID()
final byte[] randomBytes = new byte[16];
UUID_GENERATOR.nextBytes(randomBytes);
randomBytes[6] = (byte) (randomBytes[6] & 0x0f); // clear version
randomBytes[6] = (byte) (randomBytes[6] | 0x40); // set to version 4
randomBytes[8] = (byte) (randomBytes[8] & 0x3f); // clear variant
randomBytes[8] = (byte) (randomBytes[8] | 0x80); // set to IETF variant
// all base 64 encoding schemes use A-Z, a-z, and 0-9 for the first 62 characters. for the
// last 2 characters, we use hyphen and underscore, which are URL safe
return BaseEncoding.base64Url().omitPadding().encode(randomBytes);
} | class class_name[name] begin[{]
method[shortUuid, return_type[type[String]], modifier[public static], parameter[]] begin[{]
local_variable[type[byte], randomBytes]
call[UUID_GENERATOR.nextBytes, parameter[member[.randomBytes]]]
assign[member[.randomBytes], Cast(expression=BinaryOperation(operandl=MemberReference(member=randomBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0f), operator=&), type=BasicType(dimensions=[], name=byte))]
assign[member[.randomBytes], Cast(expression=BinaryOperation(operandl=MemberReference(member=randomBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x40), operator=|), type=BasicType(dimensions=[], name=byte))]
assign[member[.randomBytes], Cast(expression=BinaryOperation(operandl=MemberReference(member=randomBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x3f), operator=&), type=BasicType(dimensions=[], name=byte))]
assign[member[.randomBytes], Cast(expression=BinaryOperation(operandl=MemberReference(member=randomBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]
return[call[BaseEncoding.base64Url, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[shortUuid] operator[SEP] operator[SEP] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[randomBytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[16] operator[SEP] operator[SEP] identifier[UUID_GENERATOR] operator[SEP] identifier[nextBytes] operator[SEP] identifier[randomBytes] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[6] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[6] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[6] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[6] operator[SEP] operator[|] literal[Integer] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[8] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[8] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[8] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[randomBytes] operator[SEP] Other[8] operator[SEP] operator[|] literal[Integer] operator[SEP] operator[SEP] Keyword[return] identifier[BaseEncoding] operator[SEP] identifier[base64Url] operator[SEP] operator[SEP] operator[SEP] identifier[omitPadding] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[randomBytes] operator[SEP] operator[SEP]
}
|
public static IGroupMappingServiceProvider GetGroupMappingServiceProviderPlugin(Map storm_conf) {
IGroupMappingServiceProvider gmsp = null;
try {
String gmsp_klassName = (String) storm_conf.get(Config.STORM_GROUP_MAPPING_SERVICE_PROVIDER_PLUGIN);
Class klass = Class.forName(gmsp_klassName);
gmsp = (IGroupMappingServiceProvider) klass.newInstance();
gmsp.prepare(storm_conf);
} catch (Exception e) {
throw new RuntimeException(e);
}
return gmsp;
} | class class_name[name] begin[{]
method[GetGroupMappingServiceProviderPlugin, return_type[type[IGroupMappingServiceProvider]], modifier[public static], parameter[storm_conf]] begin[{]
local_variable[type[IGroupMappingServiceProvider], gmsp]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=STORM_GROUP_MAPPING_SERVICE_PROVIDER_PLUGIN, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=storm_conf, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=gmsp_klassName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=gmsp_klassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), name=klass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=gmsp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=klass, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IGroupMappingServiceProvider, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=storm_conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepare, postfix_operators=[], prefix_operators=[], qualifier=gmsp, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.gmsp]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[IGroupMappingServiceProvider] identifier[GetGroupMappingServiceProviderPlugin] operator[SEP] identifier[Map] identifier[storm_conf] operator[SEP] {
identifier[IGroupMappingServiceProvider] identifier[gmsp] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[String] identifier[gmsp_klassName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[storm_conf] operator[SEP] identifier[get] operator[SEP] identifier[Config] operator[SEP] identifier[STORM_GROUP_MAPPING_SERVICE_PROVIDER_PLUGIN] operator[SEP] operator[SEP] identifier[Class] identifier[klass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[gmsp_klassName] operator[SEP] operator[SEP] identifier[gmsp] operator[=] operator[SEP] identifier[IGroupMappingServiceProvider] operator[SEP] identifier[klass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[gmsp] operator[SEP] identifier[prepare] operator[SEP] identifier[storm_conf] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[gmsp] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.