code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public void removeWebApplication(DeployedModule deployedModule) throws Exception {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "removeWebApplication", "Deployed Module Virtual Host Name:", deployedModule.getVirtualHostName());
}
try {
VirtualHost vHost = getVirtualHost(deployedModule.getVirtualHostName());
if (vHost == null)
throw new WebAppHostNotFoundException("VirtualHost not found");
vHost.removeWebApplication(deployedModule);
} catch (Exception e) {
logger.logp(Level.SEVERE, CLASS_NAME, "removeWebApplication", "Exception", new Object[] { e }); /* 283348.1 */
throw e;
}
} | class class_name[name] begin[{]
method[removeWebApplication, return_type[void], modifier[public], parameter[deployedModule]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[logger.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[logger.logp, parameter[member[Level.FINE], member[.CLASS_NAME], literal["removeWebApplication"], literal["Deployed Module Virtual Host Name:"], call[deployedModule.getVirtualHostName, parameter[]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getVirtualHostName, postfix_operators=[], prefix_operators=[], qualifier=deployedModule, selectors=[], type_arguments=None)], member=getVirtualHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=vHost)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VirtualHost, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=vHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="VirtualHost not found")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebAppHostNotFoundException, sub_type=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=deployedModule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeWebApplication, postfix_operators=[], prefix_operators=[], qualifier=vHost, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="removeWebApplication"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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[removeWebApplication] operator[SEP] identifier[DeployedModule] identifier[deployedModule] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] , identifier[deployedModule] operator[SEP] identifier[getVirtualHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[VirtualHost] identifier[vHost] operator[=] identifier[getVirtualHost] operator[SEP] identifier[deployedModule] operator[SEP] identifier[getVirtualHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vHost] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[WebAppHostNotFoundException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[vHost] operator[SEP] identifier[removeWebApplication] operator[SEP] identifier[deployedModule] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , identifier[CLASS_NAME] , literal[String] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[e]
} operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
@Override
protected int pruneCache() {
int count = 0;
CacheObj<K, V> first = null;
// 清理过期对象并找出链表头部元素(先入元素)
Iterator<CacheObj<K, V>> values = cacheMap.values().iterator();
while (values.hasNext()) {
CacheObj<K, V> co = values.next();
if (co.isExpired()) {
values.remove();
count++;
}
if (first == null) {
first = co;
}
}
// 清理结束后依旧是满的,则删除第一个被缓存的对象
if (isFull() && null != first) {
cacheMap.remove(first.key);
onRemove(first.key, first.obj);
count++;
}
return count;
} | class class_name[name] begin[{]
method[pruneCache, return_type[type[int]], modifier[protected], parameter[]] begin[{]
local_variable[type[int], count]
local_variable[type[CacheObj], first]
local_variable[type[Iterator], values]
while[call[values.hasNext, parameter[]]] begin[{]
local_variable[type[CacheObj], co]
if[call[co.isExpired, parameter[]]] begin[{]
call[values.remove, parameter[]]
member[.count]
else begin[{]
None
end[}]
if[binary_operation[member[.first], ==, literal[null]]] begin[{]
assign[member[.first], member[.co]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[.isFull, parameter[]], &&, binary_operation[literal[null], !=, member[.first]]]] begin[{]
call[cacheMap.remove, parameter[member[first.key]]]
call[.onRemove, parameter[member[first.key], member[first.obj]]]
member[.count]
else begin[{]
None
end[}]
return[member[.count]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[int] identifier[pruneCache] operator[SEP] operator[SEP] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] identifier[CacheObj] operator[<] identifier[K] , identifier[V] operator[>] identifier[first] operator[=] Other[null] operator[SEP] identifier[Iterator] operator[<] identifier[CacheObj] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[values] operator[=] identifier[cacheMap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[values] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[CacheObj] operator[<] identifier[K] , identifier[V] operator[>] identifier[co] operator[=] identifier[values] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[co] operator[SEP] identifier[isExpired] operator[SEP] operator[SEP] operator[SEP] {
identifier[values] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[first] operator[==] Other[null] operator[SEP] {
identifier[first] operator[=] identifier[co] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[isFull] operator[SEP] operator[SEP] operator[&&] Other[null] operator[!=] identifier[first] operator[SEP] {
identifier[cacheMap] operator[SEP] identifier[remove] operator[SEP] identifier[first] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[onRemove] operator[SEP] identifier[first] operator[SEP] identifier[key] , identifier[first] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
public static int getStartWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.withDayOfMonth (1), aLocale);
} | class class_name[name] begin[{]
method[getStartWeekOfMonth, return_type[type[int]], modifier[public static], parameter[aDT, aLocale]] begin[{]
return[call[.getWeekOfWeekBasedYear, parameter[call[aDT.withDayOfMonth, parameter[literal[1]]], member[.aLocale]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getStartWeekOfMonth] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[LocalDateTime] identifier[aDT] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Locale] identifier[aLocale] operator[SEP] {
Keyword[return] identifier[getWeekOfWeekBasedYear] operator[SEP] identifier[aDT] operator[SEP] identifier[withDayOfMonth] operator[SEP] Other[1] operator[SEP] , identifier[aLocale] operator[SEP] operator[SEP]
}
|
public SynchronizedSet<UUID> getAgents() {
final Object mutex = getAgentRepositoryMutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.agents.keySet(), mutex);
}
} | class class_name[name] begin[{]
method[getAgents, return_type[type[SynchronizedSet]], modifier[public], parameter[]] begin[{]
local_variable[type[Object], mutex]
SYNCHRONIZED[member[.mutex]] BEGIN[{]
return[call[Collections3.synchronizedSet, parameter[THIS[member[None.agents]call[None.keySet, parameter[]]], member[.mutex]]]]
END[}]
end[}]
END[}] | Keyword[public] identifier[SynchronizedSet] operator[<] identifier[UUID] operator[>] identifier[getAgents] operator[SEP] operator[SEP] {
Keyword[final] identifier[Object] identifier[mutex] operator[=] identifier[getAgentRepositoryMutex] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[mutex] operator[SEP] {
Keyword[return] identifier[Collections3] operator[SEP] identifier[synchronizedSet] operator[SEP] Keyword[this] operator[SEP] identifier[agents] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] , identifier[mutex] operator[SEP] operator[SEP]
}
}
|
private void deleteHistoryReference() {
if (reference == null) {
return;
}
if (getExtensionHistory() != null) {
getExtensionHistory().delete(reference);
reference = null;
}
} | class class_name[name] begin[{]
method[deleteHistoryReference, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.reference], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[.getExtensionHistory, parameter[]], !=, literal[null]]] begin[{]
call[.getExtensionHistory, parameter[]]
assign[member[.reference], literal[null]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[deleteHistoryReference] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[reference] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getExtensionHistory] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[getExtensionHistory] operator[SEP] operator[SEP] operator[SEP] identifier[delete] operator[SEP] identifier[reference] operator[SEP] operator[SEP] identifier[reference] operator[=] Other[null] operator[SEP]
}
}
|
protected void removeListeners() {
Editable text = getText();
if (text != null) {
TokenSpanWatcher[] spanWatchers = text.getSpans(0, text.length(), TokenSpanWatcher.class);
for (TokenSpanWatcher watcher : spanWatchers) {
text.removeSpan(watcher);
}
removeTextChangedListener(textWatcher);
}
} | class class_name[name] begin[{]
method[removeListeners, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[Editable], text]
if[binary_operation[member[.text], !=, literal[null]]] begin[{]
local_variable[type[TokenSpanWatcher], spanWatchers]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=watcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeSpan, postfix_operators=[], prefix_operators=[], qualifier=text, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=spanWatchers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=watcher)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TokenSpanWatcher, sub_type=None))), label=None)
call[.removeTextChangedListener, parameter[member[.textWatcher]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[removeListeners] operator[SEP] operator[SEP] {
identifier[Editable] identifier[text] operator[=] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[text] operator[!=] Other[null] operator[SEP] {
identifier[TokenSpanWatcher] operator[SEP] operator[SEP] identifier[spanWatchers] operator[=] identifier[text] operator[SEP] identifier[getSpans] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] , identifier[TokenSpanWatcher] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TokenSpanWatcher] identifier[watcher] operator[:] identifier[spanWatchers] operator[SEP] {
identifier[text] operator[SEP] identifier[removeSpan] operator[SEP] identifier[watcher] operator[SEP] operator[SEP]
}
identifier[removeTextChangedListener] operator[SEP] identifier[textWatcher] operator[SEP] operator[SEP]
}
}
|
public void setTerminatingInstances(java.util.Collection<InstanceStateChange> terminatingInstances) {
if (terminatingInstances == null) {
this.terminatingInstances = null;
return;
}
this.terminatingInstances = new com.amazonaws.internal.SdkInternalList<InstanceStateChange>(terminatingInstances);
} | class class_name[name] begin[{]
method[setTerminatingInstances, return_type[void], modifier[public], parameter[terminatingInstances]] begin[{]
if[binary_operation[member[.terminatingInstances], ==, literal[null]]] begin[{]
assign[THIS[member[None.terminatingInstances]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.terminatingInstances]], ClassCreator(arguments=[MemberReference(member=terminatingInstances, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InstanceStateChange, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setTerminatingInstances] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[InstanceStateChange] operator[>] identifier[terminatingInstances] operator[SEP] {
Keyword[if] operator[SEP] identifier[terminatingInstances] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[terminatingInstances] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[terminatingInstances] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[InstanceStateChange] operator[>] operator[SEP] identifier[terminatingInstances] operator[SEP] operator[SEP]
}
|
public void writeObjectInstance(OutputStream out, ObjectInstanceWrapper value) throws IOException {
// ObjectInstance has no known sub-class.
writeStartObject(out);
writeObjectNameField(out, OM_OBJECTNAME, value.objectInstance.getObjectName());
writeStringField(out, OM_CLASSNAME, value.objectInstance.getClassName());
writeStringField(out, OM_URL, value.mbeanInfoURL);
writeEndObject(out);
} | class class_name[name] begin[{]
method[writeObjectInstance, return_type[void], modifier[public], parameter[out, value]] begin[{]
call[.writeStartObject, parameter[member[.out]]]
call[.writeObjectNameField, parameter[member[.out], member[.OM_OBJECTNAME], call[value.objectInstance.getObjectName, parameter[]]]]
call[.writeStringField, parameter[member[.out], member[.OM_CLASSNAME], call[value.objectInstance.getClassName, parameter[]]]]
call[.writeStringField, parameter[member[.out], member[.OM_URL], member[value.mbeanInfoURL]]]
call[.writeEndObject, parameter[member[.out]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeObjectInstance] operator[SEP] identifier[OutputStream] identifier[out] , identifier[ObjectInstanceWrapper] identifier[value] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeStartObject] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[writeObjectNameField] operator[SEP] identifier[out] , identifier[OM_OBJECTNAME] , identifier[value] operator[SEP] identifier[objectInstance] operator[SEP] identifier[getObjectName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writeStringField] operator[SEP] identifier[out] , identifier[OM_CLASSNAME] , identifier[value] operator[SEP] identifier[objectInstance] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writeStringField] operator[SEP] identifier[out] , identifier[OM_URL] , identifier[value] operator[SEP] identifier[mbeanInfoURL] operator[SEP] operator[SEP] identifier[writeEndObject] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
|
public static Pipe newPipe(final JsonParser parser, boolean numeric) throws IOException
{
final JsonInput jsonInput = new JsonInput(parser, numeric);
return new Pipe()
{
@Override
protected Input begin(Pipe.Schema<?> pipeSchema) throws IOException
{
if (parser.nextToken() != JsonToken.START_OBJECT)
{
throw new JsonInputException("Expected token: { but was " +
parser.getCurrentToken() + " on message " +
pipeSchema.wrappedSchema.messageFullName());
}
return jsonInput;
}
@Override
protected void end(Pipe.Schema<?> pipeSchema, Input input,
boolean cleanupOnly) throws IOException
{
if (cleanupOnly)
{
parser.close();
return;
}
assert input == jsonInput;
final JsonToken token = parser.getCurrentToken();
parser.close();
if (token != JsonToken.END_OBJECT)
{
throw new JsonInputException("Expected token: } but was " +
token + " on message " +
pipeSchema.wrappedSchema.messageFullName());
}
}
};
} | class class_name[name] begin[{]
method[newPipe, return_type[type[Pipe]], modifier[public static], parameter[parser, numeric]] begin[{]
local_variable[type[JsonInput], jsonInput]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=START_OBJECT, postfix_operators=[], prefix_operators=[], qualifier=JsonToken, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected token: { but was "), operandr=MethodInvocation(arguments=[], member=getCurrentToken, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" on message "), operator=+), operandr=MethodInvocation(arguments=[], member=messageFullName, postfix_operators=[], prefix_operators=[], qualifier=pipeSchema.wrappedSchema, 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=JsonInputException, sub_type=None)), label=None)])), ReturnStatement(expression=MemberReference(member=jsonInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'protected'}, name=begin, parameters=[FormalParameter(annotations=[], modifiers=set(), name=pipeSchema, type=ReferenceType(arguments=None, dimensions=[], name=Pipe, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=None, name=Schema, sub_type=None)), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Input, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MemberReference(member=cleanupOnly, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=jsonInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), label=None, value=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getCurrentToken, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), name=token)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JsonToken, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=END_OBJECT, postfix_operators=[], prefix_operators=[], qualifier=JsonToken, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected token: } but was "), operandr=MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" on message "), operator=+), operandr=MethodInvocation(arguments=[], member=messageFullName, postfix_operators=[], prefix_operators=[], qualifier=pipeSchema.wrappedSchema, 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=JsonInputException, sub_type=None)), label=None)]))], documentation=None, modifiers={'protected'}, name=end, parameters=[FormalParameter(annotations=[], modifiers=set(), name=pipeSchema, type=ReferenceType(arguments=None, dimensions=[], name=Pipe, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=None, name=Schema, sub_type=None)), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=input, type=ReferenceType(arguments=None, dimensions=[], name=Input, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=cleanupOnly, type=BasicType(dimensions=[], name=boolean), varargs=False)], return_type=None, throws=['IOException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Pipe, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Pipe] identifier[newPipe] operator[SEP] Keyword[final] identifier[JsonParser] identifier[parser] , Keyword[boolean] identifier[numeric] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[JsonInput] identifier[jsonInput] operator[=] Keyword[new] identifier[JsonInput] operator[SEP] identifier[parser] , identifier[numeric] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Pipe] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] identifier[Input] identifier[begin] operator[SEP] identifier[Pipe] operator[SEP] identifier[Schema] operator[<] operator[?] operator[>] identifier[pipeSchema] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[parser] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[!=] identifier[JsonToken] operator[SEP] identifier[START_OBJECT] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JsonInputException] operator[SEP] literal[String] operator[+] identifier[parser] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[pipeSchema] operator[SEP] identifier[wrappedSchema] operator[SEP] identifier[messageFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[jsonInput] operator[SEP]
} annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[end] operator[SEP] identifier[Pipe] operator[SEP] identifier[Schema] operator[<] operator[?] operator[>] identifier[pipeSchema] , identifier[Input] identifier[input] , Keyword[boolean] identifier[cleanupOnly] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[cleanupOnly] operator[SEP] {
identifier[parser] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[assert] identifier[input] operator[==] identifier[jsonInput] operator[SEP] Keyword[final] identifier[JsonToken] identifier[token] operator[=] identifier[parser] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[SEP] identifier[parser] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[token] operator[!=] identifier[JsonToken] operator[SEP] identifier[END_OBJECT] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JsonInputException] operator[SEP] literal[String] operator[+] identifier[token] operator[+] literal[String] operator[+] identifier[pipeSchema] operator[SEP] identifier[wrappedSchema] operator[SEP] identifier[messageFullName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP]
}
|
public static int compareBytes(ByteSequence bs1, ByteSequence bs2) {
int minLen = Math.min(bs1.length(), bs2.length());
for (int i = 0; i < minLen; i++) {
int a = (bs1.byteAt(i) & 0xff);
int b = (bs2.byteAt(i) & 0xff);
if (a != b) {
return a - b;
}
}
return bs1.length() - bs2.length();
} | class class_name[name] begin[{]
method[compareBytes, return_type[type[int]], modifier[public static], parameter[bs1, bs2]] begin[{]
local_variable[type[int], minLen]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=byteAt, postfix_operators=[], prefix_operators=[], qualifier=bs1, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=a)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=byteAt, postfix_operators=[], prefix_operators=[], qualifier=bs2, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=minLen, 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[binary_operation[call[bs1.length, parameter[]], -, call[bs2.length, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[compareBytes] operator[SEP] identifier[ByteSequence] identifier[bs1] , identifier[ByteSequence] identifier[bs2] operator[SEP] {
Keyword[int] identifier[minLen] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[bs1] operator[SEP] identifier[length] operator[SEP] operator[SEP] , identifier[bs2] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[minLen] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[a] operator[=] operator[SEP] identifier[bs1] operator[SEP] identifier[byteAt] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[int] identifier[b] operator[=] operator[SEP] identifier[bs2] operator[SEP] identifier[byteAt] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[!=] identifier[b] operator[SEP] {
Keyword[return] identifier[a] operator[-] identifier[b] operator[SEP]
}
}
Keyword[return] identifier[bs1] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[bs2] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
|
public static byte[] sha256(String data, String charset) {
return new Digester(DigestAlgorithm.SHA256).digest(data, charset);
} | class class_name[name] begin[{]
method[sha256, return_type[type[byte]], modifier[public static], parameter[data, charset]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=SHA256, postfix_operators=[], prefix_operators=[], qualifier=DigestAlgorithm, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=digest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Digester, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[sha256] operator[SEP] identifier[String] identifier[data] , identifier[String] identifier[charset] operator[SEP] {
Keyword[return] Keyword[new] identifier[Digester] operator[SEP] identifier[DigestAlgorithm] operator[SEP] identifier[SHA256] operator[SEP] operator[SEP] identifier[digest] operator[SEP] identifier[data] , identifier[charset] operator[SEP] operator[SEP]
}
|
public EClass getIfcTextStyleWithBoxCharacteristics() {
if (ifcTextStyleWithBoxCharacteristicsEClass == null) {
ifcTextStyleWithBoxCharacteristicsEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(607);
}
return ifcTextStyleWithBoxCharacteristicsEClass;
} | class class_name[name] begin[{]
method[getIfcTextStyleWithBoxCharacteristics, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcTextStyleWithBoxCharacteristicsEClass], ==, literal[null]]] begin[{]
assign[member[.ifcTextStyleWithBoxCharacteristicsEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=607)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcTextStyleWithBoxCharacteristicsEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcTextStyleWithBoxCharacteristics] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcTextStyleWithBoxCharacteristicsEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcTextStyleWithBoxCharacteristicsEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[607] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcTextStyleWithBoxCharacteristicsEClass] operator[SEP]
}
|
public boolean matches(HostName host) {
if(this == host) {
return true;
}
if(isValid()) {
if(host.isValid()) {
if(isAddressString()) {
return host.isAddressString()
&& asAddressString().equals(host.asAddressString())
&& Objects.equals(getPort(), host.getPort())
&& Objects.equals(getService(), host.getService());
}
if(host.isAddressString()) {
return false;
}
String thisHost = parsedHost.getHost();
String otherHost = host.parsedHost.getHost();
if(!thisHost.equals(otherHost)) {
return false;
}
return Objects.equals(parsedHost.getEquivalentPrefixLength(), host.parsedHost.getEquivalentPrefixLength()) &&
Objects.equals(parsedHost.getMask(), host.parsedHost.getMask()) &&
Objects.equals(parsedHost.getPort(), host.parsedHost.getPort()) &&
Objects.equals(parsedHost.getService(), host.parsedHost.getService());
}
return false;
}
return !host.isValid() && toString().equals(host.toString());
} | class class_name[name] begin[{]
method[matches, return_type[type[boolean]], modifier[public], parameter[host]] begin[{]
if[binary_operation[THIS[], ==, member[.host]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[.isValid, parameter[]]] begin[{]
if[call[host.isValid, parameter[]]] begin[{]
if[call[.isAddressString, parameter[]]] begin[{]
return[binary_operation[binary_operation[binary_operation[call[host.isAddressString, parameter[]], &&, call[.asAddressString, parameter[]]], &&, call[Objects.equals, parameter[call[.getPort, parameter[]], call[host.getPort, parameter[]]]]], &&, call[Objects.equals, parameter[call[.getService, parameter[]], call[host.getService, parameter[]]]]]]
else begin[{]
None
end[}]
if[call[host.isAddressString, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], thisHost]
local_variable[type[String], otherHost]
if[call[thisHost.equals, parameter[member[.otherHost]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[binary_operation[call[Objects.equals, parameter[call[parsedHost.getEquivalentPrefixLength, parameter[]], call[host.parsedHost.getEquivalentPrefixLength, parameter[]]]], &&, call[Objects.equals, parameter[call[parsedHost.getMask, parameter[]], call[host.parsedHost.getMask, parameter[]]]]], &&, call[Objects.equals, parameter[call[parsedHost.getPort, parameter[]], call[host.parsedHost.getPort, parameter[]]]]], &&, call[Objects.equals, parameter[call[parsedHost.getService, parameter[]], call[host.parsedHost.getService, parameter[]]]]]]
else begin[{]
None
end[}]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[call[host.isValid, parameter[]], &&, call[.toString, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[matches] operator[SEP] identifier[HostName] identifier[host] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[==] identifier[host] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[host] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isAddressString] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[host] operator[SEP] identifier[isAddressString] operator[SEP] operator[SEP] operator[&&] identifier[asAddressString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[host] operator[SEP] identifier[asAddressString] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[getService] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[host] operator[SEP] identifier[isAddressString] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[thisHost] operator[=] identifier[parsedHost] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[otherHost] operator[=] identifier[host] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[thisHost] operator[SEP] identifier[equals] operator[SEP] identifier[otherHost] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getEquivalentPrefixLength] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getEquivalentPrefixLength] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getMask] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getMask] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getService] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[parsedHost] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] operator[!] identifier[host] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[&&] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[host] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public final int getQueueLength() {
int n = 0;
for (Node p = tail; p != null; p = p.prev) {
if (p.thread != null)
++n;
}
return n;
} | class class_name[name] begin[{]
method[getQueueLength, return_type[type[int]], modifier[final public], parameter[]] begin[{]
local_variable[type[int], n]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=thread, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MemberReference(member=n, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=tail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=prev, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]))]), label=None)
return[member[.n]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[int] identifier[getQueueLength] operator[SEP] operator[SEP] {
Keyword[int] identifier[n] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[p] operator[=] identifier[tail] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] identifier[p] operator[=] identifier[p] operator[SEP] identifier[prev] operator[SEP] {
Keyword[if] operator[SEP] identifier[p] operator[SEP] identifier[thread] operator[!=] Other[null] operator[SEP] operator[++] identifier[n] operator[SEP]
}
Keyword[return] identifier[n] operator[SEP]
}
|
protected boolean resourceIsValid(CmsResource resource) {
if (!resource.getRootPath().startsWith(m_basePath)) {
return false;
}
if (m_requireFile & resource.isFolder()) {
return false;
}
if (m_requireFolder & resource.isFile()) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[resourceIsValid, return_type[type[boolean]], modifier[protected], parameter[resource]] begin[{]
if[call[resource.getRootPath, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_requireFile], &, call[resource.isFolder, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_requireFolder], &, call[resource.isFile, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[resourceIsValid] operator[SEP] identifier[CmsResource] identifier[resource] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[resource] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[m_basePath] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_requireFile] operator[&] identifier[resource] operator[SEP] identifier[isFolder] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_requireFolder] operator[&] identifier[resource] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Pure
public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32)
+ ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | class class_name[name] begin[{]
method[toLELong, return_type[type[long]], modifier[public static], parameter[b1, b2, b3, b4, b5, b6, b7, b8]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.b8], &, literal[0xFF]], <<, literal[56]], +, binary_operation[binary_operation[member[.b7], &, literal[0xFF]], <<, literal[48]]], +, binary_operation[binary_operation[member[.b6], &, literal[0xFF]], <<, literal[40]]], +, binary_operation[binary_operation[member[.b5], &, literal[0xFF]], <<, literal[32]]], +, binary_operation[binary_operation[member[.b4], &, literal[0xFF]], <<, literal[24]]], +, binary_operation[binary_operation[member[.b3], &, literal[0xFF]], <<, literal[16]]], +, binary_operation[binary_operation[member[.b2], &, literal[0xFF]], <<, literal[8]]], +, binary_operation[member[.b1], &, literal[0xFF]]]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] Keyword[static] Keyword[long] identifier[toLELong] operator[SEP] Keyword[int] identifier[b1] , Keyword[int] identifier[b2] , Keyword[int] identifier[b3] , Keyword[int] identifier[b4] , Keyword[int] identifier[b5] , Keyword[int] identifier[b6] , Keyword[int] identifier[b7] , Keyword[int] identifier[b8] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[b8] operator[&] literal[Integer] operator[SEP] operator[<<] Other[56] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b7] operator[&] literal[Integer] operator[SEP] operator[<<] Other[48] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b6] operator[&] literal[Integer] operator[SEP] operator[<<] Other[40] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b5] operator[&] literal[Integer] operator[SEP] operator[<<] Other[32] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b4] operator[&] literal[Integer] operator[SEP] operator[<<] Other[24] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b3] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b2] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[+] operator[SEP] identifier[b1] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
|
public java.util.List<ResourceRecord> getResourceRecords() {
if (resourceRecords == null) {
resourceRecords = new com.amazonaws.internal.SdkInternalList<ResourceRecord>();
}
return resourceRecords;
} | class class_name[name] begin[{]
method[getResourceRecords, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.resourceRecords], ==, literal[null]]] begin[{]
assign[member[.resourceRecords], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ResourceRecord, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.resourceRecords]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[ResourceRecord] operator[>] identifier[getResourceRecords] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[resourceRecords] operator[==] Other[null] operator[SEP] {
identifier[resourceRecords] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[ResourceRecord] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resourceRecords] operator[SEP]
}
|
@Indexable(type = IndexableType.REINDEX)
@Override
public CommerceAccountUserRel updateCommerceAccountUserRel(
CommerceAccountUserRel commerceAccountUserRel) {
return commerceAccountUserRelPersistence.update(commerceAccountUserRel);
} | class class_name[name] begin[{]
method[updateCommerceAccountUserRel, return_type[type[CommerceAccountUserRel]], modifier[public], parameter[commerceAccountUserRel]] begin[{]
return[call[commerceAccountUserRelPersistence.update, parameter[member[.commerceAccountUserRel]]]]
end[}]
END[}] | annotation[@] identifier[Indexable] operator[SEP] identifier[type] operator[=] identifier[IndexableType] operator[SEP] identifier[REINDEX] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[CommerceAccountUserRel] identifier[updateCommerceAccountUserRel] operator[SEP] identifier[CommerceAccountUserRel] identifier[commerceAccountUserRel] operator[SEP] {
Keyword[return] identifier[commerceAccountUserRelPersistence] operator[SEP] identifier[update] operator[SEP] identifier[commerceAccountUserRel] operator[SEP] operator[SEP]
}
|
public void setProperty(Object target, String property, Object value) {
NestedResolver resolver = new NestedResolver(target, property);
if (value instanceof String) {
convertStringValue(resolver.getNestedTarget(), resolver.getProperty(), (String) value);
} else {
setObjectValue(resolver.getNestedTarget(), resolver.getProperty(), value);
}
} | class class_name[name] begin[{]
method[setProperty, return_type[void], modifier[public], parameter[target, property, value]] begin[{]
local_variable[type[NestedResolver], resolver]
if[binary_operation[member[.value], instanceof, type[String]]] begin[{]
call[.convertStringValue, parameter[call[resolver.getNestedTarget, parameter[]], call[resolver.getProperty, parameter[]], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]
else begin[{]
call[.setObjectValue, parameter[call[resolver.getNestedTarget, parameter[]], call[resolver.getProperty, parameter[]], member[.value]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setProperty] operator[SEP] identifier[Object] identifier[target] , identifier[String] identifier[property] , identifier[Object] identifier[value] operator[SEP] {
identifier[NestedResolver] identifier[resolver] operator[=] Keyword[new] identifier[NestedResolver] operator[SEP] identifier[target] , identifier[property] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[convertStringValue] operator[SEP] identifier[resolver] operator[SEP] identifier[getNestedTarget] operator[SEP] operator[SEP] , identifier[resolver] operator[SEP] identifier[getProperty] operator[SEP] operator[SEP] , operator[SEP] identifier[String] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setObjectValue] operator[SEP] identifier[resolver] operator[SEP] identifier[getNestedTarget] operator[SEP] operator[SEP] , identifier[resolver] operator[SEP] identifier[getProperty] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
}
|
@OverrideOnDemand
@OverridingMethodsMustInvokeSuper
protected void fillMicroElement (@Nonnull final IMicroElement aElement,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
final boolean bHTML5 = aConversionSettings.getHTMLVersion ().isAtLeastHTML5 ();
if (StringHelper.hasText (m_sID))
aElement.setAttribute (CHTMLAttributes.ID, m_sID);
if (StringHelper.hasText (m_sTitle))
aElement.setAttribute (CHTMLAttributes.TITLE, m_sTitle);
if (StringHelper.hasText (m_sLanguage))
{
// Both "xml:lang" and "lang"
aElement.setAttribute (new MicroQName (XMLConstants.XML_NS_URI, CHTMLAttributes.LANG.getName ()), m_sLanguage);
aElement.setAttribute (CHTMLAttributes.LANG, m_sLanguage);
}
if (m_eDirection != null)
aElement.setAttribute (CHTMLAttributes.DIR, m_eDirection);
aElement.setAttribute (CHTMLAttributes.CLASS, getAllClassesAsString ());
aElement.setAttribute (CHTMLAttributes.STYLE, getAllStylesAsString (aConversionSettings.getCSSWriterSettings ()));
// Emit all JS events
if (m_aJSHandler != null)
{
final IJSWriterSettings aJSWriterSettings = aConversionSettings.getJSWriterSettings ();
// Loop over all events in the defined order for consistent results
for (final EJSEvent eEvent : EJSEvent.values ())
{
final CollectingJSCodeProvider aProvider = m_aJSHandler.getHandler (eEvent);
if (aProvider != null)
{
final String sJSCode = aProvider.getJSCode (aJSWriterSettings);
aElement.setAttribute (eEvent.getHTMLEventName (), CJS.JS_PREFIX + sJSCode);
}
}
}
// unfocusable is handled by the customizer as it is non-standard
// Global attributes
if (m_nTabIndex != DEFAULT_TABINDEX)
aElement.setAttribute (CHTMLAttributes.TABINDEX, m_nTabIndex);
if (StringHelper.hasText (m_sAccessKey))
aElement.setAttribute (CHTMLAttributes.ACCESSKEY, m_sAccessKey);
// Global HTML5 attributes
if (bHTML5)
{
if (m_eTranslate.isDefined ())
aElement.setAttribute (CHTMLAttributes.TRANSLATE,
m_eTranslate.isTrue () ? CHTMLAttributeValues.YES : CHTMLAttributeValues.NO);
if (m_eContentEditable != null)
aElement.setAttribute (CHTMLAttributes.CONTENTEDITABLE, m_eContentEditable);
if (StringHelper.hasText (m_sContextMenuID))
aElement.setAttribute (CHTMLAttributes.CONTEXTMENU, m_sContextMenuID);
if (m_eDraggable != null)
aElement.setAttribute (CHTMLAttributes.DRAGGABLE, m_eDraggable);
if (m_eDropZone != null)
aElement.setAttribute (CHTMLAttributes.DROPZONE, m_eDropZone);
if (m_bHidden)
aElement.setAttribute (CHTMLAttributes.HIDDEN, CHTMLAttributeValues.HIDDEN);
if (m_bSpellCheck)
aElement.setAttribute (CHTMLAttributes.SPELLCHECK, CHTMLAttributeValues.SPELLCHECK);
}
if (m_eRole != null)
aElement.setAttribute (CHTMLAttributes.ROLE, m_eRole.getID ());
if (m_aCustomAttrs != null)
for (final Map.Entry <IMicroQName, String> aEntry : m_aCustomAttrs.entrySet ())
aElement.setAttribute (aEntry.getKey (), aEntry.getValue ());
} | class class_name[name] begin[{]
method[fillMicroElement, return_type[void], modifier[protected], parameter[aElement, aConversionSettings]] begin[{]
local_variable[type[boolean], bHTML5]
if[call[StringHelper.hasText, parameter[member[.m_sID]]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.ID], member[.m_sID]]]
else begin[{]
None
end[}]
if[call[StringHelper.hasText, parameter[member[.m_sTitle]]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.TITLE], member[.m_sTitle]]]
else begin[{]
None
end[}]
if[call[StringHelper.hasText, parameter[member[.m_sLanguage]]]] begin[{]
call[aElement.setAttribute, parameter[ClassCreator(arguments=[MemberReference(member=XML_NS_URI, postfix_operators=[], prefix_operators=[], qualifier=XMLConstants, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=CHTMLAttributes.LANG, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MicroQName, sub_type=None)), member[.m_sLanguage]]]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.LANG], member[.m_sLanguage]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_eDirection], !=, literal[null]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.DIR], member[.m_eDirection]]]
else begin[{]
None
end[}]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.CLASS], call[.getAllClassesAsString, parameter[]]]]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.STYLE], call[.getAllStylesAsString, parameter[call[aConversionSettings.getCSSWriterSettings, parameter[]]]]]]
if[binary_operation[member[.m_aJSHandler], !=, literal[null]]] begin[{]
local_variable[type[IJSWriterSettings], aJSWriterSettings]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=eEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getHandler, postfix_operators=[], prefix_operators=[], qualifier=m_aJSHandler, selectors=[], type_arguments=None), name=aProvider)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=CollectingJSCodeProvider, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=aProvider, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aJSWriterSettings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJSCode, postfix_operators=[], prefix_operators=[], qualifier=aProvider, selectors=[], type_arguments=None), name=sJSCode)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHTMLEventName, postfix_operators=[], prefix_operators=[], qualifier=eEvent, selectors=[], type_arguments=None), BinaryOperation(operandl=MemberReference(member=JS_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=CJS, selectors=[]), operandr=MemberReference(member=sJSCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=setAttribute, postfix_operators=[], prefix_operators=[], qualifier=aElement, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=EJSEvent, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=eEvent)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=EJSEvent, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.m_nTabIndex], !=, member[.DEFAULT_TABINDEX]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.TABINDEX], member[.m_nTabIndex]]]
else begin[{]
None
end[}]
if[call[StringHelper.hasText, parameter[member[.m_sAccessKey]]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.ACCESSKEY], member[.m_sAccessKey]]]
else begin[{]
None
end[}]
if[member[.bHTML5]] begin[{]
if[call[m_eTranslate.isDefined, parameter[]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.TRANSLATE], TernaryExpression(condition=MethodInvocation(arguments=[], member=isTrue, postfix_operators=[], prefix_operators=[], qualifier=m_eTranslate, selectors=[], type_arguments=None), if_false=MemberReference(member=NO, postfix_operators=[], prefix_operators=[], qualifier=CHTMLAttributeValues, selectors=[]), if_true=MemberReference(member=YES, postfix_operators=[], prefix_operators=[], qualifier=CHTMLAttributeValues, selectors=[]))]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_eContentEditable], !=, literal[null]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.CONTENTEDITABLE], member[.m_eContentEditable]]]
else begin[{]
None
end[}]
if[call[StringHelper.hasText, parameter[member[.m_sContextMenuID]]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.CONTEXTMENU], member[.m_sContextMenuID]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_eDraggable], !=, literal[null]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.DRAGGABLE], member[.m_eDraggable]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_eDropZone], !=, literal[null]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.DROPZONE], member[.m_eDropZone]]]
else begin[{]
None
end[}]
if[member[.m_bHidden]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.HIDDEN], member[CHTMLAttributeValues.HIDDEN]]]
else begin[{]
None
end[}]
if[member[.m_bSpellCheck]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.SPELLCHECK], member[CHTMLAttributeValues.SPELLCHECK]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.m_eRole], !=, literal[null]]] begin[{]
call[aElement.setAttribute, parameter[member[CHTMLAttributes.ROLE], call[m_eRole.getID, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_aCustomAttrs], !=, literal[null]]] begin[{]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=aEntry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=aEntry, selectors=[], type_arguments=None)], member=setAttribute, postfix_operators=[], prefix_operators=[], qualifier=aElement, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=m_aCustomAttrs, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=aEntry)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IMicroQName, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[OverrideOnDemand] annotation[@] identifier[OverridingMethodsMustInvokeSuper] Keyword[protected] Keyword[void] identifier[fillMicroElement] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[IMicroElement] identifier[aElement] , annotation[@] identifier[Nonnull] Keyword[final] identifier[IHCConversionSettingsToNode] identifier[aConversionSettings] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[bHTML5] operator[=] identifier[aConversionSettings] operator[SEP] identifier[getHTMLVersion] operator[SEP] operator[SEP] operator[SEP] identifier[isAtLeastHTML5] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[m_sID] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[ID] , identifier[m_sID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[m_sTitle] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[TITLE] , identifier[m_sTitle] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[m_sLanguage] operator[SEP] operator[SEP] {
identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] Keyword[new] identifier[MicroQName] operator[SEP] identifier[XMLConstants] operator[SEP] identifier[XML_NS_URI] , identifier[CHTMLAttributes] operator[SEP] identifier[LANG] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] , identifier[m_sLanguage] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[LANG] , identifier[m_sLanguage] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_eDirection] operator[!=] Other[null] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[DIR] , identifier[m_eDirection] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[CLASS] , identifier[getAllClassesAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[STYLE] , identifier[getAllStylesAsString] operator[SEP] identifier[aConversionSettings] operator[SEP] identifier[getCSSWriterSettings] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_aJSHandler] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[IJSWriterSettings] identifier[aJSWriterSettings] operator[=] identifier[aConversionSettings] operator[SEP] identifier[getJSWriterSettings] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[EJSEvent] identifier[eEvent] operator[:] identifier[EJSEvent] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[CollectingJSCodeProvider] identifier[aProvider] operator[=] identifier[m_aJSHandler] operator[SEP] identifier[getHandler] operator[SEP] identifier[eEvent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aProvider] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[String] identifier[sJSCode] operator[=] identifier[aProvider] operator[SEP] identifier[getJSCode] operator[SEP] identifier[aJSWriterSettings] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[eEvent] operator[SEP] identifier[getHTMLEventName] operator[SEP] operator[SEP] , identifier[CJS] operator[SEP] identifier[JS_PREFIX] operator[+] identifier[sJSCode] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[m_nTabIndex] operator[!=] identifier[DEFAULT_TABINDEX] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[TABINDEX] , identifier[m_nTabIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[m_sAccessKey] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[ACCESSKEY] , identifier[m_sAccessKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bHTML5] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_eTranslate] operator[SEP] identifier[isDefined] operator[SEP] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[TRANSLATE] , identifier[m_eTranslate] operator[SEP] identifier[isTrue] operator[SEP] operator[SEP] operator[?] identifier[CHTMLAttributeValues] operator[SEP] identifier[YES] operator[:] identifier[CHTMLAttributeValues] operator[SEP] identifier[NO] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_eContentEditable] operator[!=] Other[null] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[CONTENTEDITABLE] , identifier[m_eContentEditable] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[m_sContextMenuID] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[CONTEXTMENU] , identifier[m_sContextMenuID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_eDraggable] operator[!=] Other[null] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[DRAGGABLE] , identifier[m_eDraggable] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_eDropZone] operator[!=] Other[null] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[DROPZONE] , identifier[m_eDropZone] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_bHidden] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[HIDDEN] , identifier[CHTMLAttributeValues] operator[SEP] identifier[HIDDEN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_bSpellCheck] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[SPELLCHECK] , identifier[CHTMLAttributeValues] operator[SEP] identifier[SPELLCHECK] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_eRole] operator[!=] Other[null] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHTMLAttributes] operator[SEP] identifier[ROLE] , identifier[m_eRole] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_aCustomAttrs] operator[!=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[IMicroQName] , identifier[String] operator[>] identifier[aEntry] operator[:] identifier[m_aCustomAttrs] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[aElement] operator[SEP] identifier[setAttribute] operator[SEP] identifier[aEntry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[aEntry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public UserPartTestMessage createUPT(int cic) {
UserPartTestMessage msg = createUPT();
CircuitIdentificationCode code = this.parameterFactory.createCircuitIdentificationCode();
code.setCIC(cic);
msg.setCircuitIdentificationCode(code);
return msg;
} | class class_name[name] begin[{]
method[createUPT, return_type[type[UserPartTestMessage]], modifier[public], parameter[cic]] begin[{]
local_variable[type[UserPartTestMessage], msg]
local_variable[type[CircuitIdentificationCode], code]
call[code.setCIC, parameter[member[.cic]]]
call[msg.setCircuitIdentificationCode, parameter[member[.code]]]
return[member[.msg]]
end[}]
END[}] | Keyword[public] identifier[UserPartTestMessage] identifier[createUPT] operator[SEP] Keyword[int] identifier[cic] operator[SEP] {
identifier[UserPartTestMessage] identifier[msg] operator[=] identifier[createUPT] operator[SEP] operator[SEP] operator[SEP] identifier[CircuitIdentificationCode] identifier[code] operator[=] Keyword[this] operator[SEP] identifier[parameterFactory] operator[SEP] identifier[createCircuitIdentificationCode] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] identifier[setCIC] operator[SEP] identifier[cic] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[setCircuitIdentificationCode] operator[SEP] identifier[code] operator[SEP] operator[SEP] Keyword[return] identifier[msg] operator[SEP]
}
|
public static DiscordRecords series2Discords(double[] series, int discordsNumToReport,
int windowSize, int paaSize, int alphabetSize, NumerosityReductionStrategy strategy,
double nThreshold) throws Exception {
// fix the start time
Date start = new Date();
// get the SAX transform done
NormalAlphabet normalA = new NormalAlphabet();
SAXRecords sax = sp.ts2saxViaWindow(series, windowSize, paaSize, normalA.getCuts(alphabetSize),
strategy, nThreshold);
Date saxEnd = new Date();
LOGGER.debug("discretized in {}, words: {}, indexes: {}",
SAXProcessor.timeToString(start.getTime(), saxEnd.getTime()), sax.getRecords().size(),
sax.getIndexes().size());
// fill the array for the outer loop
ArrayList<MagicArrayEntry> magicArray = new ArrayList<MagicArrayEntry>(sax.getRecords().size());
for (SAXRecord sr : sax.getRecords()) {
magicArray.add(new MagicArrayEntry(String.valueOf(sr.getPayload()), sr.getIndexes().size()));
}
Date hashEnd = new Date();
LOGGER.debug("Magic array filled in : {}",
SAXProcessor.timeToString(saxEnd.getTime(), hashEnd.getTime()));
DiscordRecords discords = getDiscordsWithMagic(series, sax, windowSize, magicArray,
discordsNumToReport, nThreshold);
Date end = new Date();
LOGGER.debug("{} discords found in {}", discords.getSize(),
SAXProcessor.timeToString(start.getTime(), end.getTime()));
return discords;
} | class class_name[name] begin[{]
method[series2Discords, return_type[type[DiscordRecords]], modifier[public static], parameter[series, discordsNumToReport, windowSize, paaSize, alphabetSize, strategy, nThreshold]] begin[{]
local_variable[type[Date], start]
local_variable[type[NormalAlphabet], normalA]
local_variable[type[SAXRecords], sax]
local_variable[type[Date], saxEnd]
call[LOGGER.debug, parameter[literal["discretized in {}, words: {}, indexes: {}"], call[SAXProcessor.timeToString, parameter[call[start.getTime, parameter[]], call[saxEnd.getTime, parameter[]]]], call[sax.getRecords, parameter[]], call[sax.getIndexes, parameter[]]]]
local_variable[type[ArrayList], magicArray]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPayload, postfix_operators=[], prefix_operators=[], qualifier=sr, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getIndexes, postfix_operators=[], prefix_operators=[], qualifier=sr, selectors=[MethodInvocation(arguments=[], member=size, 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=MagicArrayEntry, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=magicArray, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRecords, postfix_operators=[], prefix_operators=[], qualifier=sax, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SAXRecord, sub_type=None))), label=None)
local_variable[type[Date], hashEnd]
call[LOGGER.debug, parameter[literal["Magic array filled in : {}"], call[SAXProcessor.timeToString, parameter[call[saxEnd.getTime, parameter[]], call[hashEnd.getTime, parameter[]]]]]]
local_variable[type[DiscordRecords], discords]
local_variable[type[Date], end]
call[LOGGER.debug, parameter[literal["{} discords found in {}"], call[discords.getSize, parameter[]], call[SAXProcessor.timeToString, parameter[call[start.getTime, parameter[]], call[end.getTime, parameter[]]]]]]
return[member[.discords]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DiscordRecords] identifier[series2Discords] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[series] , Keyword[int] identifier[discordsNumToReport] , Keyword[int] identifier[windowSize] , Keyword[int] identifier[paaSize] , Keyword[int] identifier[alphabetSize] , identifier[NumerosityReductionStrategy] identifier[strategy] , Keyword[double] identifier[nThreshold] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Date] identifier[start] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[NormalAlphabet] identifier[normalA] operator[=] Keyword[new] identifier[NormalAlphabet] operator[SEP] operator[SEP] operator[SEP] identifier[SAXRecords] identifier[sax] operator[=] identifier[sp] operator[SEP] identifier[ts2saxViaWindow] operator[SEP] identifier[series] , identifier[windowSize] , identifier[paaSize] , identifier[normalA] operator[SEP] identifier[getCuts] operator[SEP] identifier[alphabetSize] operator[SEP] , identifier[strategy] , identifier[nThreshold] operator[SEP] operator[SEP] identifier[Date] identifier[saxEnd] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[SAXProcessor] operator[SEP] identifier[timeToString] operator[SEP] identifier[start] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] , identifier[saxEnd] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] , identifier[sax] operator[SEP] identifier[getRecords] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[sax] operator[SEP] identifier[getIndexes] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[MagicArrayEntry] operator[>] identifier[magicArray] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MagicArrayEntry] operator[>] operator[SEP] identifier[sax] operator[SEP] identifier[getRecords] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[SAXRecord] identifier[sr] operator[:] identifier[sax] operator[SEP] identifier[getRecords] operator[SEP] operator[SEP] operator[SEP] {
identifier[magicArray] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[MagicArrayEntry] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[sr] operator[SEP] identifier[getPayload] operator[SEP] operator[SEP] operator[SEP] , identifier[sr] operator[SEP] identifier[getIndexes] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Date] identifier[hashEnd] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[SAXProcessor] operator[SEP] identifier[timeToString] operator[SEP] identifier[saxEnd] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] , identifier[hashEnd] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DiscordRecords] identifier[discords] operator[=] identifier[getDiscordsWithMagic] operator[SEP] identifier[series] , identifier[sax] , identifier[windowSize] , identifier[magicArray] , identifier[discordsNumToReport] , identifier[nThreshold] operator[SEP] operator[SEP] identifier[Date] identifier[end] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[discords] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] , identifier[SAXProcessor] operator[SEP] identifier[timeToString] operator[SEP] identifier[start] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] , identifier[end] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[discords] operator[SEP]
}
|
private synchronized void disableDeferredReferenceData() {
deferredReferenceDataEnabled = false;
if (parent != null && deferredReferenceDatas != null) {
parent.removeDeferredReferenceData(this);
deferredReferenceDatas = null;
}
} | class class_name[name] begin[{]
method[disableDeferredReferenceData, return_type[void], modifier[synchronized private], parameter[]] begin[{]
assign[member[.deferredReferenceDataEnabled], literal[false]]
if[binary_operation[binary_operation[member[.parent], !=, literal[null]], &&, binary_operation[member[.deferredReferenceDatas], !=, literal[null]]]] begin[{]
call[parent.removeDeferredReferenceData, parameter[THIS[]]]
assign[member[.deferredReferenceDatas], literal[null]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[synchronized] Keyword[void] identifier[disableDeferredReferenceData] operator[SEP] operator[SEP] {
identifier[deferredReferenceDataEnabled] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[&&] identifier[deferredReferenceDatas] operator[!=] Other[null] operator[SEP] {
identifier[parent] operator[SEP] identifier[removeDeferredReferenceData] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[deferredReferenceDatas] operator[=] Other[null] operator[SEP]
}
}
|
public static double scale(double x, double fromMin, double fromMax,
double toMin, double toMax, boolean bounded) {
double result = (toMax - toMin) / (fromMax - fromMin) * (x - fromMin)
+ toMin;
return bounded ? Op.bound(x, toMin, toMax) : result;
} | class class_name[name] begin[{]
method[scale, return_type[type[double]], modifier[public static], parameter[x, fromMin, fromMax, toMin, toMax, bounded]] begin[{]
local_variable[type[double], result]
return[TernaryExpression(condition=MemberReference(member=bounded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toMin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toMax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bound, postfix_operators=[], prefix_operators=[], qualifier=Op, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[scale] operator[SEP] Keyword[double] identifier[x] , Keyword[double] identifier[fromMin] , Keyword[double] identifier[fromMax] , Keyword[double] identifier[toMin] , Keyword[double] identifier[toMax] , Keyword[boolean] identifier[bounded] operator[SEP] {
Keyword[double] identifier[result] operator[=] operator[SEP] identifier[toMax] operator[-] identifier[toMin] operator[SEP] operator[/] operator[SEP] identifier[fromMax] operator[-] identifier[fromMin] operator[SEP] operator[*] operator[SEP] identifier[x] operator[-] identifier[fromMin] operator[SEP] operator[+] identifier[toMin] operator[SEP] Keyword[return] identifier[bounded] operator[?] identifier[Op] operator[SEP] identifier[bound] operator[SEP] identifier[x] , identifier[toMin] , identifier[toMax] operator[SEP] operator[:] identifier[result] operator[SEP]
}
|
protected void loadProperties(String filename) {
ClassLoader thclassLoader = Thread.currentThread().getContextClassLoader();
if (thclassLoader != null){
URL url = thclassLoader.getResource(filename);
if (url != null){
try {
this.setXMLProperties(url.openStream(), null);
} catch (Exception e) {
// do nothing
}
}
}
} | class class_name[name] begin[{]
method[loadProperties, return_type[void], modifier[protected], parameter[filename]] begin[{]
local_variable[type[ClassLoader], thclassLoader]
if[binary_operation[member[.thclassLoader], !=, literal[null]]] begin[{]
local_variable[type[URL], url]
if[binary_operation[member[.url], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=openStream, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setXMLProperties, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, 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)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[loadProperties] operator[SEP] identifier[String] identifier[filename] operator[SEP] {
identifier[ClassLoader] identifier[thclassLoader] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[thclassLoader] operator[!=] Other[null] operator[SEP] {
identifier[URL] identifier[url] operator[=] identifier[thclassLoader] operator[SEP] identifier[getResource] operator[SEP] identifier[filename] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[setXMLProperties] operator[SEP] identifier[url] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
}
}
|
@Given("^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$")
public void saveElasticCluster(String host, String port, String envVar) throws Exception {
commonspec.setRestProtocol("http://");
commonspec.setRestHost(host);
commonspec.setRestPort(port);
Future<Response> response;
response = commonspec.generateRequest("GET", false, null, null, "/", "", "json", "");
commonspec.setResponse("GET", response.get());
String json;
String parsedElement;
json = commonspec.getResponse().getResponse();
parsedElement = "$..cluster_name";
String json2 = "[" + json + "]";
String value = commonspec.getJSONPathString(json2, parsedElement, "0");
if (value == null) {
throw new Exception("No cluster name is found");
} else {
ThreadProperty.set(envVar, value);
}
} | class class_name[name] begin[{]
method[saveElasticCluster, return_type[void], modifier[public], parameter[host, port, envVar]] begin[{]
call[commonspec.setRestProtocol, parameter[literal["http://"]]]
call[commonspec.setRestHost, parameter[member[.host]]]
call[commonspec.setRestPort, parameter[member[.port]]]
local_variable[type[Future], response]
assign[member[.response], call[commonspec.generateRequest, parameter[literal["GET"], literal[false], literal[null], literal[null], literal["/"], literal[""], literal["json"], literal[""]]]]
call[commonspec.setResponse, parameter[literal["GET"], call[response.get, parameter[]]]]
local_variable[type[String], json]
local_variable[type[String], parsedElement]
assign[member[.json], call[commonspec.getResponse, parameter[]]]
assign[member[.parsedElement], literal["$..cluster_name"]]
local_variable[type[String], json2]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No cluster name is found")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)
else begin[{]
call[ThreadProperty.set, parameter[member[.envVar], member[.value]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Given] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[saveElasticCluster] operator[SEP] identifier[String] identifier[host] , identifier[String] identifier[port] , identifier[String] identifier[envVar] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[commonspec] operator[SEP] identifier[setRestProtocol] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[commonspec] operator[SEP] identifier[setRestHost] operator[SEP] identifier[host] operator[SEP] operator[SEP] identifier[commonspec] operator[SEP] identifier[setRestPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[Future] operator[<] identifier[Response] operator[>] identifier[response] operator[SEP] identifier[response] operator[=] identifier[commonspec] operator[SEP] identifier[generateRequest] operator[SEP] literal[String] , literal[boolean] , Other[null] , Other[null] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[commonspec] operator[SEP] identifier[setResponse] operator[SEP] literal[String] , identifier[response] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[json] operator[SEP] identifier[String] identifier[parsedElement] operator[SEP] identifier[json] operator[=] identifier[commonspec] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[parsedElement] operator[=] literal[String] operator[SEP] identifier[String] identifier[json2] operator[=] literal[String] operator[+] identifier[json] operator[+] literal[String] operator[SEP] identifier[String] identifier[value] operator[=] identifier[commonspec] operator[SEP] identifier[getJSONPathString] operator[SEP] identifier[json2] , identifier[parsedElement] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ThreadProperty] operator[SEP] identifier[set] operator[SEP] identifier[envVar] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public GitlabCommit getCommit(Serializable projectId, String commitHash) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/repository/commits/" + commitHash;
return retrieve().to(tailUrl, GitlabCommit.class);
} | class class_name[name] begin[{]
method[getCommit, return_type[type[GitlabCommit]], modifier[public], parameter[projectId, commitHash]] begin[{]
local_variable[type[String], tailUrl]
return[call[.retrieve, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[GitlabCommit] identifier[getCommit] operator[SEP] identifier[Serializable] identifier[projectId] , identifier[String] identifier[commitHash] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[tailUrl] operator[=] identifier[GitlabProject] operator[SEP] identifier[URL] operator[+] literal[String] operator[+] identifier[sanitizeProjectId] operator[SEP] identifier[projectId] operator[SEP] operator[+] literal[String] operator[+] identifier[commitHash] operator[SEP] Keyword[return] identifier[retrieve] operator[SEP] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[tailUrl] , identifier[GitlabCommit] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public long getRepositoryQuota(String repositoryName) throws QuotaManagerException
{
RepositoryQuotaManager rqm = getRepositoryQuotaManager(repositoryName);
return rqm.getRepositoryQuota();
} | class class_name[name] begin[{]
method[getRepositoryQuota, return_type[type[long]], modifier[public], parameter[repositoryName]] begin[{]
local_variable[type[RepositoryQuotaManager], rqm]
return[call[rqm.getRepositoryQuota, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getRepositoryQuota] operator[SEP] identifier[String] identifier[repositoryName] operator[SEP] Keyword[throws] identifier[QuotaManagerException] {
identifier[RepositoryQuotaManager] identifier[rqm] operator[=] identifier[getRepositoryQuotaManager] operator[SEP] identifier[repositoryName] operator[SEP] operator[SEP] Keyword[return] identifier[rqm] operator[SEP] identifier[getRepositoryQuota] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final boolean isValid(final String value) {
if (value == null) {
return true;
}
if ((value.length() < 8) || (value.length() > 20)) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[final public static], parameter[value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[value.length, parameter[]], <, literal[8]], ||, binary_operation[call[value.length, parameter[]], >, literal[20]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[boolean] identifier[isValid] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] Other[8] operator[SEP] operator[||] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[20] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static InputStream getStream(String string) {
try {
return new ByteArrayInputStream(string.getBytes("UTF-8"));
} catch (UnsupportedEncodingException wontHappen) {
throw new FaultException(wontHappen);
}
} | class class_name[name] begin[{]
method[getStream, return_type[type[InputStream]], modifier[public static], parameter[string]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=string, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayInputStream, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=wontHappen, 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=FaultException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=wontHappen, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InputStream] identifier[getStream] operator[SEP] identifier[String] identifier[string] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[string] operator[SEP] identifier[getBytes] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[wontHappen] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FaultException] operator[SEP] identifier[wontHappen] operator[SEP] operator[SEP]
}
}
|
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (TypeElement dataSource : dataSets) {
SQLiteDatabaseSchema currentSchema = createDataSource(dataSource);
// Analyze beans BEFORE daos, because beans are needed for DAO
// definition
for (String daoName : currentSchema.getDaoNameSet()) {
// check dao into bean definition
createSQLEntityFromDao(currentSchema, dataSource, daoName);
} // end foreach bean
// sort table by its name, BEFORE inject generated tables and entities
Collections.sort(currentSchema.getCollection(), new Comparator<SQLiteDaoDefinition>() {
@Override
public int compare(SQLiteDaoDefinition o1, SQLiteDaoDefinition o2) {
return o1.getTableName().compareTo(o2.getTableName());
}
});
// DAO analysis
// Get all generated dao definitions
for (String generatedDaoItem : currentSchema.getDaoNameSet()) {
createSQLDaoDefinition(currentSchema, globalBeanElements, globalDaoElements, generatedDaoItem);
}
analyzeForeignKey(currentSchema);
// Relation must be done AFTER foreign key building!!!
analyzeRelations(currentSchema);
// Analyze custom bean
analyzeCustomBeanForSelect(currentSchema);
if (currentSchema.getCollection().size() == 0) {
AssertKripton.fail("DataSource class %s with @%s annotation has no defined DAOs",
currentSchema.getElement().getSimpleName().toString(),
BindDataSource.class.getSimpleName(),
BindDao.class.getSimpleName()
);
// info(msg);
return true;
}
// for each dao definition, we define its uid
int uid = 0;
for (SQLiteDaoDefinition daoDefinition : currentSchema.getCollection()) {
String daoFieldName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, daoDefinition.getName())
+ "_UID";
daoDefinition.daoUidName = daoFieldName;
daoDefinition.daoUidValue = uid;
uid++;
}
schemas.add(currentSchema);
} // end foreach dataSource
return true;
} | class class_name[name] begin[{]
method[process, return_type[type[boolean]], modifier[public], parameter[annotations, roundEnv]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dataSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createDataSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=currentSchema)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SQLiteDatabaseSchema, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=daoName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSQLEntityFromDao, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDaoNameSet, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=daoName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCollection, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[], type_arguments=None), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=SQLiteDaoDefinition, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=SQLiteDaoDefinition, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SQLiteDaoDefinition, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))], member=sort, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=globalBeanElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=globalDaoElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=generatedDaoItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSQLDaoDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDaoNameSet, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=generatedDaoItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyzeForeignKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyzeRelations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyzeCustomBeanForSelect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCollection, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DataSource class %s with @%s annotation has no defined DAOs"), MethodInvocation(arguments=[], member=getElement, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BindDataSource, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BindDao, sub_type=None))], member=fail, postfix_operators=[], prefix_operators=[], qualifier=AssertKripton, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=uid)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=UPPER_UNDERSCORE, postfix_operators=[], prefix_operators=[], qualifier=CaseFormat, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=daoDefinition, selectors=[], type_arguments=None)], member=to, postfix_operators=[], prefix_operators=[], qualifier=CaseFormat.UPPER_CAMEL, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_UID"), operator=+), name=daoFieldName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=daoUidName, postfix_operators=[], prefix_operators=[], qualifier=daoDefinition, selectors=[]), type==, value=MemberReference(member=daoFieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=daoUidValue, postfix_operators=[], prefix_operators=[], qualifier=daoDefinition, selectors=[]), type==, value=MemberReference(member=uid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MemberReference(member=uid, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getCollection, postfix_operators=[], prefix_operators=[], qualifier=currentSchema, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=daoDefinition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SQLiteDaoDefinition, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=schemas, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dataSets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dataSource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeElement, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[process] operator[SEP] identifier[Set] operator[<] operator[?] Keyword[extends] identifier[TypeElement] operator[>] identifier[annotations] , identifier[RoundEnvironment] identifier[roundEnv] operator[SEP] {
Keyword[for] operator[SEP] identifier[TypeElement] identifier[dataSource] operator[:] identifier[dataSets] operator[SEP] {
identifier[SQLiteDatabaseSchema] identifier[currentSchema] operator[=] identifier[createDataSource] operator[SEP] identifier[dataSource] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[daoName] operator[:] identifier[currentSchema] operator[SEP] identifier[getDaoNameSet] operator[SEP] operator[SEP] operator[SEP] {
identifier[createSQLEntityFromDao] operator[SEP] identifier[currentSchema] , identifier[dataSource] , identifier[daoName] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[currentSchema] operator[SEP] identifier[getCollection] operator[SEP] operator[SEP] , Keyword[new] identifier[Comparator] operator[<] identifier[SQLiteDaoDefinition] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[SQLiteDaoDefinition] identifier[o1] , identifier[SQLiteDaoDefinition] identifier[o2] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[o2] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[generatedDaoItem] operator[:] identifier[currentSchema] operator[SEP] identifier[getDaoNameSet] operator[SEP] operator[SEP] operator[SEP] {
identifier[createSQLDaoDefinition] operator[SEP] identifier[currentSchema] , identifier[globalBeanElements] , identifier[globalDaoElements] , identifier[generatedDaoItem] operator[SEP] operator[SEP]
}
identifier[analyzeForeignKey] operator[SEP] identifier[currentSchema] operator[SEP] operator[SEP] identifier[analyzeRelations] operator[SEP] identifier[currentSchema] operator[SEP] operator[SEP] identifier[analyzeCustomBeanForSelect] operator[SEP] identifier[currentSchema] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentSchema] operator[SEP] identifier[getCollection] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[AssertKripton] operator[SEP] identifier[fail] operator[SEP] literal[String] , identifier[currentSchema] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[BindDataSource] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[BindDao] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[uid] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[SQLiteDaoDefinition] identifier[daoDefinition] operator[:] identifier[currentSchema] operator[SEP] identifier[getCollection] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[daoFieldName] operator[=] identifier[CaseFormat] operator[SEP] identifier[UPPER_CAMEL] operator[SEP] identifier[to] operator[SEP] identifier[CaseFormat] operator[SEP] identifier[UPPER_UNDERSCORE] , identifier[daoDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[daoDefinition] operator[SEP] identifier[daoUidName] operator[=] identifier[daoFieldName] operator[SEP] identifier[daoDefinition] operator[SEP] identifier[daoUidValue] operator[=] identifier[uid] operator[SEP] identifier[uid] operator[++] operator[SEP]
}
identifier[schemas] operator[SEP] identifier[add] operator[SEP] identifier[currentSchema] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void setFocussed(final WComponent component, final UIContext uic) {
this.focussed = component;
this.focussedUIC = uic;
} | class class_name[name] begin[{]
method[setFocussed, return_type[void], modifier[public], parameter[component, uic]] begin[{]
assign[THIS[member[None.focussed]], member[.component]]
assign[THIS[member[None.focussedUIC]], member[.uic]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setFocussed] operator[SEP] Keyword[final] identifier[WComponent] identifier[component] , Keyword[final] identifier[UIContext] identifier[uic] operator[SEP] {
Keyword[this] operator[SEP] identifier[focussed] operator[=] identifier[component] operator[SEP] Keyword[this] operator[SEP] identifier[focussedUIC] operator[=] identifier[uic] operator[SEP]
}
|
private void parseControlSequence(Reader reader) throws IOException {
boolean finishedSequence = false;
StringBuilder parameters = new StringBuilder();
int character;
while ((character = reader.read()) != -1) {
if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z')) {
String[] array = parameters.toString().split(";");
AnsiControlSequence seq = new AnsiControlSequence((char) character, array);
listener.parsedControlSequence(seq);
finishedSequence = true;
break;
} else {
parameters.append((char) character);
}
}
if (!finishedSequence) {
// not an ideal solution if they used the two byte CSI, but it's
// easier and cleaner than keeping track of it
buffer.append((char) SINGLE_CSI);
buffer.append(parameters);
}
} | class class_name[name] begin[{]
method[parseControlSequence, return_type[void], modifier[private], parameter[reader]] begin[{]
local_variable[type[boolean], finishedSequence]
local_variable[type[StringBuilder], parameters]
local_variable[type[int], character]
while[binary_operation[assign[member[.character], call[reader.read, parameter[]]], !=, literal[1]]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.character], >=, literal['a']], &&, binary_operation[member[.character], <=, literal['z']]], ||, binary_operation[binary_operation[member[.character], >=, literal['A']], &&, binary_operation[member[.character], <=, literal['Z']]]]] begin[{]
local_variable[type[String], array]
local_variable[type[AnsiControlSequence], seq]
call[listener.parsedControlSequence, parameter[member[.seq]]]
assign[member[.finishedSequence], literal[true]]
BreakStatement(goto=None, label=None)
else begin[{]
call[parameters.append, parameter[Cast(expression=MemberReference(member=character, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]]
end[}]
end[}]
if[member[.finishedSequence]] begin[{]
call[buffer.append, parameter[Cast(expression=MemberReference(member=SINGLE_CSI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]]
call[buffer.append, parameter[member[.parameters]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[parseControlSequence] operator[SEP] identifier[Reader] identifier[reader] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[boolean] identifier[finishedSequence] operator[=] literal[boolean] operator[SEP] identifier[StringBuilder] identifier[parameters] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[character] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[character] operator[=] identifier[reader] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[character] operator[>=] literal[String] operator[&&] identifier[character] operator[<=] literal[String] operator[SEP] operator[||] operator[SEP] identifier[character] operator[>=] literal[String] operator[&&] identifier[character] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[array] operator[=] identifier[parameters] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[AnsiControlSequence] identifier[seq] operator[=] Keyword[new] identifier[AnsiControlSequence] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[character] , identifier[array] operator[SEP] operator[SEP] identifier[listener] operator[SEP] identifier[parsedControlSequence] operator[SEP] identifier[seq] operator[SEP] operator[SEP] identifier[finishedSequence] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[else] {
identifier[parameters] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[character] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[finishedSequence] operator[SEP] {
identifier[buffer] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[SINGLE_CSI] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[parameters] operator[SEP] operator[SEP]
}
}
|
public static File zip(List<String> fileNames, String zipPath, String encoding) {
try {
FileOutputStream f = new FileOutputStream(zipPath);
ZipArchiveOutputStream zos = (ZipArchiveOutputStream) new ArchiveStreamFactory()
.createArchiveOutputStream(ArchiveStreamFactory.ZIP, f);
if (null != encoding) {
zos.setEncoding(encoding);
}
for (int i = 0; i < fileNames.size(); i++) {
String fileName = fileNames.get(i);
String entryName = Strings.substringAfterLast(fileName, File.separator);
ZipArchiveEntry entry = new ZipArchiveEntry(entryName);
zos.putArchiveEntry(entry);
FileInputStream fis = new FileInputStream(fileName);
IOs.copy(fis, zos);
fis.close();
zos.closeArchiveEntry();
}
zos.close();
return new File(zipPath);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | class class_name[name] begin[{]
method[zip, return_type[type[File]], modifier[public static], parameter[fileNames, zipPath, encoding]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=zipPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None)), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=ZIP, postfix_operators=[], prefix_operators=[], qualifier=ArchiveStreamFactory, selectors=[]), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createArchiveOutputStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ArchiveStreamFactory, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=ZipArchiveOutputStream, sub_type=None)), name=zos)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ZipArchiveOutputStream, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setEncoding, postfix_operators=[], prefix_operators=[], qualifier=zos, selectors=[], type_arguments=None), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=fileNames, selectors=[], type_arguments=None), name=fileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=File, selectors=[])], member=substringAfterLast, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[], type_arguments=None), name=entryName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=entryName, 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=ZipArchiveEntry, sub_type=None)), name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ZipArchiveEntry, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putArchiveEntry, postfix_operators=[], prefix_operators=[], qualifier=zos, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=fileName, 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)), name=fis)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileInputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=IOs, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=fis, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=closeArchiveEntry, postfix_operators=[], prefix_operators=[], qualifier=zos, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=fileNames, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=zos, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=zipPath, 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=File, 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=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)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[File] identifier[zip] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[fileNames] , identifier[String] identifier[zipPath] , identifier[String] identifier[encoding] operator[SEP] {
Keyword[try] {
identifier[FileOutputStream] identifier[f] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[zipPath] operator[SEP] operator[SEP] identifier[ZipArchiveOutputStream] identifier[zos] operator[=] operator[SEP] identifier[ZipArchiveOutputStream] operator[SEP] Keyword[new] identifier[ArchiveStreamFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createArchiveOutputStream] operator[SEP] identifier[ArchiveStreamFactory] operator[SEP] identifier[ZIP] , identifier[f] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[encoding] operator[SEP] {
identifier[zos] operator[SEP] identifier[setEncoding] operator[SEP] identifier[encoding] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fileNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[fileName] operator[=] identifier[fileNames] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[entryName] operator[=] identifier[Strings] operator[SEP] identifier[substringAfterLast] operator[SEP] identifier[fileName] , identifier[File] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[ZipArchiveEntry] identifier[entry] operator[=] Keyword[new] identifier[ZipArchiveEntry] operator[SEP] identifier[entryName] operator[SEP] operator[SEP] identifier[zos] operator[SEP] identifier[putArchiveEntry] operator[SEP] identifier[entry] operator[SEP] operator[SEP] identifier[FileInputStream] identifier[fis] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] identifier[IOs] operator[SEP] identifier[copy] operator[SEP] identifier[fis] , identifier[zos] operator[SEP] operator[SEP] identifier[fis] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[zos] operator[SEP] identifier[closeArchiveEntry] operator[SEP] operator[SEP] operator[SEP]
}
identifier[zos] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[File] operator[SEP] identifier[zipPath] 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]
}
}
|
@Override
public void serialRecoveryComplete(RecoveryAgent recoveryAgent, FailureScope failureScope) throws InvalidFailureScopeException {
if (tc.isEntryEnabled())
Tr.entry(tc, "serialRecoveryComplete", new Object[] { recoveryAgent, failureScope, this });
final boolean removed = removeInitializationRecord(recoveryAgent, failureScope);
if (!removed) {
if (tc.isEventEnabled())
Tr.event(tc, "The supplied FailureScope was not recognized as outstaning work for this RecoveryAgent");
if (tc.isEntryEnabled())
Tr.exit(tc, "serialRecoveryComplete", "InvalidFailureScopeException");
throw new InvalidFailureScopeException(null);
}
_eventListeners.clientRecoveryComplete(failureScope, recoveryAgent.clientIdentifier());
if (tc.isEntryEnabled())
Tr.exit(tc, "serialRecoveryComplete");
} | class class_name[name] begin[{]
method[serialRecoveryComplete, return_type[void], modifier[public], parameter[recoveryAgent, failureScope]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.entry, parameter[member[.tc], literal["serialRecoveryComplete"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=recoveryAgent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failureScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[boolean], removed]
if[member[.removed]] begin[{]
if[call[tc.isEventEnabled, parameter[]]] begin[{]
call[Tr.event, parameter[member[.tc], literal["The supplied FailureScope was not recognized as outstaning work for this RecoveryAgent"]]]
else begin[{]
None
end[}]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["serialRecoveryComplete"], literal["InvalidFailureScopeException"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[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=InvalidFailureScopeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[_eventListeners.clientRecoveryComplete, parameter[member[.failureScope], call[recoveryAgent.clientIdentifier, parameter[]]]]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["serialRecoveryComplete"]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[serialRecoveryComplete] operator[SEP] identifier[RecoveryAgent] identifier[recoveryAgent] , identifier[FailureScope] identifier[failureScope] operator[SEP] Keyword[throws] identifier[InvalidFailureScopeException] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[recoveryAgent] , identifier[failureScope] , Keyword[this]
} operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[removed] operator[=] identifier[removeInitializationRecord] operator[SEP] identifier[recoveryAgent] , identifier[failureScope] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[removed] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidFailureScopeException] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[_eventListeners] operator[SEP] identifier[clientRecoveryComplete] operator[SEP] identifier[failureScope] , identifier[recoveryAgent] operator[SEP] identifier[clientIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
@WorkerThread
public static LottieResult<LottieComposition> fromJsonStringSync(String json, @Nullable String cacheKey) {
return fromJsonReaderSync(new JsonReader(new StringReader(json)), cacheKey);
} | class class_name[name] begin[{]
method[fromJsonStringSync, return_type[type[LottieResult]], modifier[public static], parameter[json, cacheKey]] begin[{]
return[call[.fromJsonReaderSync, parameter[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=json, 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=StringReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonReader, sub_type=None)), member[.cacheKey]]]]
end[}]
END[}] | annotation[@] identifier[WorkerThread] Keyword[public] Keyword[static] identifier[LottieResult] operator[<] identifier[LottieComposition] operator[>] identifier[fromJsonStringSync] operator[SEP] identifier[String] identifier[json] , annotation[@] identifier[Nullable] identifier[String] identifier[cacheKey] operator[SEP] {
Keyword[return] identifier[fromJsonReaderSync] operator[SEP] Keyword[new] identifier[JsonReader] operator[SEP] Keyword[new] identifier[StringReader] operator[SEP] identifier[json] operator[SEP] operator[SEP] , identifier[cacheKey] operator[SEP] operator[SEP]
}
|
@Override
public void setDestinationType(final String destinationType) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setDestinationType", destinationType);
}
_destinationType = destinationType;
dynamicallyCreateDestination();
} | class class_name[name] begin[{]
method[setDestinationType, return_type[void], modifier[public], parameter[destinationType]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[THIS[], member[.TRACE], literal["setDestinationType"], member[.destinationType]]]
else begin[{]
None
end[}]
assign[member[._destinationType], member[.destinationType]]
call[.dynamicallyCreateDestination, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setDestinationType] operator[SEP] Keyword[final] identifier[String] identifier[destinationType] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[TRACE] , literal[String] , identifier[destinationType] operator[SEP] operator[SEP]
}
identifier[_destinationType] operator[=] identifier[destinationType] operator[SEP] identifier[dynamicallyCreateDestination] operator[SEP] operator[SEP] operator[SEP]
}
|
@Nullable
public static Date getDate (@Nullable final XMLGregorianCalendar aCal)
{
final GregorianCalendar aGregorianCalendar = getGregorianCalendar (aCal);
return aGregorianCalendar == null ? null : aGregorianCalendar.getTime ();
} | class class_name[name] begin[{]
method[getDate, return_type[type[Date]], modifier[public static], parameter[aCal]] begin[{]
local_variable[type[GregorianCalendar], aGregorianCalendar]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=aGregorianCalendar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getTime, postfix_operators=[], prefix_operators=[], qualifier=aGregorianCalendar, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[Date] identifier[getDate] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[XMLGregorianCalendar] identifier[aCal] operator[SEP] {
Keyword[final] identifier[GregorianCalendar] identifier[aGregorianCalendar] operator[=] identifier[getGregorianCalendar] operator[SEP] identifier[aCal] operator[SEP] operator[SEP] Keyword[return] identifier[aGregorianCalendar] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[aGregorianCalendar] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void flushBufferedContent()
{
if (isResponseContentIntercepted())
{
try {
bufferedResponseContent.close();
ResponseContent buffer = new ResponseContentImpl(bufferedResponseContent.toByteArray(),
Charset.forName(getCharacterEncoding()));
new ResponseContentInterceptorChainImpl(responseContentInterceptors).begin(new HttpBufferRewriteImpl(
request, this, servletContext), buffer);
if (!Charset.forName(getCharacterEncoding()).equals(buffer.getCharset()))
setCharacterEncoding(buffer.getCharset().name());
ServletOutputStream outputStream = isResponseStreamWrapped() ? wrappedOutputStream : super
.getOutputStream();
if (outputStream != null)
Streams.copy(new ByteArrayInputStream(buffer.getContents()), outputStream);
if (printWriter != null) {
printWriter.close();
}
}
catch (IOException e) {
throw new RewriteException("Error occurred when flushing response content buffered by "
+ responseContentInterceptors, e);
}
}
} | class class_name[name] begin[{]
method[flushBufferedContent, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isResponseContentIntercepted, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=bufferedResponseContent, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=bufferedResponseContent, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterEncoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResponseContentImpl, sub_type=None)), name=buffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResponseContent, sub_type=None)), StatementExpression(expression=ClassCreator(arguments=[MemberReference(member=responseContentInterceptors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=servletContext, 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=HttpBufferRewriteImpl, sub_type=None)), MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=begin, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ResponseContentInterceptorChainImpl, sub_type=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterEncoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=['!'], qualifier=Charset, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharset, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharset, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setCharacterEncoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[], member=isResponseStreamWrapped, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=SuperMethodInvocation(arguments=[], member=getOutputStream, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), if_true=MemberReference(member=wrappedOutputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), name=outputStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ServletOutputStream, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getContents, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayInputStream, sub_type=None)), MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=Streams, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=printWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=printWriter, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error occurred when flushing response content buffered by "), operandr=MemberReference(member=responseContentInterceptors, 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=RewriteException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[flushBufferedContent] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isResponseContentIntercepted] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[bufferedResponseContent] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[ResponseContent] identifier[buffer] operator[=] Keyword[new] identifier[ResponseContentImpl] operator[SEP] identifier[bufferedResponseContent] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] , identifier[Charset] operator[SEP] identifier[forName] operator[SEP] identifier[getCharacterEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[ResponseContentInterceptorChainImpl] operator[SEP] identifier[responseContentInterceptors] operator[SEP] operator[SEP] identifier[begin] operator[SEP] Keyword[new] identifier[HttpBufferRewriteImpl] operator[SEP] identifier[request] , Keyword[this] , identifier[servletContext] operator[SEP] , identifier[buffer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Charset] operator[SEP] identifier[forName] operator[SEP] identifier[getCharacterEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[buffer] operator[SEP] identifier[getCharset] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setCharacterEncoding] operator[SEP] identifier[buffer] operator[SEP] identifier[getCharset] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ServletOutputStream] identifier[outputStream] operator[=] identifier[isResponseStreamWrapped] operator[SEP] operator[SEP] operator[?] identifier[wrappedOutputStream] operator[:] Keyword[super] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[outputStream] operator[!=] Other[null] operator[SEP] identifier[Streams] operator[SEP] identifier[copy] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[buffer] operator[SEP] identifier[getContents] operator[SEP] operator[SEP] operator[SEP] , identifier[outputStream] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[printWriter] operator[!=] Other[null] operator[SEP] {
identifier[printWriter] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RewriteException] operator[SEP] literal[String] operator[+] identifier[responseContentInterceptors] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public static <T extends IPositioned & ISized> IntSupplier centeredTo(ISized owner, T other, int offset)
{
checkNotNull(other);
return () -> {
return other.position().x() + (other.size().width() - owner.size().width()) / 2 + offset;
};
} | class class_name[name] begin[{]
method[centeredTo, return_type[type[IntSupplier]], modifier[public static], parameter[owner, other, offset]] begin[{]
call[.checkNotNull, parameter[member[.other]]]
return[LambdaExpression(body=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[MethodInvocation(arguments=[], member=x, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[MethodInvocation(arguments=[], member=width, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=owner, selectors=[MethodInvocation(arguments=[], member=width, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=+), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), label=None)], parameters=[])]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[IPositioned] operator[&] identifier[ISized] operator[>] identifier[IntSupplier] identifier[centeredTo] operator[SEP] identifier[ISized] identifier[owner] , identifier[T] identifier[other] , Keyword[int] identifier[offset] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[other] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] operator[->] {
Keyword[return] identifier[other] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] identifier[x] operator[SEP] operator[SEP] operator[+] operator[SEP] identifier[other] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[width] operator[SEP] operator[SEP] operator[-] identifier[owner] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[width] operator[SEP] operator[SEP] operator[SEP] operator[/] Other[2] operator[+] identifier[offset] operator[SEP]
} operator[SEP]
}
|
public static float max( float []array , int offset , int length ) {
float max = -Float.MAX_VALUE;
for (int i = 0; i < length; i++) {
float tmp = array[offset+i];
if( tmp > max ) {
max = tmp;
}
}
return max;
} | class class_name[name] begin[{]
method[max, return_type[type[float]], modifier[public static], parameter[array, offset, length]] begin[{]
local_variable[type[float], max]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), name=tmp)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=tmp, 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[.max]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] identifier[max] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] {
Keyword[float] identifier[max] operator[=] operator[-] identifier[Float] operator[SEP] identifier[MAX_VALUE] 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[float] identifier[tmp] operator[=] identifier[array] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[>] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[tmp] operator[SEP]
}
}
Keyword[return] identifier[max] operator[SEP]
}
|
public Group withKeys(String... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<String>(keys.length));
}
for (String ele : keys) {
this.keys.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withKeys, return_type[type[Group]], modifier[public], parameter[keys]] begin[{]
if[binary_operation[THIS[member[None.keys]], ==, literal[null]]] begin[{]
call[.setKeys, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=keys, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=keys, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Group] identifier[withKeys] operator[SEP] identifier[String] operator[...] identifier[keys] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[keys] operator[==] Other[null] operator[SEP] {
identifier[setKeys] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[keys] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[keys] operator[SEP] {
Keyword[this] operator[SEP] identifier[keys] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static <E> double crossEntropy(Counter<E> from, Counter<E> to) {
double tot2 = to.totalCount();
double result = 0.0;
for (E key : from.keySet()) {
double count1 = from.getCount(key);
if (count1 == 0.0) {
continue;
}
double count2 = to.getCount(key);
double logFract = Math.log(count2 / tot2);
if (logFract == Double.NEGATIVE_INFINITY) {
return Double.NEGATIVE_INFINITY; // can't recover
}
result += count1 * (logFract / LOG_E_2); // express it in log base 2
}
return result;
} | class class_name[name] begin[{]
method[crossEntropy, return_type[type[double]], modifier[public static], parameter[from, to]] begin[{]
local_variable[type[double], tot2]
local_variable[type[double], result]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCount, postfix_operators=[], prefix_operators=[], qualifier=from, selectors=[], type_arguments=None), name=count1)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=count1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), 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=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCount, postfix_operators=[], prefix_operators=[], qualifier=to, selectors=[], type_arguments=None), name=count2)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=count2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=tot2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=log, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=logFract)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=logFract, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NEGATIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=NEGATIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=count1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=logFract, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LOG_E_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operator=*)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=from, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] Keyword[double] identifier[crossEntropy] operator[SEP] identifier[Counter] operator[<] identifier[E] operator[>] identifier[from] , identifier[Counter] operator[<] identifier[E] operator[>] identifier[to] operator[SEP] {
Keyword[double] identifier[tot2] operator[=] identifier[to] operator[SEP] identifier[totalCount] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[result] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] identifier[E] identifier[key] operator[:] identifier[from] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[count1] operator[=] identifier[from] operator[SEP] identifier[getCount] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count1] operator[==] literal[Float] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[double] identifier[count2] operator[=] identifier[to] operator[SEP] identifier[getCount] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[double] identifier[logFract] operator[=] identifier[Math] operator[SEP] identifier[log] operator[SEP] identifier[count2] operator[/] identifier[tot2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logFract] operator[==] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP]
}
identifier[result] operator[+=] identifier[count1] operator[*] operator[SEP] identifier[logFract] operator[/] identifier[LOG_E_2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static boolean isModelDefaultValue(CamelCatalog camelCatalog, String modelName, String key, String value) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String name = propertyMap.get("name");
String defaultValue = propertyMap.get("defaultValue");
if (key.equals(name)) {
return value.equalsIgnoreCase(defaultValue);
}
}
}
return false;
} | class class_name[name] begin[{]
method[isModelDefaultValue, return_type[type[boolean]], modifier[public static], parameter[camelCatalog, modelName, key, value]] begin[{]
local_variable[type[String], json]
if[binary_operation[member[.json], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not find catalog entry for model name: "), operandr=MemberReference(member=modelName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[List], data]
if[binary_operation[member[.data], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=get, postfix_operators=[], prefix_operators=[], qualifier=propertyMap, selectors=[], type_arguments=None), name=name)], 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="defaultValue")], member=get, postfix_operators=[], prefix_operators=[], qualifier=propertyMap, selectors=[], type_arguments=None), name=defaultValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=propertyMap)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isModelDefaultValue] operator[SEP] identifier[CamelCatalog] identifier[camelCatalog] , identifier[String] identifier[modelName] , identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
identifier[String] identifier[json] operator[=] identifier[camelCatalog] operator[SEP] identifier[modelJSonSchema] operator[SEP] identifier[modelName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[json] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[modelName] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[data] operator[=] identifier[JSonSchemaHelper] operator[SEP] identifier[parseJsonSchema] operator[SEP] literal[String] , identifier[json] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[propertyMap] operator[:] identifier[data] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[propertyMap] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[defaultValue] operator[=] identifier[propertyMap] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[defaultValue] operator[SEP] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
protected final void checkIntegrity () throws InternetSCSIException {
String exceptionMessage;
do {
if (!writeExpectedFlag && !protocolDataUnit.getBasicHeaderSegment().isFinalFlag()) {
exceptionMessage = "W and F flag cannot both be 0.";
break;
}
if (expectedDataTransferLength != 0 && !(readExpectedFlag || writeExpectedFlag)) {
exceptionMessage = "The ExpectedDataTransferLength is greater than 0, so Read or/and Write Flag has to be set.";
break;
}
// message is checked correctly
return;
} while (false);
throw new InternetSCSIException(exceptionMessage);
} | class class_name[name] begin[{]
method[checkIntegrity, return_type[void], modifier[final protected], parameter[]] begin[{]
local_variable[type[String], exceptionMessage]
do[literal[false]] begin[{]
if[binary_operation[member[.writeExpectedFlag], &&, call[protocolDataUnit.getBasicHeaderSegment, parameter[]]]] begin[{]
assign[member[.exceptionMessage], literal["W and F flag cannot both be 0."]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.expectedDataTransferLength], !=, literal[0]], &&, binary_operation[member[.readExpectedFlag], ||, member[.writeExpectedFlag]]]] begin[{]
assign[member[.exceptionMessage], literal["The ExpectedDataTransferLength is greater than 0, so Read or/and Write Flag has to be set."]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
return[None]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=exceptionMessage, 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=InternetSCSIException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[final] Keyword[void] identifier[checkIntegrity] operator[SEP] operator[SEP] Keyword[throws] identifier[InternetSCSIException] {
identifier[String] identifier[exceptionMessage] operator[SEP] Keyword[do] {
Keyword[if] operator[SEP] operator[!] identifier[writeExpectedFlag] operator[&&] operator[!] identifier[protocolDataUnit] operator[SEP] identifier[getBasicHeaderSegment] operator[SEP] operator[SEP] operator[SEP] identifier[isFinalFlag] operator[SEP] operator[SEP] operator[SEP] {
identifier[exceptionMessage] operator[=] literal[String] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[expectedDataTransferLength] operator[!=] Other[0] operator[&&] operator[!] operator[SEP] identifier[readExpectedFlag] operator[||] identifier[writeExpectedFlag] operator[SEP] operator[SEP] {
identifier[exceptionMessage] operator[=] literal[String] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InternetSCSIException] operator[SEP] identifier[exceptionMessage] operator[SEP] operator[SEP]
}
|
public static <K,V> Storage<K,V> createHashtableStorage(){
return new Storage<K,V>(new MapStorageWrapper<K, V>(new HashMap<K, V>()));
} | class class_name[name] begin[{]
method[createHashtableStorage, return_type[type[Storage]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=MapStorageWrapper, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Storage, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Storage] operator[<] identifier[K] , identifier[V] operator[>] identifier[createHashtableStorage] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Storage] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] Keyword[new] identifier[MapStorageWrapper] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public long optLong(int index, long fallback) {
Object object = opt(index);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | class class_name[name] begin[{]
method[optLong, return_type[type[long]], modifier[public], parameter[index, fallback]] begin[{]
local_variable[type[Object], object]
local_variable[type[Long], result]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=fallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[optLong] operator[SEP] Keyword[int] identifier[index] , Keyword[long] identifier[fallback] operator[SEP] {
identifier[Object] identifier[object] operator[=] identifier[opt] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[Long] identifier[result] operator[=] identifier[JSON] operator[SEP] identifier[toLong] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[!=] Other[null] operator[?] identifier[result] operator[:] identifier[fallback] operator[SEP]
}
|
public void startLocalForwarding(String addressToBind, int portToBind,
String hostToConnect, int portToConnect) throws SshException {
String key = generateKey(addressToBind, portToBind);
SocketListener listener = new SocketListener(addressToBind, portToBind,
hostToConnect, portToConnect);
listener.start();
socketlisteners.put(key, listener);
if (!outgoingtunnels.containsKey(key)) {
outgoingtunnels.put(key, new Vector<ActiveTunnel>());
}
for (int i = 0; i < clientlisteners.size(); i++) {
((ForwardingClientListener) clientlisteners.elementAt(i))
.forwardingStarted(
ForwardingClientListener.LOCAL_FORWARDING, key,
hostToConnect, portToConnect);
}
EventServiceImplementation
.getInstance()
.fireEvent(
(new Event(this,
J2SSHEventCodes.EVENT_FORWARDING_LOCAL_STARTED,
true))
.addAttribute(
J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_ENTRANCE,
key)
.addAttribute(
J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_EXIT,
hostToConnect + ":" + portToConnect));
} | class class_name[name] begin[{]
method[startLocalForwarding, return_type[void], modifier[public], parameter[addressToBind, portToBind, hostToConnect, portToConnect]] begin[{]
local_variable[type[String], key]
local_variable[type[SocketListener], listener]
call[listener.start, parameter[]]
call[socketlisteners.put, parameter[member[.key], member[.listener]]]
if[call[outgoingtunnels.containsKey, parameter[member[.key]]]] begin[{]
call[outgoingtunnels.put, parameter[member[.key], 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=ActiveTunnel, sub_type=None))], dimensions=None, name=Vector, sub_type=None))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=clientlisteners, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ForwardingClientListener, sub_type=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=clientlisteners, 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[EventServiceImplementation.getInstance, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[startLocalForwarding] operator[SEP] identifier[String] identifier[addressToBind] , Keyword[int] identifier[portToBind] , identifier[String] identifier[hostToConnect] , Keyword[int] identifier[portToConnect] operator[SEP] Keyword[throws] identifier[SshException] {
identifier[String] identifier[key] operator[=] identifier[generateKey] operator[SEP] identifier[addressToBind] , identifier[portToBind] operator[SEP] operator[SEP] identifier[SocketListener] identifier[listener] operator[=] Keyword[new] identifier[SocketListener] operator[SEP] identifier[addressToBind] , identifier[portToBind] , identifier[hostToConnect] , identifier[portToConnect] operator[SEP] operator[SEP] identifier[listener] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[socketlisteners] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[listener] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[outgoingtunnels] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[outgoingtunnels] operator[SEP] identifier[put] operator[SEP] identifier[key] , Keyword[new] identifier[Vector] operator[<] identifier[ActiveTunnel] operator[>] 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[clientlisteners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
operator[SEP] operator[SEP] identifier[ForwardingClientListener] operator[SEP] identifier[clientlisteners] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[forwardingStarted] operator[SEP] identifier[ForwardingClientListener] operator[SEP] identifier[LOCAL_FORWARDING] , identifier[key] , identifier[hostToConnect] , identifier[portToConnect] operator[SEP] operator[SEP]
}
identifier[EventServiceImplementation] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[fireEvent] operator[SEP] operator[SEP] Keyword[new] identifier[Event] operator[SEP] Keyword[this] , identifier[J2SSHEventCodes] operator[SEP] identifier[EVENT_FORWARDING_LOCAL_STARTED] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[addAttribute] operator[SEP] identifier[J2SSHEventCodes] operator[SEP] identifier[ATTRIBUTE_FORWARDING_TUNNEL_ENTRANCE] , identifier[key] operator[SEP] operator[SEP] identifier[addAttribute] operator[SEP] identifier[J2SSHEventCodes] operator[SEP] identifier[ATTRIBUTE_FORWARDING_TUNNEL_EXIT] , identifier[hostToConnect] operator[+] literal[String] operator[+] identifier[portToConnect] operator[SEP] operator[SEP] operator[SEP]
}
|
public GridBagLayoutBuilder appendLabel(JLabel label, int colSpan) {
return append(label, colSpan, 1, false, false);
} | class class_name[name] begin[{]
method[appendLabel, return_type[type[GridBagLayoutBuilder]], modifier[public], parameter[label, colSpan]] begin[{]
return[call[.append, parameter[member[.label], member[.colSpan], literal[1], literal[false], literal[false]]]]
end[}]
END[}] | Keyword[public] identifier[GridBagLayoutBuilder] identifier[appendLabel] operator[SEP] identifier[JLabel] identifier[label] , Keyword[int] identifier[colSpan] operator[SEP] {
Keyword[return] identifier[append] operator[SEP] identifier[label] , identifier[colSpan] , Other[1] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
{
return reflector.getComponentType().isAssignableFrom(type)
&& MediaType.valueOf(reflector.getContentType()).isCompatible(mediaType);
} | class class_name[name] begin[{]
method[isWriteable, return_type[type[boolean]], modifier[public], parameter[type, genericType, annotations, mediaType]] begin[{]
return[binary_operation[call[reflector.getComponentType, parameter[]], &&, call[MediaType.valueOf, parameter[call[reflector.getContentType, parameter[]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isWriteable] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , identifier[Type] identifier[genericType] , identifier[Annotation] operator[SEP] operator[SEP] identifier[annotations] , identifier[MediaType] identifier[mediaType] operator[SEP] {
Keyword[return] identifier[reflector] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[MediaType] operator[SEP] identifier[valueOf] operator[SEP] identifier[reflector] operator[SEP] identifier[getContentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isCompatible] operator[SEP] identifier[mediaType] operator[SEP] operator[SEP]
}
|
@Deprecated
public static ReplaceOptions createReplaceOptions(final UpdateOptions updateOptions) {
notNull("updateOptions", updateOptions);
List<? extends Bson> arrayFilters = updateOptions.getArrayFilters();
isTrue("ArrayFilters should be empty.", arrayFilters == null || arrayFilters.isEmpty());
return new ReplaceOptions()
.bypassDocumentValidation(updateOptions.getBypassDocumentValidation())
.collation(updateOptions.getCollation())
.upsert(updateOptions.isUpsert());
} | class class_name[name] begin[{]
method[createReplaceOptions, return_type[type[ReplaceOptions]], modifier[public static], parameter[updateOptions]] begin[{]
call[.notNull, parameter[literal["updateOptions"], member[.updateOptions]]]
local_variable[type[List], arrayFilters]
call[.isTrue, parameter[literal["ArrayFilters should be empty."], binary_operation[binary_operation[member[.arrayFilters], ==, literal[null]], ||, call[arrayFilters.isEmpty, parameter[]]]]]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBypassDocumentValidation, postfix_operators=[], prefix_operators=[], qualifier=updateOptions, selectors=[], type_arguments=None)], member=bypassDocumentValidation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCollation, postfix_operators=[], prefix_operators=[], qualifier=updateOptions, selectors=[], type_arguments=None)], member=collation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isUpsert, postfix_operators=[], prefix_operators=[], qualifier=updateOptions, selectors=[], type_arguments=None)], member=upsert, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ReplaceOptions, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[ReplaceOptions] identifier[createReplaceOptions] operator[SEP] Keyword[final] identifier[UpdateOptions] identifier[updateOptions] operator[SEP] {
identifier[notNull] operator[SEP] literal[String] , identifier[updateOptions] operator[SEP] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[Bson] operator[>] identifier[arrayFilters] operator[=] identifier[updateOptions] operator[SEP] identifier[getArrayFilters] operator[SEP] operator[SEP] operator[SEP] identifier[isTrue] operator[SEP] literal[String] , identifier[arrayFilters] operator[==] Other[null] operator[||] identifier[arrayFilters] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ReplaceOptions] operator[SEP] operator[SEP] operator[SEP] identifier[bypassDocumentValidation] operator[SEP] identifier[updateOptions] operator[SEP] identifier[getBypassDocumentValidation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collation] operator[SEP] identifier[updateOptions] operator[SEP] identifier[getCollation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[upsert] operator[SEP] identifier[updateOptions] operator[SEP] identifier[isUpsert] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void expandBuffer(int newBufferSize)
{
// Allocate a new buffer.
ByteBuffer newBuffer = ByteBuffer.allocate(newBufferSize);
// Copy the content of the current buffer to the new buffer.
int oldPosition = mBuffer.position();
mBuffer.position(0);
newBuffer.put(mBuffer);
newBuffer.position(oldPosition);
// Replace the buffers.
mBuffer = newBuffer;
} | class class_name[name] begin[{]
method[expandBuffer, return_type[void], modifier[private], parameter[newBufferSize]] begin[{]
local_variable[type[ByteBuffer], newBuffer]
local_variable[type[int], oldPosition]
call[mBuffer.position, parameter[literal[0]]]
call[newBuffer.put, parameter[member[.mBuffer]]]
call[newBuffer.position, parameter[member[.oldPosition]]]
assign[member[.mBuffer], member[.newBuffer]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[expandBuffer] operator[SEP] Keyword[int] identifier[newBufferSize] operator[SEP] {
identifier[ByteBuffer] identifier[newBuffer] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] identifier[newBufferSize] operator[SEP] operator[SEP] Keyword[int] identifier[oldPosition] operator[=] identifier[mBuffer] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] identifier[mBuffer] operator[SEP] identifier[position] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[newBuffer] operator[SEP] identifier[put] operator[SEP] identifier[mBuffer] operator[SEP] operator[SEP] identifier[newBuffer] operator[SEP] identifier[position] operator[SEP] identifier[oldPosition] operator[SEP] operator[SEP] identifier[mBuffer] operator[=] identifier[newBuffer] operator[SEP]
}
|
public static SharedPreferencesItem newInstance(@NonNull Bundle bundle) {
SharedPreferencesItem sharedPreferencesItem = new SharedPreferencesItem();
sharedPreferencesItem.setArguments(bundle);
return sharedPreferencesItem;
} | class class_name[name] begin[{]
method[newInstance, return_type[type[SharedPreferencesItem]], modifier[public static], parameter[bundle]] begin[{]
local_variable[type[SharedPreferencesItem], sharedPreferencesItem]
call[sharedPreferencesItem.setArguments, parameter[member[.bundle]]]
return[member[.sharedPreferencesItem]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SharedPreferencesItem] identifier[newInstance] operator[SEP] annotation[@] identifier[NonNull] identifier[Bundle] identifier[bundle] operator[SEP] {
identifier[SharedPreferencesItem] identifier[sharedPreferencesItem] operator[=] Keyword[new] identifier[SharedPreferencesItem] operator[SEP] operator[SEP] operator[SEP] identifier[sharedPreferencesItem] operator[SEP] identifier[setArguments] operator[SEP] identifier[bundle] operator[SEP] operator[SEP] Keyword[return] identifier[sharedPreferencesItem] operator[SEP]
}
|
public int executeUpdate() throws SQLException {
startTimer();
try {
setQueryResult(getProtocol().executeQuery(dQuery));
dQuery.clearParameters();
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
stopTimer();
}
if (getQueryResult().getResultSetType() != ResultSetType.MODIFY) {
throw SQLExceptionMapper.getSQLException("The query returned a result set");
}
return (int) ((ModifyQueryResult) getQueryResult()).getUpdateCount();
} | class class_name[name] begin[{]
method[executeUpdate, return_type[type[int]], modifier[public], parameter[]] begin[{]
call[.startTimer, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProtocol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=dQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executeQuery, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setQueryResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clearParameters, postfix_operators=[], prefix_operators=[], qualifier=dQuery, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=SQLExceptionMapper, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['QueryException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=stopTimer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
if[binary_operation[call[.getQueryResult, parameter[]], !=, member[ResultSetType.MODIFY]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The query returned a result set")], member=getSQLException, postfix_operators=[], prefix_operators=[], qualifier=SQLExceptionMapper, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
return[Cast(expression=Cast(expression=MethodInvocation(arguments=[], member=getQueryResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ModifyQueryResult, sub_type=None)), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[executeUpdate] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[startTimer] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[setQueryResult] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] identifier[executeQuery] operator[SEP] identifier[dQuery] operator[SEP] operator[SEP] operator[SEP] identifier[dQuery] operator[SEP] identifier[clearParameters] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[QueryException] identifier[e] operator[SEP] {
Keyword[throw] identifier[SQLExceptionMapper] operator[SEP] identifier[get] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[stopTimer] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getQueryResult] operator[SEP] operator[SEP] operator[SEP] identifier[getResultSetType] operator[SEP] operator[SEP] operator[!=] identifier[ResultSetType] operator[SEP] identifier[MODIFY] operator[SEP] {
Keyword[throw] identifier[SQLExceptionMapper] operator[SEP] identifier[getSQLException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[ModifyQueryResult] operator[SEP] identifier[getQueryResult] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getUpdateCount] operator[SEP] operator[SEP] operator[SEP]
}
|
private static Config commandLineConfigs(String cluster, String role,
String environ, Boolean verbose) {
return Config.newBuilder()
.put(Key.CLUSTER, cluster)
.put(Key.ROLE, role)
.put(Key.ENVIRON, environ)
.put(Key.VERBOSE, verbose)
.build();
} | class class_name[name] begin[{]
method[commandLineConfigs, return_type[type[Config]], modifier[private static], parameter[cluster, role, environ, verbose]] begin[{]
return[call[Config.newBuilder, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Config] identifier[commandLineConfigs] operator[SEP] identifier[String] identifier[cluster] , identifier[String] identifier[role] , identifier[String] identifier[environ] , identifier[Boolean] identifier[verbose] operator[SEP] {
Keyword[return] identifier[Config] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Key] operator[SEP] identifier[CLUSTER] , identifier[cluster] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Key] operator[SEP] identifier[ROLE] , identifier[role] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Key] operator[SEP] identifier[ENVIRON] , identifier[environ] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Key] operator[SEP] identifier[VERBOSE] , identifier[verbose] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public InputStream get( Artifact artifact )
throws IOException, ArtifactNotFoundException
{
File file = getFile( artifact );
if ( !file.isFile() )
{
throw new ArtifactNotFoundException( artifact );
}
return new FileInputStream( file );
} | class class_name[name] begin[{]
method[get, return_type[type[InputStream]], modifier[public], parameter[artifact]] begin[{]
local_variable[type[File], file]
if[call[file.isFile, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=artifact, 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=ArtifactNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=file, 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))]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[get] operator[SEP] identifier[Artifact] identifier[artifact] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ArtifactNotFoundException] {
identifier[File] identifier[file] operator[=] identifier[getFile] operator[SEP] identifier[artifact] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[file] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArtifactNotFoundException] operator[SEP] identifier[artifact] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
|
@Override
public int indexOf(Object elem) {
int elemHash=elem.hashCode();
// Find the location to insert the object at
int elemHashPos=binarySearchHashCode(elemHash);
// Not found
if(elemHashPos<0) return -1;
// Try backwards until found or different hashCode
int pos=elemHashPos;
while(pos>=0) {
E T=get(pos);
if(T.hashCode()!=elemHash) break;
if(T.equals(elem)) {
// Found one, iterate backwards to the first one
while(pos>0 && get(pos-1).equals(elem)) pos--;
return pos;
}
pos--;
}
// Try forwards until found or different hashCode
pos=elemHashPos+1;
int size=size();
while(pos<size) {
E T=get(pos);
if(T.hashCode()!=elemHash) break;
if(T.equals(elem)) return pos;
pos++;
}
// Not found
return -1;
} | class class_name[name] begin[{]
method[indexOf, return_type[type[int]], modifier[public], parameter[elem]] begin[{]
local_variable[type[int], elemHash]
local_variable[type[int], elemHashPos]
if[binary_operation[member[.elemHashPos], <, literal[0]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], pos]
while[binary_operation[member[.pos], >=, literal[0]]] begin[{]
local_variable[type[E], T]
if[binary_operation[call[T.hashCode, parameter[]], !=, member[.elemHash]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[T.equals, parameter[member[.elem]]]] begin[{]
while[binary_operation[binary_operation[member[.pos], >, literal[0]], &&, call[.get, parameter[binary_operation[member[.pos], -, literal[1]]]]]] begin[{]
member[.pos]
end[}]
return[member[.pos]]
else begin[{]
None
end[}]
member[.pos]
end[}]
assign[member[.pos], binary_operation[member[.elemHashPos], +, literal[1]]]
local_variable[type[int], size]
while[binary_operation[member[.pos], <, member[.size]]] begin[{]
local_variable[type[E], T]
if[binary_operation[call[T.hashCode, parameter[]], !=, member[.elemHash]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[T.equals, parameter[member[.elem]]]] begin[{]
return[member[.pos]]
else begin[{]
None
end[}]
member[.pos]
end[}]
return[literal[1]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[indexOf] operator[SEP] identifier[Object] identifier[elem] operator[SEP] {
Keyword[int] identifier[elemHash] operator[=] identifier[elem] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[elemHashPos] operator[=] identifier[binarySearchHashCode] operator[SEP] identifier[elemHash] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elemHashPos] operator[<] Other[0] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[int] identifier[pos] operator[=] identifier[elemHashPos] operator[SEP] Keyword[while] operator[SEP] identifier[pos] operator[>=] Other[0] operator[SEP] {
identifier[E] identifier[T] operator[=] identifier[get] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[T] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[!=] identifier[elemHash] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[T] operator[SEP] identifier[equals] operator[SEP] identifier[elem] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[pos] operator[>] Other[0] operator[&&] identifier[get] operator[SEP] identifier[pos] operator[-] Other[1] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[elem] operator[SEP] operator[SEP] identifier[pos] operator[--] operator[SEP] Keyword[return] identifier[pos] operator[SEP]
}
identifier[pos] operator[--] operator[SEP]
}
identifier[pos] operator[=] identifier[elemHashPos] operator[+] Other[1] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[pos] operator[<] identifier[size] operator[SEP] {
identifier[E] identifier[T] operator[=] identifier[get] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[T] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[!=] identifier[elemHash] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[T] operator[SEP] identifier[equals] operator[SEP] identifier[elem] operator[SEP] operator[SEP] Keyword[return] identifier[pos] operator[SEP] identifier[pos] operator[++] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public MultipleDataProviderContext<DPO> read(DataProvider<DPO> dataProvider) {
if (dataProvider != null) {
addedDataProviders.add(dataProvider);
}
// Change context
return new MultipleDataProviderContext<DPO>(addedTriggers, addedDataProviders);
} | class class_name[name] begin[{]
method[read, return_type[type[MultipleDataProviderContext]], modifier[public], parameter[dataProvider]] begin[{]
if[binary_operation[member[.dataProvider], !=, literal[null]]] begin[{]
call[addedDataProviders.add, parameter[member[.dataProvider]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=addedTriggers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=addedDataProviders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DPO, sub_type=None))], dimensions=None, name=MultipleDataProviderContext, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[MultipleDataProviderContext] operator[<] identifier[DPO] operator[>] identifier[read] operator[SEP] identifier[DataProvider] operator[<] identifier[DPO] operator[>] identifier[dataProvider] operator[SEP] {
Keyword[if] operator[SEP] identifier[dataProvider] operator[!=] Other[null] operator[SEP] {
identifier[addedDataProviders] operator[SEP] identifier[add] operator[SEP] identifier[dataProvider] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[MultipleDataProviderContext] operator[<] identifier[DPO] operator[>] operator[SEP] identifier[addedTriggers] , identifier[addedDataProviders] operator[SEP] operator[SEP]
}
|
private void configureRecyclerViewScrollEvent() {
getRecyclerView().addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull final RecyclerView recyclerView, final int dx, final int dy) {
super.onScrolled(recyclerView, dx, dy);
recyclerView.post(new Runnable() {
@Override
public void run() {
enhanceFAB(getFab(), dx, dy);
onViewScrolled(recyclerView, dx, dy);
onViewScrolledToEnd(recyclerView, dx, dy);
}
});
}
@Override
public void onScrollStateChanged(@NonNull final RecyclerView recyclerView, final int newState) {
super.onScrollStateChanged(recyclerView, newState);
recyclerView.post(new Runnable() {
@Override
public void run() {
lastState = newState;
onViewScrollStateChanged(recyclerView, newState);
if (newState == SCROLL_STATE_IDLE) {
if (checkViewScrolledToFirst()) {
onViewScrolledToFirst(recyclerView);
}
if (checkViewScrolledToLast()) {
onViewScrolledToLast(recyclerView);
}
synchronized (lockEOL) {
if (lockEOL.get()) {
lockEOL.set(!lockEOL.get());
}
}
}
}
});
}
});
} | class class_name[name] begin[{]
method[configureRecyclerViewScrollEvent, return_type[void], modifier[private], parameter[]] begin[{]
call[.getRecyclerView, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[configureRecyclerViewScrollEvent] operator[SEP] operator[SEP] {
identifier[getRecyclerView] operator[SEP] operator[SEP] operator[SEP] identifier[addOnScrollListener] operator[SEP] Keyword[new] identifier[RecyclerView] operator[SEP] identifier[OnScrollListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onScrolled] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[RecyclerView] identifier[recyclerView] , Keyword[final] Keyword[int] identifier[dx] , Keyword[final] Keyword[int] identifier[dy] operator[SEP] {
Keyword[super] operator[SEP] identifier[onScrolled] operator[SEP] identifier[recyclerView] , identifier[dx] , identifier[dy] operator[SEP] operator[SEP] identifier[recyclerView] operator[SEP] identifier[post] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[enhanceFAB] operator[SEP] identifier[getFab] operator[SEP] operator[SEP] , identifier[dx] , identifier[dy] operator[SEP] operator[SEP] identifier[onViewScrolled] operator[SEP] identifier[recyclerView] , identifier[dx] , identifier[dy] operator[SEP] operator[SEP] identifier[onViewScrolledToEnd] operator[SEP] identifier[recyclerView] , identifier[dx] , identifier[dy] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onScrollStateChanged] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[RecyclerView] identifier[recyclerView] , Keyword[final] Keyword[int] identifier[newState] operator[SEP] {
Keyword[super] operator[SEP] identifier[onScrollStateChanged] operator[SEP] identifier[recyclerView] , identifier[newState] operator[SEP] operator[SEP] identifier[recyclerView] operator[SEP] identifier[post] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[lastState] operator[=] identifier[newState] operator[SEP] identifier[onViewScrollStateChanged] operator[SEP] identifier[recyclerView] , identifier[newState] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newState] operator[==] identifier[SCROLL_STATE_IDLE] operator[SEP] {
Keyword[if] operator[SEP] identifier[checkViewScrolledToFirst] operator[SEP] operator[SEP] operator[SEP] {
identifier[onViewScrolledToFirst] operator[SEP] identifier[recyclerView] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[checkViewScrolledToLast] operator[SEP] operator[SEP] operator[SEP] {
identifier[onViewScrolledToLast] operator[SEP] identifier[recyclerView] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[lockEOL] operator[SEP] {
Keyword[if] operator[SEP] identifier[lockEOL] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
identifier[lockEOL] operator[SEP] identifier[set] operator[SEP] operator[!] identifier[lockEOL] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
return (Boolean)getLHS().evaluate() || (Boolean)getRHS().evaluate();
} | class class_name[name] begin[{]
method[evaluate, return_type[type[Object]], modifier[public], parameter[]] begin[{]
if[call[.isCompileTimeConstant, parameter[]]] begin[{]
return[SuperMethodInvocation(arguments=[], member=evaluate, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
else begin[{]
None
end[}]
return[binary_operation[Cast(expression=MethodInvocation(arguments=[], member=getLHS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=evaluate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), ||, Cast(expression=MethodInvocation(arguments=[], member=getRHS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=evaluate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[evaluate] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isCompileTimeConstant] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[super] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[Boolean] operator[SEP] identifier[getLHS] operator[SEP] operator[SEP] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[Boolean] operator[SEP] identifier[getRHS] operator[SEP] operator[SEP] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP]
}
|
void handleAgentCallbackLoginEvent(AgentCallbackLoginEvent event)
{
AsteriskAgentImpl agent = getAgentByAgentId("Agent/" + event.getAgent());
if (agent == null)
{
synchronized (agents)
{
logger.error("Ignored AgentCallbackLoginEvent for unknown agent "
+ event.getAgent() + ". Agents: " + agents.values().toString());
}
return;
}
agent.updateState(AgentState.AGENT_IDLE);
} | class class_name[name] begin[{]
method[handleAgentCallbackLoginEvent, return_type[void], modifier[default], parameter[event]] begin[{]
local_variable[type[AsteriskAgentImpl], agent]
if[binary_operation[member[.agent], ==, literal[null]]] begin[{]
SYNCHRONIZED[member[.agents]] BEGIN[{]
call[logger.error, parameter[binary_operation[binary_operation[binary_operation[literal["Ignored AgentCallbackLoginEvent for unknown agent "], +, call[event.getAgent, parameter[]]], +, literal[". Agents: "]], +, call[agents.values, parameter[]]]]]
END[}]
return[None]
else begin[{]
None
end[}]
call[agent.updateState, parameter[member[AgentState.AGENT_IDLE]]]
end[}]
END[}] | Keyword[void] identifier[handleAgentCallbackLoginEvent] operator[SEP] identifier[AgentCallbackLoginEvent] identifier[event] operator[SEP] {
identifier[AsteriskAgentImpl] identifier[agent] operator[=] identifier[getAgentByAgentId] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[getAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[agent] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[agents] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[getAgent] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[agents] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
identifier[agent] operator[SEP] identifier[updateState] operator[SEP] identifier[AgentState] operator[SEP] identifier[AGENT_IDLE] operator[SEP] operator[SEP]
}
|
public ReferenceField getReferringField()
{
ClearFieldReferenceOnCloseHandler listener = (ClearFieldReferenceOnCloseHandler)this.getListener(ClearFieldReferenceOnCloseHandler.class, true);
while (listener != null)
{
BaseField field = listener.getField();
if (field instanceof ReferenceField)
if (((ReferenceField)field).getReferenceRecord(null, false) == this)
return (ReferenceField)field;
}
return null;
} | class class_name[name] begin[{]
method[getReferringField, return_type[type[ReferenceField]], modifier[public], parameter[]] begin[{]
local_variable[type[ClearFieldReferenceOnCloseHandler], listener]
while[binary_operation[member[.listener], !=, literal[null]]] begin[{]
local_variable[type[BaseField], field]
if[binary_operation[member[.field], instanceof, type[ReferenceField]]] begin[{]
if[binary_operation[Cast(expression=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ReferenceField, sub_type=None)), ==, THIS[]]] begin[{]
return[Cast(expression=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ReferenceField, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[ReferenceField] identifier[getReferringField] operator[SEP] operator[SEP] {
identifier[ClearFieldReferenceOnCloseHandler] identifier[listener] operator[=] operator[SEP] identifier[ClearFieldReferenceOnCloseHandler] operator[SEP] Keyword[this] operator[SEP] identifier[getListener] operator[SEP] identifier[ClearFieldReferenceOnCloseHandler] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[listener] operator[!=] Other[null] operator[SEP] {
identifier[BaseField] identifier[field] operator[=] identifier[listener] operator[SEP] identifier[getField] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] Keyword[instanceof] identifier[ReferenceField] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[ReferenceField] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[getReferenceRecord] operator[SEP] Other[null] , literal[boolean] operator[SEP] operator[==] Keyword[this] operator[SEP] Keyword[return] operator[SEP] identifier[ReferenceField] operator[SEP] identifier[field] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public <H extends Annotation> void scanForAnnotation(
Class<H> expectedAnnotation, Listener<T, H> listener) {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(beanType);
} catch (IntrospectionException e) {
throw new RuntimeException("Can't get bean info of " + beanType);
}
for (PropertyDescriptor desc : beanInfo.getPropertyDescriptors()) {
AccessibleObject access = findAnnotatedAccess(desc, expectedAnnotation);
if (access == null) {
continue;
}
ValueReference<T> reference;
if (access instanceof Field) {
reference = ValueReference.instanceOf((Field) access);
} else {
reference = ValueReference.instanceOf(desc);
}
listener.handleReference(reference, access.getAnnotation(expectedAnnotation), access);
}
for (Field field : beanType.getFields()) {
H annotation = field.getAnnotation(expectedAnnotation);
if (annotation == null) {
continue;
}
ValueReference<T> reference = ValueReference.instanceOf(field);
listener.handleReference(reference, annotation, field);
}
} | class class_name[name] begin[{]
method[scanForAnnotation, return_type[void], modifier[public], parameter[expectedAnnotation, listener]] begin[{]
local_variable[type[BeanInfo], beanInfo]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=beanInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=beanType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBeanInfo, postfix_operators=[], prefix_operators=[], qualifier=Introspector, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't get bean info of "), operandr=MemberReference(member=beanType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IntrospectionException']))], finally_block=None, label=None, resources=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=desc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expectedAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findAnnotatedAccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=access)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AccessibleObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=access, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=reference)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ValueReference, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=access, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=desc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instanceOf, postfix_operators=[], prefix_operators=[], qualifier=ValueReference, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Cast(expression=MemberReference(member=access, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))], member=instanceOf, postfix_operators=[], prefix_operators=[], qualifier=ValueReference, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=reference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=expectedAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnnotation, postfix_operators=[], prefix_operators=[], qualifier=access, selectors=[], type_arguments=None), MemberReference(member=access, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleReference, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPropertyDescriptors, postfix_operators=[], prefix_operators=[], qualifier=beanInfo, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=desc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyDescriptor, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=expectedAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnnotation, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), name=annotation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=H, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instanceOf, postfix_operators=[], prefix_operators=[], qualifier=ValueReference, selectors=[], type_arguments=None), name=reference)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ValueReference, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=reference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleReference, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFields, postfix_operators=[], prefix_operators=[], qualifier=beanType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] operator[<] identifier[H] Keyword[extends] identifier[Annotation] operator[>] Keyword[void] identifier[scanForAnnotation] operator[SEP] identifier[Class] operator[<] identifier[H] operator[>] identifier[expectedAnnotation] , identifier[Listener] operator[<] identifier[T] , identifier[H] operator[>] identifier[listener] operator[SEP] {
identifier[BeanInfo] identifier[beanInfo] operator[SEP] Keyword[try] {
identifier[beanInfo] operator[=] identifier[Introspector] operator[SEP] identifier[getBeanInfo] operator[SEP] identifier[beanType] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IntrospectionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[beanType] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[PropertyDescriptor] identifier[desc] operator[:] identifier[beanInfo] operator[SEP] identifier[getPropertyDescriptors] operator[SEP] operator[SEP] operator[SEP] {
identifier[AccessibleObject] identifier[access] operator[=] identifier[findAnnotatedAccess] operator[SEP] identifier[desc] , identifier[expectedAnnotation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[access] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[ValueReference] operator[<] identifier[T] operator[>] identifier[reference] operator[SEP] Keyword[if] operator[SEP] identifier[access] Keyword[instanceof] identifier[Field] operator[SEP] {
identifier[reference] operator[=] identifier[ValueReference] operator[SEP] identifier[instanceOf] operator[SEP] operator[SEP] identifier[Field] operator[SEP] identifier[access] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[reference] operator[=] identifier[ValueReference] operator[SEP] identifier[instanceOf] operator[SEP] identifier[desc] operator[SEP] operator[SEP]
}
identifier[listener] operator[SEP] identifier[handleReference] operator[SEP] identifier[reference] , identifier[access] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[expectedAnnotation] operator[SEP] , identifier[access] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Field] identifier[field] operator[:] identifier[beanType] operator[SEP] identifier[getFields] operator[SEP] operator[SEP] operator[SEP] {
identifier[H] identifier[annotation] operator[=] identifier[field] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[expectedAnnotation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[annotation] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[ValueReference] operator[<] identifier[T] operator[>] identifier[reference] operator[=] identifier[ValueReference] operator[SEP] identifier[instanceOf] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[listener] operator[SEP] identifier[handleReference] operator[SEP] identifier[reference] , identifier[annotation] , identifier[field] operator[SEP] operator[SEP]
}
}
|
private UserRole getDelfoiRole(User user) {
Delfoi delfoi = getDelfoi();
if (delfoi != null) {
DelfoiUserDAO delfoiUserDAO = new DelfoiUserDAO();
DelfoiUser delfoiUser = delfoiUserDAO.findByDelfoiAndUser(delfoi, user);
return delfoiUser == null ? getEveryoneRole() : delfoiUser.getRole();
}
return getEveryoneRole();
} | class class_name[name] begin[{]
method[getDelfoiRole, return_type[type[UserRole]], modifier[private], parameter[user]] begin[{]
local_variable[type[Delfoi], delfoi]
if[binary_operation[member[.delfoi], !=, literal[null]]] begin[{]
local_variable[type[DelfoiUserDAO], delfoiUserDAO]
local_variable[type[DelfoiUser], delfoiUser]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=delfoiUser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getRole, postfix_operators=[], prefix_operators=[], qualifier=delfoiUser, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=getEveryoneRole, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
else begin[{]
None
end[}]
return[call[.getEveryoneRole, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[UserRole] identifier[getDelfoiRole] operator[SEP] identifier[User] identifier[user] operator[SEP] {
identifier[Delfoi] identifier[delfoi] operator[=] identifier[getDelfoi] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[delfoi] operator[!=] Other[null] operator[SEP] {
identifier[DelfoiUserDAO] identifier[delfoiUserDAO] operator[=] Keyword[new] identifier[DelfoiUserDAO] operator[SEP] operator[SEP] operator[SEP] identifier[DelfoiUser] identifier[delfoiUser] operator[=] identifier[delfoiUserDAO] operator[SEP] identifier[findByDelfoiAndUser] operator[SEP] identifier[delfoi] , identifier[user] operator[SEP] operator[SEP] Keyword[return] identifier[delfoiUser] operator[==] Other[null] operator[?] identifier[getEveryoneRole] operator[SEP] operator[SEP] operator[:] identifier[delfoiUser] operator[SEP] identifier[getRole] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getEveryoneRole] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean isRunning() {
lock.lock();
try {
return process != null && process.isRunning();
} catch (IllegalThreadStateException e) {
return true;
} finally {
lock.unlock();
}
} | class class_name[name] begin[{]
method[isRunning, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
call[lock.lock, parameter[]]
TryStatement(block=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=process, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isRunning, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None), operator=&&), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalThreadStateException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isRunning] operator[SEP] operator[SEP] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[process] operator[!=] Other[null] operator[&&] identifier[process] operator[SEP] identifier[isRunning] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalThreadStateException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Invocation getInvocation(final RpcRequest request, InterfaceDescriptor<?> descriptor) {
if (request == null) throw new NullPointerException("request");
if (descriptor == null) throw new NullPointerException("descriptor");
Invocation invocation = null;
LinkedList<String> parts = splitPath(request.getRelativePath());
while (!parts.isEmpty()) {
String part = parts.removeFirst();
// Find a method by a name.
MethodDescriptor<?, ?> method = descriptor.getMethod(part);
if (method == null) {
throw RpcException.badRequest("Method is not found: " + part);
}
// Check the required HTTP method.
if (method.isPost() && !request.isPost()) {
throw RpcException.methodNotAllowed("Method not allowed, POST required");
}
// Parse arguments.
List<Object> args = readArgs(method, parts, request.getQuery(), request.getPost());
// Create a root invocation,
// or a next invocation in a chain.
invocation = invocation != null ? invocation.next(method, args.toArray())
: Invocation.root(method, args.toArray());
if (method.isTerminal()) {
break;
}
// It's an interface method.
// Get the next interface and proceed parsing the parts.
descriptor = (InterfaceDescriptor<?>) method.getResult();
}
if (!parts.isEmpty()) {
// No more interface descriptors in a chain, but the parts are still present.
throw RpcException.badRequest("Failed to parse an invocation chain");
}
if (invocation == null) {
throw RpcException.badRequest("Invocation chain required");
}
if (!invocation.getMethod().isTerminal()) {
throw RpcException.badRequest("The last method must be a terminal one. "
+ "It must return a data type or be void.");
}
return invocation;
} | class class_name[name] begin[{]
method[getInvocation, return_type[type[Invocation]], modifier[public], parameter[request, descriptor]] begin[{]
if[binary_operation[member[.request], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="request")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.descriptor], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="descriptor")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Invocation], invocation]
local_variable[type[LinkedList], parts]
while[call[parts.isEmpty, parameter[]]] begin[{]
local_variable[type[String], part]
local_variable[type[MethodDescriptor], method]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Method is not found: "), operandr=MemberReference(member=part, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=badRequest, postfix_operators=[], prefix_operators=[], qualifier=RpcException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[method.isPost, parameter[]], &&, call[request.isPost, parameter[]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Method not allowed, POST required")], member=methodNotAllowed, postfix_operators=[], prefix_operators=[], qualifier=RpcException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[List], args]
assign[member[.invocation], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=invocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[], type_arguments=None)], member=root, postfix_operators=[], prefix_operators=[], qualifier=Invocation, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[], type_arguments=None)], member=next, postfix_operators=[], prefix_operators=[], qualifier=invocation, selectors=[], type_arguments=None))]
if[call[method.isTerminal, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.descriptor], Cast(expression=MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=InterfaceDescriptor, sub_type=None))]
end[}]
if[call[parts.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to parse an invocation chain")], member=badRequest, postfix_operators=[], prefix_operators=[], qualifier=RpcException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.invocation], ==, literal[null]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invocation chain required")], member=badRequest, postfix_operators=[], prefix_operators=[], qualifier=RpcException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
if[call[invocation.getMethod, parameter[]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The last method must be a terminal one. "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="It must return a data type or be void."), operator=+)], member=badRequest, postfix_operators=[], prefix_operators=[], qualifier=RpcException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
return[member[.invocation]]
end[}]
END[}] | Keyword[public] identifier[Invocation] identifier[getInvocation] operator[SEP] Keyword[final] identifier[RpcRequest] identifier[request] , identifier[InterfaceDescriptor] operator[<] operator[?] operator[>] identifier[descriptor] operator[SEP] {
Keyword[if] operator[SEP] identifier[request] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[descriptor] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Invocation] identifier[invocation] operator[=] Other[null] operator[SEP] identifier[LinkedList] operator[<] identifier[String] operator[>] identifier[parts] operator[=] identifier[splitPath] operator[SEP] identifier[request] operator[SEP] identifier[getRelativePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[parts] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[part] operator[=] identifier[parts] operator[SEP] identifier[removeFirst] operator[SEP] operator[SEP] operator[SEP] identifier[MethodDescriptor] operator[<] operator[?] , operator[?] operator[>] identifier[method] operator[=] identifier[descriptor] operator[SEP] identifier[getMethod] operator[SEP] identifier[part] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[throw] identifier[RpcException] operator[SEP] identifier[badRequest] operator[SEP] literal[String] operator[+] identifier[part] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[isPost] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[request] operator[SEP] identifier[isPost] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[RpcException] operator[SEP] identifier[methodNotAllowed] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Object] operator[>] identifier[args] operator[=] identifier[readArgs] operator[SEP] identifier[method] , identifier[parts] , identifier[request] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getPost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[invocation] operator[=] identifier[invocation] operator[!=] Other[null] operator[?] identifier[invocation] operator[SEP] identifier[next] operator[SEP] identifier[method] , identifier[args] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[Invocation] operator[SEP] identifier[root] operator[SEP] identifier[method] , identifier[args] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[isTerminal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[descriptor] operator[=] operator[SEP] identifier[InterfaceDescriptor] operator[<] operator[?] operator[>] operator[SEP] identifier[method] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[parts] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[RpcException] operator[SEP] identifier[badRequest] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[invocation] operator[==] Other[null] operator[SEP] {
Keyword[throw] identifier[RpcException] operator[SEP] identifier[badRequest] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[invocation] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[isTerminal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[RpcException] operator[SEP] identifier[badRequest] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[invocation] operator[SEP]
}
|
public String formatRecord(RepositoryLogRecord record) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
return formatRecord(record, (Locale) null);
} | class class_name[name] begin[{]
method[formatRecord, return_type[type[String]], modifier[public], parameter[record]] begin[{]
if[binary_operation[literal[null], ==, member[.record]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Record cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.formatRecord, parameter[member[.record], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=Locale, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[formatRecord] operator[SEP] identifier[RepositoryLogRecord] identifier[record] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[record] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[formatRecord] operator[SEP] identifier[record] , operator[SEP] identifier[Locale] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
public static String transformClassName(String className) {
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
String pkg = className.substring(0, lastDot);
if (!isUnlikelyToBeRenamed(pkg)) {
className = className.substring(lastDot + 1);
}
}
return className;
} | class class_name[name] begin[{]
method[transformClassName, return_type[type[String]], modifier[public static], parameter[className]] begin[{]
local_variable[type[int], lastDot]
if[binary_operation[member[.lastDot], >=, literal[0]]] begin[{]
local_variable[type[String], pkg]
if[call[.isUnlikelyToBeRenamed, parameter[member[.pkg]]]] begin[{]
assign[member[.className], call[className.substring, parameter[binary_operation[member[.lastDot], +, literal[1]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.className]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[transformClassName] operator[SEP] identifier[String] identifier[className] operator[SEP] {
Keyword[int] identifier[lastDot] operator[=] identifier[className] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastDot] operator[>=] Other[0] operator[SEP] {
identifier[String] identifier[pkg] operator[=] identifier[className] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[lastDot] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isUnlikelyToBeRenamed] operator[SEP] identifier[pkg] operator[SEP] operator[SEP] {
identifier[className] operator[=] identifier[className] operator[SEP] identifier[substring] operator[SEP] identifier[lastDot] operator[+] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[className] operator[SEP]
}
|
@Override
public EClass getIfcCartesianPointList3D() {
if (ifcCartesianPointList3DEClass == null) {
ifcCartesianPointList3DEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(80);
}
return ifcCartesianPointList3DEClass;
} | class class_name[name] begin[{]
method[getIfcCartesianPointList3D, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcCartesianPointList3DEClass], ==, literal[null]]] begin[{]
assign[member[.ifcCartesianPointList3DEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=80)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcCartesianPointList3DEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcCartesianPointList3D] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcCartesianPointList3DEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcCartesianPointList3DEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[80] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcCartesianPointList3DEClass] operator[SEP]
}
|
public final EObject entryRuleNamedArgument() throws RecognitionException {
EObject current = null;
EObject iv_ruleNamedArgument = null;
try {
// InternalXtext.g:1644:54: (iv_ruleNamedArgument= ruleNamedArgument EOF )
// InternalXtext.g:1645:2: iv_ruleNamedArgument= ruleNamedArgument EOF
{
newCompositeNode(grammarAccess.getNamedArgumentRule());
pushFollow(FollowSets000.FOLLOW_1);
iv_ruleNamedArgument=ruleNamedArgument();
state._fsp--;
current =iv_ruleNamedArgument;
match(input,EOF,FollowSets000.FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} | class class_name[name] begin[{]
method[entryRuleNamedArgument, return_type[type[EObject]], modifier[final public], parameter[]] begin[{]
local_variable[type[EObject], current]
local_variable[type[EObject], iv_ruleNamedArgument]
TryStatement(block=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNamedArgumentRule, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_1, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=iv_ruleNamedArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleNamedArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=iv_ruleNamedArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EOF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=appendSkippedTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.current]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[EObject] identifier[entryRuleNamedArgument] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[EObject] identifier[current] operator[=] Other[null] operator[SEP] identifier[EObject] identifier[iv_ruleNamedArgument] operator[=] Other[null] operator[SEP] Keyword[try] {
{
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getNamedArgumentRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FollowSets000] operator[SEP] identifier[FOLLOW_1] operator[SEP] operator[SEP] identifier[iv_ruleNamedArgument] operator[=] identifier[ruleNamedArgument] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] identifier[current] operator[=] identifier[iv_ruleNamedArgument] operator[SEP] identifier[match] operator[SEP] identifier[input] , identifier[EOF] , identifier[FollowSets000] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[appendSkippedTokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[current] operator[SEP]
}
|
public boolean isExtensionEnabled(String extensionName) {
if (extensionName == null) {
throw new IllegalArgumentException("Parameter extensionName must not be null.");
}
Extension extension = getExtension(extensionName);
if (extension == null) {
return false;
}
return extension.isEnabled();
} | class class_name[name] begin[{]
method[isExtensionEnabled, return_type[type[boolean]], modifier[public], parameter[extensionName]] begin[{]
if[binary_operation[member[.extensionName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter extensionName must 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[}]
local_variable[type[Extension], extension]
if[binary_operation[member[.extension], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[extension.isEnabled, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isExtensionEnabled] operator[SEP] identifier[String] identifier[extensionName] operator[SEP] {
Keyword[if] operator[SEP] identifier[extensionName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Extension] identifier[extension] operator[=] identifier[getExtension] operator[SEP] identifier[extensionName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extension] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[extension] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final KeyPressHandler getNumericAndUpperAsciiKeyPressHandler() { // NOPMD
if (HandlerFactory.numericAndUpperAsciiKeyPressHandler == null) {
synchronized (NumericAndUpperAsciiKeyPressHandler.class) {
if (HandlerFactory.numericAndUpperAsciiKeyPressHandler == null) {
HandlerFactory.numericAndUpperAsciiKeyPressHandler =
new NumericAndUpperAsciiKeyPressHandler();
}
}
}
return HandlerFactory.numericAndUpperAsciiKeyPressHandler;
} | class class_name[name] begin[{]
method[getNumericAndUpperAsciiKeyPressHandler, return_type[type[KeyPressHandler]], modifier[final public static], parameter[]] begin[{]
if[binary_operation[member[HandlerFactory.numericAndUpperAsciiKeyPressHandler], ==, literal[null]]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NumericAndUpperAsciiKeyPressHandler, sub_type=None))] BEGIN[{]
if[binary_operation[member[HandlerFactory.numericAndUpperAsciiKeyPressHandler], ==, literal[null]]] begin[{]
assign[member[HandlerFactory.numericAndUpperAsciiKeyPressHandler], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NumericAndUpperAsciiKeyPressHandler, sub_type=None))]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[HandlerFactory.numericAndUpperAsciiKeyPressHandler]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[KeyPressHandler] identifier[getNumericAndUpperAsciiKeyPressHandler] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[HandlerFactory] operator[SEP] identifier[numericAndUpperAsciiKeyPressHandler] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[NumericAndUpperAsciiKeyPressHandler] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] identifier[HandlerFactory] operator[SEP] identifier[numericAndUpperAsciiKeyPressHandler] operator[==] Other[null] operator[SEP] {
identifier[HandlerFactory] operator[SEP] identifier[numericAndUpperAsciiKeyPressHandler] operator[=] Keyword[new] identifier[NumericAndUpperAsciiKeyPressHandler] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[HandlerFactory] operator[SEP] identifier[numericAndUpperAsciiKeyPressHandler] operator[SEP]
}
|
@BetaApi
public final Operation deleteVpnTunnel(String vpnTunnel) {
DeleteVpnTunnelHttpRequest request =
DeleteVpnTunnelHttpRequest.newBuilder().setVpnTunnel(vpnTunnel).build();
return deleteVpnTunnel(request);
} | class class_name[name] begin[{]
method[deleteVpnTunnel, return_type[type[Operation]], modifier[final public], parameter[vpnTunnel]] begin[{]
local_variable[type[DeleteVpnTunnelHttpRequest], request]
return[call[.deleteVpnTunnel, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[Operation] identifier[deleteVpnTunnel] operator[SEP] identifier[String] identifier[vpnTunnel] operator[SEP] {
identifier[DeleteVpnTunnelHttpRequest] identifier[request] operator[=] identifier[DeleteVpnTunnelHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setVpnTunnel] operator[SEP] identifier[vpnTunnel] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[deleteVpnTunnel] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsPathMappingCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsPathMappingCA> aggsLambda) {
PathMappingCQ cq = new PathMappingCQ();
if (queryLambda != null) {
queryLambda.callback(cq);
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
PathMappingCA ca = new PathMappingCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
} | class class_name[name] begin[{]
method[filter, return_type[void], modifier[public], parameter[name, queryLambda, opLambda, aggsLambda]] begin[{]
local_variable[type[PathMappingCQ], cq]
if[binary_operation[member[.queryLambda], !=, literal[null]]] begin[{]
call[queryLambda.callback, parameter[member[.cq]]]
else begin[{]
None
end[}]
local_variable[type[FilterAggregationBuilder], builder]
if[binary_operation[member[.opLambda], !=, literal[null]]] begin[{]
call[opLambda.callback, parameter[member[.builder]]]
else begin[{]
None
end[}]
if[binary_operation[member[.aggsLambda], !=, literal[null]]] begin[{]
local_variable[type[PathMappingCA], ca]
call[aggsLambda.callback, parameter[member[.ca]]]
call[ca.getAggregationBuilderList, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[filter] operator[SEP] identifier[String] identifier[name] , identifier[EsAbstractConditionQuery] operator[SEP] identifier[OperatorCall] operator[<] identifier[BsPathMappingCQ] operator[>] identifier[queryLambda] , identifier[ConditionOptionCall] operator[<] identifier[FilterAggregationBuilder] operator[>] identifier[opLambda] , identifier[OperatorCall] operator[<] identifier[BsPathMappingCA] operator[>] identifier[aggsLambda] operator[SEP] {
identifier[PathMappingCQ] identifier[cq] operator[=] Keyword[new] identifier[PathMappingCQ] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[queryLambda] operator[!=] Other[null] operator[SEP] {
identifier[queryLambda] operator[SEP] identifier[callback] operator[SEP] identifier[cq] operator[SEP] operator[SEP]
}
identifier[FilterAggregationBuilder] identifier[builder] operator[=] identifier[regFilterA] operator[SEP] identifier[name] , identifier[cq] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[opLambda] operator[!=] Other[null] operator[SEP] {
identifier[opLambda] operator[SEP] identifier[callback] operator[SEP] identifier[builder] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[aggsLambda] operator[!=] Other[null] operator[SEP] {
identifier[PathMappingCA] identifier[ca] operator[=] Keyword[new] identifier[PathMappingCA] operator[SEP] operator[SEP] operator[SEP] identifier[aggsLambda] operator[SEP] identifier[callback] operator[SEP] identifier[ca] operator[SEP] operator[SEP] identifier[ca] operator[SEP] identifier[getAggregationBuilderList] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[builder] operator[::] identifier[subAggregation] operator[SEP] operator[SEP]
}
}
|
@Override
public <E> List<E> getForeignKeysFromJoinTable(String schemaName, String joinTableName, Object rowKey,
String inverseJoinColumnName)
{
List<E> foreignKeys = new ArrayList<E>();
HTableInterface hTable = null;
// Load raw data from Join Table in HBase
try
{
hTable = gethTable(schemaName);
List<HBaseData> results = hbaseReader.LoadData(hTable, joinTableName, rowKey, getFilter(joinTableName));
// assuming rowKey is not null.
if (results != null && !results.isEmpty())
{
HBaseData data = results.get(0);
Map<String, byte[]> hbaseValues = data.getColumns();
Set<String> columnNames = hbaseValues.keySet();
for (String columnName : columnNames)
{
if (columnName.startsWith(inverseJoinColumnName) && data.getColumnFamily().equals(joinTableName))
{
byte[] columnValue = data.getColumnValue(columnName);
// TODO : Because no attribute class is present, so
// cannot be done.
String hbaseColumnValue = Bytes.toString(columnValue);
foreignKeys.add((E) hbaseColumnValue);
}
}
}
}
catch (IOException e)
{
return foreignKeys;
}
finally
{
try
{
if (hTable != null)
{
puthTable(hTable);
}
}
catch (IOException e)
{
// Do nothing.
}
}
return foreignKeys;
} | class class_name[name] begin[{]
method[getForeignKeysFromJoinTable, return_type[type[List]], modifier[public], parameter[schemaName, joinTableName, rowKey, inverseJoinColumnName]] begin[{]
local_variable[type[List], foreignKeys]
local_variable[type[HTableInterface], hTable]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=schemaName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=gethTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=hTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=joinTableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=joinTableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=LoadData, postfix_operators=[], prefix_operators=[], qualifier=hbaseReader, selectors=[], type_arguments=None), name=results)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=HBaseData, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=results, 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=results, selectors=[], type_arguments=None), 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=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), name=data)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HBaseData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getColumns, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), name=hbaseValues)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=hbaseValues, selectors=[], type_arguments=None), name=columnNames)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=inverseJoinColumnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=columnName, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getColumnFamily, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[MethodInvocation(arguments=[MemberReference(member=joinTableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=columnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnValue, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), name=columnValue)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=columnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Bytes, selectors=[], type_arguments=None), name=hbaseColumnValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=hbaseColumnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=foreignKeys, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=columnNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=columnName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]))], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=foreignKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hTable, 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=hTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=puthTable, 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=['IOException']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
return[member[.foreignKeys]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[E] operator[>] identifier[List] operator[<] identifier[E] operator[>] identifier[getForeignKeysFromJoinTable] operator[SEP] identifier[String] identifier[schemaName] , identifier[String] identifier[joinTableName] , identifier[Object] identifier[rowKey] , identifier[String] identifier[inverseJoinColumnName] operator[SEP] {
identifier[List] operator[<] identifier[E] operator[>] identifier[foreignKeys] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[E] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[HTableInterface] identifier[hTable] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[hTable] operator[=] identifier[gethTable] operator[SEP] identifier[schemaName] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[HBaseData] operator[>] identifier[results] operator[=] identifier[hbaseReader] operator[SEP] identifier[LoadData] operator[SEP] identifier[hTable] , identifier[joinTableName] , identifier[rowKey] , identifier[getFilter] operator[SEP] identifier[joinTableName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[results] operator[!=] Other[null] operator[&&] operator[!] identifier[results] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[HBaseData] identifier[data] operator[=] identifier[results] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[hbaseValues] operator[=] identifier[data] operator[SEP] identifier[getColumns] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[columnNames] operator[=] identifier[hbaseValues] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[columnName] operator[:] identifier[columnNames] operator[SEP] {
Keyword[if] operator[SEP] identifier[columnName] operator[SEP] identifier[startsWith] operator[SEP] identifier[inverseJoinColumnName] operator[SEP] operator[&&] identifier[data] operator[SEP] identifier[getColumnFamily] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[joinTableName] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[columnValue] operator[=] identifier[data] operator[SEP] identifier[getColumnValue] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] identifier[String] identifier[hbaseColumnValue] operator[=] identifier[Bytes] operator[SEP] identifier[toString] operator[SEP] identifier[columnValue] operator[SEP] operator[SEP] identifier[foreignKeys] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[E] operator[SEP] identifier[hbaseColumnValue] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[return] identifier[foreignKeys] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[hTable] operator[!=] Other[null] operator[SEP] {
identifier[puthTable] operator[SEP] identifier[hTable] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
}
Keyword[return] identifier[foreignKeys] operator[SEP]
}
|
public static String getCategoryPath(String rootPath, String baseFolder) throws Exception {
String base;
if (rootPath.startsWith(CmsCategoryService.CENTRALIZED_REPOSITORY)) {
base = CmsCategoryService.CENTRALIZED_REPOSITORY;
} else {
base = baseFolder;
if (!base.endsWith("/")) {
base += "/";
}
if (!base.startsWith("/")) {
base = "/" + base;
}
int pos = rootPath.indexOf(base);
if (pos < 0) {
throw new Exception("Invalid category location \"" + rootPath + "\".");
}
base = rootPath.substring(0, pos + base.length());
}
return rootPath.substring(base.length());
} | class class_name[name] begin[{]
method[getCategoryPath, return_type[type[String]], modifier[public static], parameter[rootPath, baseFolder]] begin[{]
local_variable[type[String], base]
if[call[rootPath.startsWith, parameter[member[CmsCategoryService.CENTRALIZED_REPOSITORY]]]] begin[{]
assign[member[.base], member[CmsCategoryService.CENTRALIZED_REPOSITORY]]
else begin[{]
assign[member[.base], member[.baseFolder]]
if[call[base.endsWith, parameter[literal["/"]]]] begin[{]
assign[member[.base], literal["/"]]
else begin[{]
None
end[}]
if[call[base.startsWith, parameter[literal["/"]]]] begin[{]
assign[member[.base], binary_operation[literal["/"], +, member[.base]]]
else begin[{]
None
end[}]
local_variable[type[int], pos]
if[binary_operation[member[.pos], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid category location \""), operandr=MemberReference(member=rootPath, 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=Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.base], call[rootPath.substring, parameter[literal[0], binary_operation[member[.pos], +, call[base.length, parameter[]]]]]]
end[}]
return[call[rootPath.substring, parameter[call[base.length, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getCategoryPath] operator[SEP] identifier[String] identifier[rootPath] , identifier[String] identifier[baseFolder] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[base] operator[SEP] Keyword[if] operator[SEP] identifier[rootPath] operator[SEP] identifier[startsWith] operator[SEP] identifier[CmsCategoryService] operator[SEP] identifier[CENTRALIZED_REPOSITORY] operator[SEP] operator[SEP] {
identifier[base] operator[=] identifier[CmsCategoryService] operator[SEP] identifier[CENTRALIZED_REPOSITORY] operator[SEP]
}
Keyword[else] {
identifier[base] operator[=] identifier[baseFolder] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[base] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[base] operator[+=] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[base] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[base] operator[=] literal[String] operator[+] identifier[base] operator[SEP]
}
Keyword[int] identifier[pos] operator[=] identifier[rootPath] operator[SEP] identifier[indexOf] operator[SEP] identifier[base] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[+] identifier[rootPath] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[base] operator[=] identifier[rootPath] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pos] operator[+] identifier[base] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rootPath] operator[SEP] identifier[substring] operator[SEP] identifier[base] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(BucketInfo bucketInfo, ProtocolMarshaller protocolMarshaller) {
if (bucketInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(bucketInfo.getBuckets(), BUCKETS_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[bucketInfo, protocolMarshaller]] begin[{]
if[binary_operation[member[.bucketInfo], ==, 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=getBuckets, postfix_operators=[], prefix_operators=[], qualifier=bucketInfo, selectors=[], type_arguments=None), MemberReference(member=BUCKETS_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[BucketInfo] identifier[bucketInfo] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[bucketInfo] 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[bucketInfo] operator[SEP] identifier[getBuckets] operator[SEP] operator[SEP] , identifier[BUCKETS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void assertByteEquals(final Path sub, final Path expected, final Path actual) throws IOException {
final int length = 4096;
final byte[] hereBuffer = new byte[length];
final byte[] thereBuffer = new byte[length];
long hereLimit = 0;
long thereLimit = 0;
try(InputStream hereStream = newInputStream(expected); InputStream thereStream = newInputStream(actual)) {
int line = 1;
int ch = 0;
for(long i = 0; i < Files.size(expected); i++) {
if(i >= hereLimit) {
hereLimit += read(hereStream, hereBuffer, hereLimit);
}
if(i >= thereLimit) {
thereLimit += read(thereStream, thereBuffer, thereLimit);
}
final int c = hereBuffer[(int) (i % length)];
assertThat(thereBuffer[(int) (i % length)], asserts(message(sub, i, line, ch), t -> t == c));
if(c == '\n') {
ch = 0;
line++;
} else {
ch++;
}
}
}
} | class class_name[name] begin[{]
method[assertByteEquals, return_type[void], modifier[public static], parameter[sub, expected, actual]] begin[{]
local_variable[type[int], length]
local_variable[type[byte], hereBuffer]
local_variable[type[byte], thereBuffer]
local_variable[type[long], hereLimit]
local_variable[type[long], thereLimit]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=line)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ch)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=hereStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hereBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=thereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=thereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=thereStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thereBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thereLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=hereBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Cast(expression=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), type=BasicType(dimensions=[], name=int)))]), name=c)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=thereBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Cast(expression=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), type=BasicType(dimensions=[], name=int)))]), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=sub, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), LambdaExpression(body=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=asserts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=assertThat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=ch, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=MemberReference(member=line, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=size, postfix_operators=[], prefix_operators=[], qualifier=Files, 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=long)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=hereStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), TryResource(annotations=[], modifiers=set(), name=thereStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[assertByteEquals] operator[SEP] Keyword[final] identifier[Path] identifier[sub] , Keyword[final] identifier[Path] identifier[expected] , Keyword[final] identifier[Path] identifier[actual] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] Keyword[int] identifier[length] operator[=] Other[4096] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[hereBuffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[thereBuffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[long] identifier[hereLimit] operator[=] Other[0] operator[SEP] Keyword[long] identifier[thereLimit] operator[=] Other[0] operator[SEP] Keyword[try] operator[SEP] identifier[InputStream] identifier[hereStream] operator[=] identifier[newInputStream] operator[SEP] identifier[expected] operator[SEP] operator[SEP] identifier[InputStream] identifier[thereStream] operator[=] identifier[newInputStream] operator[SEP] identifier[actual] operator[SEP] operator[SEP] {
Keyword[int] identifier[line] operator[=] Other[1] operator[SEP] Keyword[int] identifier[ch] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[Files] operator[SEP] identifier[size] operator[SEP] identifier[expected] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>=] identifier[hereLimit] operator[SEP] {
identifier[hereLimit] operator[+=] identifier[read] operator[SEP] identifier[hereStream] , identifier[hereBuffer] , identifier[hereLimit] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[>=] identifier[thereLimit] operator[SEP] {
identifier[thereLimit] operator[+=] identifier[read] operator[SEP] identifier[thereStream] , identifier[thereBuffer] , identifier[thereLimit] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[c] operator[=] identifier[hereBuffer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[i] operator[%] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[assertThat] operator[SEP] identifier[thereBuffer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[i] operator[%] identifier[length] operator[SEP] operator[SEP] , identifier[asserts] operator[SEP] identifier[message] operator[SEP] identifier[sub] , identifier[i] , identifier[line] , identifier[ch] operator[SEP] , identifier[t] operator[->] identifier[t] operator[==] identifier[c] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[ch] operator[=] Other[0] operator[SEP] identifier[line] operator[++] operator[SEP]
}
Keyword[else] {
identifier[ch] operator[++] operator[SEP]
}
}
}
}
|
private static PrintStream unbuffered(final PrintStream stream)
{
try
{
return new PrintStream(stream, true, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
return new PrintStream(stream, true);
}
} | class class_name[name] begin[{]
method[unbuffered, return_type[type[PrintStream]], modifier[private static], parameter[stream]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintStream, sub_type=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintStream, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[PrintStream] identifier[unbuffered] operator[SEP] Keyword[final] identifier[PrintStream] identifier[stream] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[PrintStream] operator[SEP] identifier[stream] , literal[boolean] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
Keyword[return] Keyword[new] identifier[PrintStream] operator[SEP] identifier[stream] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public static policypatset[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
policypatset obj = new policypatset();
options option = new options();
option.set_filter(filter);
policypatset[] response = (policypatset[]) obj.getfiltered(service, option);
return response;
} | class class_name[name] begin[{]
method[get_filtered, return_type[type[policypatset]], modifier[public static], parameter[service, filter]] begin[{]
local_variable[type[policypatset], obj]
local_variable[type[options], option]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[policypatset], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[policypatset] operator[SEP] operator[SEP] identifier[get_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[filtervalue] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[policypatset] identifier[obj] operator[=] Keyword[new] identifier[policypatset] operator[SEP] operator[SEP] operator[SEP] identifier[options] identifier[option] operator[=] Keyword[new] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[policypatset] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[policypatset] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[getfiltered] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
private void addIfNotVisited(Object object, Class<?> clazz) {
if (object != null && !visited.containsKey(object)) {
toVisit.add(object);
visited.put(object, clazz);
}
} | class class_name[name] begin[{]
method[addIfNotVisited, return_type[void], modifier[private], parameter[object, clazz]] begin[{]
if[binary_operation[binary_operation[member[.object], !=, literal[null]], &&, call[visited.containsKey, parameter[member[.object]]]]] begin[{]
call[toVisit.add, parameter[member[.object]]]
call[visited.put, parameter[member[.object], member[.clazz]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addIfNotVisited] operator[SEP] identifier[Object] identifier[object] , identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
Keyword[if] operator[SEP] identifier[object] operator[!=] Other[null] operator[&&] operator[!] identifier[visited] operator[SEP] identifier[containsKey] operator[SEP] identifier[object] operator[SEP] operator[SEP] {
identifier[toVisit] operator[SEP] identifier[add] operator[SEP] identifier[object] operator[SEP] operator[SEP] identifier[visited] operator[SEP] identifier[put] operator[SEP] identifier[object] , identifier[clazz] operator[SEP] operator[SEP]
}
}
|
private String getProxyKeyUsages() {
StringBuilder usage = new StringBuilder();
Iterator<String> it = proxyKeyUsageList.iterator();
if (it.hasNext())
usage.append(it.next());
while (it.hasNext()) {
usage.append(", " + it.next());
}
return usage.toString();
} | class class_name[name] begin[{]
method[getProxyKeyUsages, return_type[type[String]], modifier[private], parameter[]] begin[{]
local_variable[type[StringBuilder], usage]
local_variable[type[Iterator], it]
if[call[it.hasNext, parameter[]]] begin[{]
call[usage.append, parameter[call[it.next, parameter[]]]]
else begin[{]
None
end[}]
while[call[it.hasNext, parameter[]]] begin[{]
call[usage.append, parameter[binary_operation[literal[", "], +, call[it.next, parameter[]]]]]
end[}]
return[call[usage.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getProxyKeyUsages] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[usage] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[it] operator[=] identifier[proxyKeyUsageList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[usage] operator[SEP] identifier[append] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[usage] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[usage] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Result decode(BinaryBitmap image,
Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {
try {
return doDecode(image, hints);
} catch (NotFoundException nfe) {
boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
if (tryHarder && image.isRotateSupported()) {
BinaryBitmap rotatedImage = image.rotateCounterClockwise();
Result result = doDecode(rotatedImage, hints);
// Record that we found it rotated 90 degrees CCW / 270 degrees CW
Map<ResultMetadataType,?> metadata = result.getResultMetadata();
int orientation = 270;
if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
// But if we found it reversed in doDecode(), add in that result here:
orientation = (orientation +
(Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360;
}
result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
// Update result points
ResultPoint[] points = result.getResultPoints();
if (points != null) {
int height = rotatedImage.getHeight();
for (int i = 0; i < points.length; i++) {
points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
}
}
return result;
} else {
throw nfe;
}
}
} | class class_name[name] begin[{]
method[decode, return_type[type[Result]], modifier[public], parameter[image, hints]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=image, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doDecode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=hints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=TRY_HARDER, postfix_operators=[], prefix_operators=[], qualifier=DecodeHintType, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=hints, selectors=[], type_arguments=None), operator=&&), name=tryHarder)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tryHarder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isRotateSupported, postfix_operators=[], prefix_operators=[], qualifier=image, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=nfe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=rotateCounterClockwise, postfix_operators=[], prefix_operators=[], qualifier=image, selectors=[], type_arguments=None), name=rotatedImage)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BinaryBitmap, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rotatedImage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doDecode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Result, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResultMetadata, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), name=metadata)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ResultMetadataType, sub_type=None)), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=270), name=orientation)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=metadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=ORIENTATION, postfix_operators=[], prefix_operators=[], qualifier=ResultMetadataType, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=orientation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=orientation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Cast(expression=MethodInvocation(arguments=[MemberReference(member=ORIENTATION, postfix_operators=[], prefix_operators=[], qualifier=ResultMetadataType, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=360), operator=%)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ORIENTATION, postfix_operators=[], prefix_operators=[], qualifier=ResultMetadataType, selectors=[]), MemberReference(member=orientation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putMetadata, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResultPoints, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), name=points)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=ResultPoint, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=points, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=rotatedImage, selectors=[], type_arguments=None), name=height)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=points, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=points, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getY, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=points, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getX, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResultPoint, 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=points, 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)])), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nfe, types=['NotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Result] identifier[decode] operator[SEP] identifier[BinaryBitmap] identifier[image] , identifier[Map] operator[<] identifier[DecodeHintType] , operator[?] operator[>] identifier[hints] operator[SEP] Keyword[throws] identifier[NotFoundException] , identifier[FormatException] {
Keyword[try] {
Keyword[return] identifier[doDecode] operator[SEP] identifier[image] , identifier[hints] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NotFoundException] identifier[nfe] operator[SEP] {
Keyword[boolean] identifier[tryHarder] operator[=] identifier[hints] operator[!=] Other[null] operator[&&] identifier[hints] operator[SEP] identifier[containsKey] operator[SEP] identifier[DecodeHintType] operator[SEP] identifier[TRY_HARDER] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tryHarder] operator[&&] identifier[image] operator[SEP] identifier[isRotateSupported] operator[SEP] operator[SEP] operator[SEP] {
identifier[BinaryBitmap] identifier[rotatedImage] operator[=] identifier[image] operator[SEP] identifier[rotateCounterClockwise] operator[SEP] operator[SEP] operator[SEP] identifier[Result] identifier[result] operator[=] identifier[doDecode] operator[SEP] identifier[rotatedImage] , identifier[hints] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[ResultMetadataType] , operator[?] operator[>] identifier[metadata] operator[=] identifier[result] operator[SEP] identifier[getResultMetadata] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[orientation] operator[=] Other[270] operator[SEP] Keyword[if] operator[SEP] identifier[metadata] operator[!=] Other[null] operator[&&] identifier[metadata] operator[SEP] identifier[containsKey] operator[SEP] identifier[ResultMetadataType] operator[SEP] identifier[ORIENTATION] operator[SEP] operator[SEP] {
identifier[orientation] operator[=] operator[SEP] identifier[orientation] operator[+] operator[SEP] identifier[Integer] operator[SEP] identifier[metadata] operator[SEP] identifier[get] operator[SEP] identifier[ResultMetadataType] operator[SEP] identifier[ORIENTATION] operator[SEP] operator[SEP] operator[%] Other[360] operator[SEP]
}
identifier[result] operator[SEP] identifier[putMetadata] operator[SEP] identifier[ResultMetadataType] operator[SEP] identifier[ORIENTATION] , identifier[orientation] operator[SEP] operator[SEP] identifier[ResultPoint] operator[SEP] operator[SEP] identifier[points] operator[=] identifier[result] operator[SEP] identifier[getResultPoints] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[points] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[height] operator[=] identifier[rotatedImage] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[points] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[points] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[ResultPoint] operator[SEP] identifier[height] operator[-] identifier[points] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[-] Other[1] , identifier[points] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[nfe] operator[SEP]
}
}
}
|
public int update(String sql, Map<String, Object> params) {
return update(sql, null, params);
} | class class_name[name] begin[{]
method[update, return_type[type[int]], modifier[public], parameter[sql, params]] begin[{]
return[call[.update, parameter[member[.sql], literal[null], member[.params]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[update] operator[SEP] identifier[String] identifier[sql] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] operator[SEP] {
Keyword[return] identifier[update] operator[SEP] identifier[sql] , Other[null] , identifier[params] operator[SEP] operator[SEP]
}
|
public static String getSafeFilename(String filename)
{
String result = filename;
if (result != null)
{
result = result.replaceAll("[^a-zA-Z0-9]+", "-").replaceAll("^-+", "");
}
return result;
} | class class_name[name] begin[{]
method[getSafeFilename, return_type[type[String]], modifier[public static], parameter[filename]] begin[{]
local_variable[type[String], result]
if[binary_operation[member[.result], !=, literal[null]]] begin[{]
assign[member[.result], call[result.replaceAll, parameter[literal["[^a-zA-Z0-9]+"], literal["-"]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getSafeFilename] operator[SEP] identifier[String] identifier[filename] operator[SEP] {
identifier[String] identifier[result] operator[=] identifier[filename] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public String toHashedBase64String(byte[] bytes) throws NoSuchAlgorithmException {
byte[] hashedBytes = toHashedBytes(bytes);
return Base64Codec.encode(hashedBytes);
//return StringUtil.getAsciiString(toHashedBase64Bytes(bytes));
} | class class_name[name] begin[{]
method[toHashedBase64String, return_type[type[String]], modifier[public], parameter[bytes]] begin[{]
local_variable[type[byte], hashedBytes]
return[call[Base64Codec.encode, parameter[member[.hashedBytes]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[toHashedBase64String] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[hashedBytes] operator[=] identifier[toHashedBytes] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] Keyword[return] identifier[Base64Codec] operator[SEP] identifier[encode] operator[SEP] identifier[hashedBytes] operator[SEP] operator[SEP]
}
|
public synchronized Object get(String name, Scriptable start) {
if (isEmpty(name)) {
if (indexedProps.containsKey(name)) {
return indexedProps.get(name);
} else {
return NOT_FOUND;
}
} else {
synchronized (context) {
int scope = context.getAttributesScope(name);
if (scope != -1) {
Object value = context.getAttribute(name, scope);
if(value.getClass().getPackage().getName().startsWith(RHINO_JS_PACKAGE_NAME)){
return value;
}else{
return Context.javaToJS(value, this);
}
} else {
return NOT_FOUND;
}
}
}
} | class class_name[name] begin[{]
method[get, return_type[type[Object]], modifier[synchronized public], parameter[name, start]] begin[{]
if[call[.isEmpty, parameter[member[.name]]]] begin[{]
if[call[indexedProps.containsKey, parameter[member[.name]]]] begin[{]
return[call[indexedProps.get, parameter[member[.name]]]]
else begin[{]
return[member[.NOT_FOUND]]
end[}]
else begin[{]
SYNCHRONIZED[member[.context]] BEGIN[{]
local_variable[type[int], scope]
if[binary_operation[member[.scope], !=, literal[1]]] begin[{]
local_variable[type[Object], value]
if[call[value.getClass, parameter[]]] begin[{]
return[member[.value]]
else begin[{]
return[call[Context.javaToJS, parameter[member[.value], THIS[]]]]
end[}]
else begin[{]
return[member[.NOT_FOUND]]
end[}]
END[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[Object] identifier[get] operator[SEP] identifier[String] identifier[name] , identifier[Scriptable] identifier[start] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[indexedProps] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[indexedProps] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[NOT_FOUND] operator[SEP]
}
}
Keyword[else] {
Keyword[synchronized] operator[SEP] identifier[context] operator[SEP] {
Keyword[int] identifier[scope] operator[=] identifier[context] operator[SEP] identifier[getAttributesScope] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scope] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[context] operator[SEP] identifier[getAttribute] operator[SEP] identifier[name] , identifier[scope] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[RHINO_JS_PACKAGE_NAME] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Context] operator[SEP] identifier[javaToJS] operator[SEP] identifier[value] , Keyword[this] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[NOT_FOUND] operator[SEP]
}
}
}
}
|
@Override
public CommerceAvailabilityEstimate findByPrimaryKey(
Serializable primaryKey) throws NoSuchAvailabilityEstimateException {
CommerceAvailabilityEstimate commerceAvailabilityEstimate = fetchByPrimaryKey(primaryKey);
if (commerceAvailabilityEstimate == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchAvailabilityEstimateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return commerceAvailabilityEstimate;
} | class class_name[name] begin[{]
method[findByPrimaryKey, return_type[type[CommerceAvailabilityEstimate]], modifier[public], parameter[primaryKey]] begin[{]
local_variable[type[CommerceAvailabilityEstimate], commerceAvailabilityEstimate]
if[binary_operation[member[.commerceAvailabilityEstimate], ==, literal[null]]] begin[{]
if[call[_log.isDebugEnabled, parameter[]]] begin[{]
call[_log.debug, parameter[binary_operation[member[._NO_SUCH_ENTITY_WITH_PRIMARY_KEY], +, member[.primaryKey]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=_NO_SUCH_ENTITY_WITH_PRIMARY_KEY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=primaryKey, 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=NoSuchAvailabilityEstimateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.commerceAvailabilityEstimate]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CommerceAvailabilityEstimate] identifier[findByPrimaryKey] operator[SEP] identifier[Serializable] identifier[primaryKey] operator[SEP] Keyword[throws] identifier[NoSuchAvailabilityEstimateException] {
identifier[CommerceAvailabilityEstimate] identifier[commerceAvailabilityEstimate] operator[=] identifier[fetchByPrimaryKey] operator[SEP] identifier[primaryKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commerceAvailabilityEstimate] operator[==] Other[null] 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] identifier[_NO_SUCH_ENTITY_WITH_PRIMARY_KEY] operator[+] identifier[primaryKey] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[NoSuchAvailabilityEstimateException] operator[SEP] identifier[_NO_SUCH_ENTITY_WITH_PRIMARY_KEY] operator[+] identifier[primaryKey] operator[SEP] operator[SEP]
}
Keyword[return] identifier[commerceAvailabilityEstimate] operator[SEP]
}
|
public static CloudStorageOption.OpenCopy withUserMetadata(String key, String value) {
return OptionUserMetadata.create(key, value);
} | class class_name[name] begin[{]
method[withUserMetadata, return_type[type[CloudStorageOption]], modifier[public static], parameter[key, value]] begin[{]
return[call[OptionUserMetadata.create, parameter[member[.key], member[.value]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CloudStorageOption] operator[SEP] identifier[OpenCopy] identifier[withUserMetadata] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[return] identifier[OptionUserMetadata] operator[SEP] identifier[create] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
private void obtainDialogHeaderIconTintList(@NonNull final TypedArray typedArray) {
setDialogHeaderIconTintList(
typedArray.getColorStateList(R.styleable.DialogPreference_dialogHeaderIconTint));
} | class class_name[name] begin[{]
method[obtainDialogHeaderIconTintList, return_type[void], modifier[private], parameter[typedArray]] begin[{]
call[.setDialogHeaderIconTintList, parameter[call[typedArray.getColorStateList, parameter[member[R.styleable.DialogPreference_dialogHeaderIconTint]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[obtainDialogHeaderIconTintList] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[TypedArray] identifier[typedArray] operator[SEP] {
identifier[setDialogHeaderIconTintList] operator[SEP] identifier[typedArray] operator[SEP] identifier[getColorStateList] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_dialogHeaderIconTint] operator[SEP] operator[SEP] operator[SEP]
}
|
public static long safeSubtract(long a, long b)
{
long diff = a - b;
if (a < 0L != diff < 0L && a < 0L != b < 0L) {
throw new ArithmeticException(
"Long overflow: " + a + " - " + b);
}
return diff;
} | class class_name[name] begin[{]
method[safeSubtract, return_type[type[long]], modifier[public static], parameter[a, b]] begin[{]
local_variable[type[long], diff]
if[binary_operation[binary_operation[binary_operation[member[.a], <, literal[0L]], !=, binary_operation[member[.diff], <, literal[0L]]], &&, binary_operation[binary_operation[member[.a], <, literal[0L]], !=, binary_operation[member[.b], <, literal[0L]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Long overflow: "), operandr=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" - "), operator=+), operandr=MemberReference(member=b, 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=ArithmeticException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.diff]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[safeSubtract] operator[SEP] Keyword[long] identifier[a] , Keyword[long] identifier[b] operator[SEP] {
Keyword[long] identifier[diff] operator[=] identifier[a] operator[-] identifier[b] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[<] Other[0L] operator[!=] identifier[diff] operator[<] Other[0L] operator[&&] identifier[a] operator[<] Other[0L] operator[!=] identifier[b] operator[<] Other[0L] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArithmeticException] operator[SEP] literal[String] operator[+] identifier[a] operator[+] literal[String] operator[+] identifier[b] operator[SEP] operator[SEP]
}
Keyword[return] identifier[diff] operator[SEP]
}
|
public void sort() {
if (initial)
Arrays.sort(data, 0, size, comparator);
else if (size > limit)
sortTail();
} | class class_name[name] begin[{]
method[sort, return_type[void], modifier[public], parameter[]] begin[{]
if[member[.initial]] begin[{]
call[Arrays.sort, parameter[member[.data], literal[0], member[.size], member[.comparator]]]
else begin[{]
if[binary_operation[member[.size], >, member[.limit]]] begin[{]
call[.sortTail, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sort] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[initial] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[data] , Other[0] , identifier[size] , identifier[comparator] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[>] identifier[limit] operator[SEP] identifier[sortTail] operator[SEP] operator[SEP] operator[SEP]
}
|
void isLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasIsLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!isLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, IS_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!isLockable(lks, txNum))
throw new LockAbortException();
lks.isLockers.add(txNum);
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException();
}
}
txWaitMap.remove(txNum);
} | class class_name[name] begin[{]
method[isLock, return_type[void], modifier[default], parameter[obj, txNum]] begin[{]
local_variable[type[Object], anchor]
call[txWaitMap.put, parameter[member[.txNum], member[.anchor]]]
SYNCHRONIZED[member[.anchor]] BEGIN[{]
local_variable[type[Lockers], lks]
if[call[.hasIsLock, parameter[member[.lks], member[.txNum]]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=timestamp)], modifiers=set(), type=BasicType(dimensions=[], name=long)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=IS_LOCK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=avoidDeadlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=lks.requestSet, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MAX_TIME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wait, postfix_operators=[], prefix_operators=[], qualifier=anchor, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=lks.requestSet, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=lks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLockable, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=timestamp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=waitingTooLong, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=lks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLockable, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LockAbortException, sub_type=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=lks.isLockers, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=txNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjectSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, 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=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LockAbortException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
END[}]
call[txWaitMap.remove, parameter[member[.txNum]]]
end[}]
END[}] | Keyword[void] identifier[isLock] operator[SEP] identifier[Object] identifier[obj] , Keyword[long] identifier[txNum] operator[SEP] {
identifier[Object] identifier[anchor] operator[=] identifier[getAnchor] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[txWaitMap] operator[SEP] identifier[put] operator[SEP] identifier[txNum] , identifier[anchor] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[anchor] operator[SEP] {
identifier[Lockers] identifier[lks] operator[=] identifier[prepareLockers] operator[SEP] identifier[obj] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasIsLock] operator[SEP] identifier[lks] , identifier[txNum] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[try] {
Keyword[long] identifier[timestamp] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[isLockable] operator[SEP] identifier[lks] , identifier[txNum] operator[SEP] operator[&&] operator[!] identifier[waitingTooLong] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP] {
identifier[avoidDeadlock] operator[SEP] identifier[lks] , identifier[txNum] , identifier[IS_LOCK] operator[SEP] operator[SEP] identifier[lks] operator[SEP] identifier[requestSet] operator[SEP] identifier[add] operator[SEP] identifier[txNum] operator[SEP] operator[SEP] identifier[anchor] operator[SEP] identifier[wait] operator[SEP] identifier[MAX_TIME] operator[SEP] operator[SEP] identifier[lks] operator[SEP] identifier[requestSet] operator[SEP] identifier[remove] operator[SEP] identifier[txNum] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isLockable] operator[SEP] identifier[lks] , identifier[txNum] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[LockAbortException] operator[SEP] operator[SEP] operator[SEP] identifier[lks] operator[SEP] identifier[isLockers] operator[SEP] identifier[add] operator[SEP] identifier[txNum] operator[SEP] operator[SEP] identifier[getObjectSet] operator[SEP] identifier[txNum] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[LockAbortException] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[txWaitMap] operator[SEP] identifier[remove] operator[SEP] identifier[txNum] operator[SEP] operator[SEP]
}
|
protected void startPurge() {
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
if (bTrace && tc.isEventEnabled()) {
Tr.event(tc, "Running purge of expired sessions");
}
try {
List<SessionImpl> toPurge = new ArrayList<SessionImpl>();
for (Map<String, SessionImpl> sessions : this.groupings.values()) {
synchronized (sessions) {
// scan for all expired sessions
for (SessionImpl session : sessions.values()) {
if (session.checkExpiration(false)) {
toPurge.add(session);
}
}
// now remove those sessions from the map (outside the
// iteration loop)
for (SessionImpl session : toPurge) {
sessions.remove(session.getId());
}
} // end-sync
// now iterate that list outside the lock (involves calling
// session listeners)
for (SessionImpl session : toPurge) {
// if the session is still "valid" then we need to call
// invalidate now
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Purging session; " + session);
}
if (!session.isInvalid()) {
session.invalidate();
}
}
toPurge.clear();
} // end-grouping-loop
} catch (Throwable t) {
FFDCFilter.processException(t, getClass().getName(), "purge");
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Error while running purge scan; " + t);
}
}
} | class class_name[name] begin[{]
method[startPurge, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[boolean], bTrace]
if[binary_operation[member[.bTrace], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], literal["Running purge of expired sessions"]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=toPurge)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[SynchronizedStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=checkExpiration, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=toPurge, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=sessions, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=session)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=sessions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=toPurge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=session)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))), label=None)], label=None, lock=MemberReference(member=sessions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bTrace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Purging session; "), operandr=MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isInvalid, postfix_operators=[], prefix_operators=['!'], qualifier=session, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=invalidate, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=toPurge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=session)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=toPurge, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=groupings, 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=sessions)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SessionImpl, sub_type=None))], dimensions=[], name=Map, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="purge")], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bTrace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while running purge scan; "), operandr=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[startPurge] operator[SEP] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[bTrace] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bTrace] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[List] operator[<] identifier[SessionImpl] operator[>] identifier[toPurge] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SessionImpl] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[SessionImpl] operator[>] identifier[sessions] operator[:] Keyword[this] operator[SEP] identifier[groupings] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[sessions] operator[SEP] {
Keyword[for] operator[SEP] identifier[SessionImpl] identifier[session] operator[:] identifier[sessions] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[session] operator[SEP] identifier[checkExpiration] operator[SEP] literal[boolean] operator[SEP] operator[SEP] {
identifier[toPurge] operator[SEP] identifier[add] operator[SEP] identifier[session] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[SessionImpl] identifier[session] operator[:] identifier[toPurge] operator[SEP] {
identifier[sessions] operator[SEP] identifier[remove] operator[SEP] identifier[session] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[SessionImpl] identifier[session] operator[:] identifier[toPurge] operator[SEP] {
Keyword[if] operator[SEP] identifier[bTrace] 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[session] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[session] operator[SEP] identifier[isInvalid] operator[SEP] operator[SEP] operator[SEP] {
identifier[session] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[toPurge] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[t] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bTrace] 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[t] operator[SEP] operator[SEP]
}
}
}
|
@Override
public boolean await(long timeout, TimeUnit unit) {
try {
get(timeout, unit);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RedisCommandInterruptedException(e);
} catch (ExecutionException e) {
return true;
} catch (TimeoutException e) {
return false;
}
} | class class_name[name] begin[{]
method[await, return_type[type[boolean]], modifier[public], parameter[timeout, unit]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), 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=RedisCommandInterruptedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException'])), CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ExecutionException'])), CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TimeoutException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[await] operator[SEP] Keyword[long] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] {
Keyword[try] {
identifier[get] operator[SEP] identifier[timeout] , identifier[unit] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RedisCommandInterruptedException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ExecutionException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TimeoutException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public static void assertProcessEndedAndInEndEvents(final String processInstanceId, final String... endEventIds) {
Validate.notNull(processInstanceId);
Validate.notNull(endEventIds);
apiCallback.debug(LogMessage.PROCESS_11, processInstanceId, AssertUtils.arrayToString(endEventIds));
try {
getEndEventAssertable().processEndedAndInEndEvents(processInstanceId, endEventIds);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_4, processInstanceId, AssertUtils.arrayToString(endEventIds));
}
} | class class_name[name] begin[{]
method[assertProcessEndedAndInEndEvents, return_type[void], modifier[public static], parameter[processInstanceId, endEventIds]] begin[{]
call[Validate.notNull, parameter[member[.processInstanceId]]]
call[Validate.notNull, parameter[member[.endEventIds]]]
call[apiCallback.debug, parameter[member[LogMessage.PROCESS_11], member[.processInstanceId], call[AssertUtils.arrayToString, parameter[member[.endEventIds]]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getEndEventAssertable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=processInstanceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endEventIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processEndedAndInEndEvents, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ERROR_PROCESS_4, postfix_operators=[], prefix_operators=[], qualifier=LogMessage, selectors=[]), MemberReference(member=processInstanceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=endEventIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arrayToString, postfix_operators=[], prefix_operators=[], qualifier=AssertUtils, selectors=[], type_arguments=None)], member=fail, postfix_operators=[], prefix_operators=[], qualifier=apiCallback, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ae, types=['AssertionError']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[assertProcessEndedAndInEndEvents] operator[SEP] Keyword[final] identifier[String] identifier[processInstanceId] , Keyword[final] identifier[String] operator[...] identifier[endEventIds] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[processInstanceId] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[endEventIds] operator[SEP] operator[SEP] identifier[apiCallback] operator[SEP] identifier[debug] operator[SEP] identifier[LogMessage] operator[SEP] identifier[PROCESS_11] , identifier[processInstanceId] , identifier[AssertUtils] operator[SEP] identifier[arrayToString] operator[SEP] identifier[endEventIds] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[getEndEventAssertable] operator[SEP] operator[SEP] operator[SEP] identifier[processEndedAndInEndEvents] operator[SEP] identifier[processInstanceId] , identifier[endEventIds] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[AssertionError] identifier[ae] operator[SEP] {
identifier[apiCallback] operator[SEP] identifier[fail] operator[SEP] identifier[ae] , identifier[LogMessage] operator[SEP] identifier[ERROR_PROCESS_4] , identifier[processInstanceId] , identifier[AssertUtils] operator[SEP] identifier[arrayToString] operator[SEP] identifier[endEventIds] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Map<String, Object> getSiteProperties()
{
Map<String, Object> properties = super.getSiteProperties();
String strDomain = this.getProperty(DBParams.DOMAIN);
if ((strDomain == null) || (strDomain.length() == 0))
strDomain = DEFAULT_DOMAIN;
if (strDomain.indexOf('.') != strDomain.lastIndexOf('.'))
strDomain = strDomain.substring(strDomain.indexOf('.') + 1);
strDomain = "demo." + strDomain; // Demo sub-domain
properties.put(DBParams.DOMAIN, strDomain);
return properties;
} | class class_name[name] begin[{]
method[getSiteProperties, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], properties]
local_variable[type[String], strDomain]
if[binary_operation[binary_operation[member[.strDomain], ==, literal[null]], ||, binary_operation[call[strDomain.length, parameter[]], ==, literal[0]]]] begin[{]
assign[member[.strDomain], member[.DEFAULT_DOMAIN]]
else begin[{]
None
end[}]
if[binary_operation[call[strDomain.indexOf, parameter[literal['.']]], !=, call[strDomain.lastIndexOf, parameter[literal['.']]]]] begin[{]
assign[member[.strDomain], call[strDomain.substring, parameter[binary_operation[call[strDomain.indexOf, parameter[literal['.']]], +, literal[1]]]]]
else begin[{]
None
end[}]
assign[member[.strDomain], binary_operation[literal["demo."], +, member[.strDomain]]]
call[properties.put, parameter[member[DBParams.DOMAIN], member[.strDomain]]]
return[member[.properties]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getSiteProperties] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[=] Keyword[super] operator[SEP] identifier[getSiteProperties] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strDomain] operator[=] Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[DOMAIN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[strDomain] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[strDomain] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] identifier[strDomain] operator[=] identifier[DEFAULT_DOMAIN] operator[SEP] Keyword[if] operator[SEP] identifier[strDomain] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[!=] identifier[strDomain] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[strDomain] operator[=] identifier[strDomain] operator[SEP] identifier[substring] operator[SEP] identifier[strDomain] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[strDomain] operator[=] literal[String] operator[+] identifier[strDomain] operator[SEP] identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[DBParams] operator[SEP] identifier[DOMAIN] , identifier[strDomain] operator[SEP] operator[SEP] Keyword[return] identifier[properties] operator[SEP]
}
|
private DataSet<Edge<K, EV>> getPairwiseEdgeIntersection(DataSet<Edge<K, EV>> edges) {
return this.getEdges()
.coGroup(edges)
.where(0, 1, 2)
.equalTo(0, 1, 2)
.with(new MatchingEdgeReducer<>())
.name("Intersect edges");
} | class class_name[name] begin[{]
method[getPairwiseEdgeIntersection, return_type[type[DataSet]], modifier[private], parameter[edges]] begin[{]
return[THIS[call[None.getEdges, parameter[]]call[None.coGroup, parameter[member[.edges]]]call[None.where, parameter[literal[0], literal[1], literal[2]]]call[None.equalTo, parameter[literal[0], literal[1], literal[2]]]call[None.with, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=MatchingEdgeReducer, sub_type=None))]]call[None.name, parameter[literal["Intersect edges"]]]]]
end[}]
END[}] | Keyword[private] identifier[DataSet] operator[<] identifier[Edge] operator[<] identifier[K] , identifier[EV] operator[>] operator[>] identifier[getPairwiseEdgeIntersection] operator[SEP] identifier[DataSet] operator[<] identifier[Edge] operator[<] identifier[K] , identifier[EV] operator[>] operator[>] identifier[edges] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[getEdges] operator[SEP] operator[SEP] operator[SEP] identifier[coGroup] operator[SEP] identifier[edges] operator[SEP] operator[SEP] identifier[where] operator[SEP] Other[0] , Other[1] , Other[2] operator[SEP] operator[SEP] identifier[equalTo] operator[SEP] Other[0] , Other[1] , Other[2] operator[SEP] operator[SEP] identifier[with] operator[SEP] Keyword[new] identifier[MatchingEdgeReducer] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public BasicDBObjectBuilder append(final String key, final Object val) {
_cur().put(key, val);
return this;
} | class class_name[name] begin[{]
method[append, return_type[type[BasicDBObjectBuilder]], modifier[public], parameter[key, val]] begin[{]
call[._cur, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[BasicDBObjectBuilder] identifier[append] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] identifier[Object] identifier[val] operator[SEP] {
identifier[_cur] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[val] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void setPremiumRateValues(com.google.api.ads.admanager.axis.v201811.PremiumRateValue[] premiumRateValues) {
this.premiumRateValues = premiumRateValues;
} | class class_name[name] begin[{]
method[setPremiumRateValues, return_type[void], modifier[public], parameter[premiumRateValues]] begin[{]
assign[THIS[member[None.premiumRateValues]], member[.premiumRateValues]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPremiumRateValues] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201811] operator[SEP] identifier[PremiumRateValue] operator[SEP] operator[SEP] identifier[premiumRateValues] operator[SEP] {
Keyword[this] operator[SEP] identifier[premiumRateValues] operator[=] identifier[premiumRateValues] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.