code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static void post(final Event event) {
if (!isEnable()) {
return;
}
CopyOnWriteArraySet<Subscriber> subscribers = SUBSCRIBER_MAP.get(event.getClass());
if (CommonUtils.isNotEmpty(subscribers)) {
for (final Subscriber subscriber : subscribers) {
if (subscriber.isSync()) {
handleEvent(subscriber, event);
} else { // 异步
final RpcInternalContext context = RpcInternalContext.peekContext();
final ThreadPoolExecutor asyncThreadPool = AsyncRuntime.getAsyncThreadPool();
try {
asyncThreadPool.execute(
new Runnable() {
@Override
public void run() {
try {
RpcInternalContext.setContext(context);
handleEvent(subscriber, event);
} catch (Exception e) {
RpcInternalContext.removeContext();
}
}
});
} catch (RejectedExecutionException e) {
LOGGER
.warn("This queue is full when post event to async execute, queue size is " +
asyncThreadPool.getQueue().size() +
", please optimize this async thread pool of eventbus.");
}
}
}
}
}
|
class class_name[name] begin[{]
method[post, return_type[void], modifier[public static], parameter[event]] begin[{]
if[call[.isEnable, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[CopyOnWriteArraySet], subscribers]
if[call[CommonUtils.isNotEmpty, parameter[member[.subscribers]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isSync, postfix_operators=[], prefix_operators=[], qualifier=subscriber, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=peekContext, postfix_operators=[], prefix_operators=[], qualifier=RpcInternalContext, selectors=[], type_arguments=None), name=context)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=RpcInternalContext, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAsyncThreadPool, postfix_operators=[], prefix_operators=[], qualifier=AsyncRuntime, selectors=[], type_arguments=None), name=asyncThreadPool)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ThreadPoolExecutor, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContext, postfix_operators=[], prefix_operators=[], qualifier=RpcInternalContext, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=subscriber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=removeContext, postfix_operators=[], prefix_operators=[], qualifier=RpcInternalContext, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Runnable, sub_type=None))], member=execute, postfix_operators=[], prefix_operators=[], qualifier=asyncThreadPool, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This queue is full when post event to async execute, queue size is "), operandr=MethodInvocation(arguments=[], member=getQueue, postfix_operators=[], prefix_operators=[], qualifier=asyncThreadPool, selectors=[MethodInvocation(arguments=[], member=size, 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=", please optimize this async thread pool of eventbus."), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RejectedExecutionException']))], finally_block=None, label=None, resources=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=subscriber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=subscribers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=subscriber)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Subscriber, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[post] operator[SEP] Keyword[final] identifier[Event] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isEnable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[CopyOnWriteArraySet] operator[<] identifier[Subscriber] operator[>] identifier[subscribers] operator[=] identifier[SUBSCRIBER_MAP] operator[SEP] identifier[get] operator[SEP] identifier[event] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CommonUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[subscribers] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Subscriber] identifier[subscriber] operator[:] identifier[subscribers] operator[SEP] {
Keyword[if] operator[SEP] identifier[subscriber] operator[SEP] identifier[isSync] operator[SEP] operator[SEP] operator[SEP] {
identifier[handleEvent] operator[SEP] identifier[subscriber] , identifier[event] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[RpcInternalContext] identifier[context] operator[=] identifier[RpcInternalContext] operator[SEP] identifier[peekContext] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ThreadPoolExecutor] identifier[asyncThreadPool] operator[=] identifier[AsyncRuntime] operator[SEP] identifier[getAsyncThreadPool] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[asyncThreadPool] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[RpcInternalContext] operator[SEP] identifier[setContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[handleEvent] operator[SEP] identifier[subscriber] , identifier[event] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[RpcInternalContext] operator[SEP] identifier[removeContext] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RejectedExecutionException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[asyncThreadPool] operator[SEP] identifier[getQueue] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
}
}
|
public static br_device_profile delete(nitro_service client, br_device_profile resource) throws Exception
{
resource.validate("delete");
return ((br_device_profile[]) resource.delete_resource(client))[0];
}
|
class class_name[name] begin[{]
method[delete, return_type[type[br_device_profile]], modifier[public static], parameter[client, resource]] begin[{]
call[resource.validate, parameter[literal["delete"]]]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=delete_resource, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=br_device_profile, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[br_device_profile] identifier[delete] operator[SEP] identifier[nitro_service] identifier[client] , identifier[br_device_profile] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[resource] operator[SEP] identifier[validate] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[br_device_profile] operator[SEP] operator[SEP] operator[SEP] identifier[resource] operator[SEP] identifier[delete_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
@Override
public HttpAction getNextMessage() {
if (tokenAction.hasMoreActions()) {
setHasMoreMessages(true);
return tokenAction.popAction();
}
return getSecondRequest();
}
|
class class_name[name] begin[{]
method[getNextMessage, return_type[type[HttpAction]], modifier[public], parameter[]] begin[{]
if[call[tokenAction.hasMoreActions, parameter[]]] begin[{]
call[.setHasMoreMessages, parameter[literal[true]]]
return[call[tokenAction.popAction, parameter[]]]
else begin[{]
None
end[}]
return[call[.getSecondRequest, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[HttpAction] identifier[getNextMessage] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tokenAction] operator[SEP] identifier[hasMoreActions] operator[SEP] operator[SEP] operator[SEP] {
identifier[setHasMoreMessages] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[tokenAction] operator[SEP] identifier[popAction] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getSecondRequest] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Long parseLong(final String str) {
if (null != str) {
try {
return new Long(Long.parseLong(str.trim()));
} catch (final Exception e) {
// :IGNORE:
}
}
return null;
}
|
class class_name[name] begin[{]
method[parseLong, return_type[type[Long]], modifier[public static], parameter[str]] begin[{]
if[binary_operation[literal[null], !=, member[.str]]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], member=parseLong, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=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[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Long] identifier[parseLong] operator[SEP] Keyword[final] identifier[String] identifier[str] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[str] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[Long] operator[SEP] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[str] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void setCategories(FSArray v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null)
jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.ll_cas.ll_setRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories, jcasType.ll_cas.ll_getFSRef(v));}
|
class class_name[name] begin[{]
method[setCategories, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[Descriptor_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Descriptor_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["categories"], literal["de.julielab.jules.types.wikipedia.Descriptor"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setRefValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Descriptor_Type, sub_type=None)), call[jcasType.ll_cas.ll_getFSRef, parameter[member[.v]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setCategories] operator[SEP] identifier[FSArray] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_categories] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setRefValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_categories] , identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getFSRef] operator[SEP] identifier[v] operator[SEP] operator[SEP] operator[SEP]
}
|
@GuardedBy("lock")
protected boolean _contiguousSpaceAvailable(int space_needed) {
int num_slots_scanned=0;
int size_of_contiguous_area=0;
if(high-low-1 < space_needed)
return false;
for(long i=low+1; i < high; i++) {
num_slots_scanned++;
int index=index(i);
if(this.buffer[index] == null) {
if(++size_of_contiguous_area >= space_needed)
return true;
}
else {
size_of_contiguous_area=0;
// we scanned more than half of the current array and found an occupied slot, so there is no chance of
// finding space_needed contiguous free slots as we have less than half of the current array to scan
if(num_slots_scanned > space_needed || high-i-1 < space_needed)
return false;
}
}
return false;
}
|
class class_name[name] begin[{]
method[_contiguousSpaceAvailable, return_type[type[boolean]], modifier[protected], parameter[space_needed]] begin[{]
local_variable[type[int], num_slots_scanned]
local_variable[type[int], size_of_contiguous_area]
if[binary_operation[binary_operation[binary_operation[member[.high], -, member[.low]], -, literal[1]], <, member[.space_needed]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=num_slots_scanned, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=buffer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=size_of_contiguous_area, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=num_slots_scanned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=space_needed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=high, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operandr=MemberReference(member=space_needed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=||), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=size_of_contiguous_area, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), operandr=MemberReference(member=space_needed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=high, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=low, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=long)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[false]]
end[}]
END[}]
|
annotation[@] identifier[GuardedBy] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[boolean] identifier[_contiguousSpaceAvailable] operator[SEP] Keyword[int] identifier[space_needed] operator[SEP] {
Keyword[int] identifier[num_slots_scanned] operator[=] Other[0] operator[SEP] Keyword[int] identifier[size_of_contiguous_area] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[high] operator[-] identifier[low] operator[-] Other[1] operator[<] identifier[space_needed] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[i] operator[=] identifier[low] operator[+] Other[1] operator[SEP] identifier[i] operator[<] identifier[high] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[num_slots_scanned] operator[++] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[index] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[buffer] operator[SEP] identifier[index] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[++] identifier[size_of_contiguous_area] operator[>=] identifier[space_needed] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[size_of_contiguous_area] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[num_slots_scanned] operator[>] identifier[space_needed] operator[||] identifier[high] operator[-] identifier[i] operator[-] Other[1] operator[<] identifier[space_needed] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public T pop() throws EmptyStackException {
int i;
if ((i = --size) >= 0) {
T element = (T) elements[i];
elements[i] = null;
return element;
} else {
size = 0;
throw new EmptyStackException();
}
}
|
class class_name[name] begin[{]
method[pop, return_type[type[T]], modifier[public], parameter[]] begin[{]
local_variable[type[int], i]
if[binary_operation[assign[member[.i], member[.size]], >=, literal[0]]] begin[{]
local_variable[type[T], element]
assign[member[.elements], literal[null]]
return[member[.element]]
else begin[{]
assign[member[.size], literal[0]]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EmptyStackException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[T] identifier[pop] operator[SEP] operator[SEP] Keyword[throws] identifier[EmptyStackException] {
Keyword[int] identifier[i] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[i] operator[=] operator[--] identifier[size] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[T] identifier[element] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[elements] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[elements] operator[SEP] identifier[i] operator[SEP] operator[=] Other[null] operator[SEP] Keyword[return] identifier[element] operator[SEP]
}
Keyword[else] {
identifier[size] operator[=] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[EmptyStackException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <S> Feature<S, Boolean> is(Feature<? super S, Boolean> feature) {
return FeatureExpressions.is(feature);
}
|
class class_name[name] begin[{]
method[is, return_type[type[Feature]], modifier[public static], parameter[feature]] begin[{]
return[call[FeatureExpressions.is, parameter[member[.feature]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[S] operator[>] identifier[Feature] operator[<] identifier[S] , identifier[Boolean] operator[>] identifier[is] operator[SEP] identifier[Feature] operator[<] operator[?] Keyword[super] identifier[S] , identifier[Boolean] operator[>] identifier[feature] operator[SEP] {
Keyword[return] identifier[FeatureExpressions] operator[SEP] identifier[is] operator[SEP] identifier[feature] operator[SEP] operator[SEP]
}
|
public static long generate(long crc, long value)
{
crc = next(crc, (byte) (value >> 56));
crc = next(crc, (byte) (value >> 48));
crc = next(crc, (byte) (value >> 40));
crc = next(crc, (byte) (value >> 32));
crc = next(crc, (byte) (value >> 24));
crc = next(crc, (byte) (value >> 16));
crc = next(crc, (byte) (value >> 8));
crc = next(crc, (byte) (value >> 0));
return crc;
}
|
class class_name[name] begin[{]
method[generate, return_type[type[long]], modifier[public static], parameter[crc, value]] begin[{]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=56), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=48), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=40), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
assign[member[.crc], call[.next, parameter[member[.crc], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>>), type=BasicType(dimensions=[], name=byte))]]]
return[member[.crc]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[long] identifier[generate] operator[SEP] Keyword[long] identifier[crc] , Keyword[long] identifier[value] operator[SEP] {
identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[56] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[48] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[40] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[32] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[24] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] operator[SEP] identifier[crc] operator[=] identifier[next] operator[SEP] identifier[crc] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[crc] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private static Method getMethodOrDie(
final Class clazz, final String name, final Class... params) {
try {
return clazz.getMethod(name, params);
} catch (NoSuchMethodException e) {
throw new RuntimeException(
"Generated message class \"" + clazz.getName() +
"\" missing method \"" + name + "\".", e);
}
}
|
class class_name[name] begin[{]
method[getMethodOrDie, return_type[type[Method]], modifier[private static], parameter[clazz, name, params]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Generated message class \""), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" missing method \""), operator=+), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\"."), 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[static] identifier[Method] identifier[getMethodOrDie] operator[SEP] Keyword[final] identifier[Class] identifier[clazz] , Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[Class] operator[...] identifier[params] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[clazz] operator[SEP] identifier[getMethod] operator[SEP] identifier[name] , identifier[params] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[name] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String getFilePath(String fileNameAndPath) {
if (fileNameAndPath == null){
return null;
}
String fileSeparator;
if(fileNameAndPath.contains("/")){
fileSeparator = "/";
}else{
fileSeparator = "\\";
}
int lastIndexOf=fileNameAndPath.lastIndexOf(fileSeparator);
if (lastIndexOf<0){
return "";
} else {
return fileNameAndPath.substring(0,lastIndexOf);
}
}
|
class class_name[name] begin[{]
method[getFilePath, return_type[type[String]], modifier[public static], parameter[fileNameAndPath]] begin[{]
if[binary_operation[member[.fileNameAndPath], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], fileSeparator]
if[call[fileNameAndPath.contains, parameter[literal["/"]]]] begin[{]
assign[member[.fileSeparator], literal["/"]]
else begin[{]
assign[member[.fileSeparator], literal["\\"]]
end[}]
local_variable[type[int], lastIndexOf]
if[binary_operation[member[.lastIndexOf], <, literal[0]]] begin[{]
return[literal[""]]
else begin[{]
return[call[fileNameAndPath.substring, parameter[literal[0], member[.lastIndexOf]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getFilePath] operator[SEP] identifier[String] identifier[fileNameAndPath] operator[SEP] {
Keyword[if] operator[SEP] identifier[fileNameAndPath] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[fileSeparator] operator[SEP] Keyword[if] operator[SEP] identifier[fileNameAndPath] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[fileSeparator] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[fileSeparator] operator[=] literal[String] operator[SEP]
}
Keyword[int] identifier[lastIndexOf] operator[=] identifier[fileNameAndPath] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[fileSeparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastIndexOf] operator[<] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[fileNameAndPath] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[lastIndexOf] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public static boolean isNormalized(String str, Mode mode, int options) {
return mode.getNormalizer2(options).isNormalized(str);
}
|
class class_name[name] begin[{]
method[isNormalized, return_type[type[boolean]], modifier[public static], parameter[str, mode, options]] begin[{]
return[call[mode.getNormalizer2, parameter[member[.options]]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] Keyword[boolean] identifier[isNormalized] operator[SEP] identifier[String] identifier[str] , identifier[Mode] identifier[mode] , Keyword[int] identifier[options] operator[SEP] {
Keyword[return] identifier[mode] operator[SEP] identifier[getNormalizer2] operator[SEP] identifier[options] operator[SEP] operator[SEP] identifier[isNormalized] operator[SEP] identifier[str] operator[SEP] operator[SEP]
}
|
public static void setProperty(Object bean, String property, Object value) throws InvocationTargetException{
try{
getSetterMethod(bean.getClass(), property).invoke(bean, value);
}catch(IllegalAccessException ex){
throw new ImpossibleException(ex); // because setter method is public
}
}
|
class class_name[name] begin[{]
method[setProperty, return_type[void], modifier[public static], parameter[bean, property, value]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[], type_arguments=None), MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSetterMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=bean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ImpossibleException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IllegalAccessException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setProperty] operator[SEP] identifier[Object] identifier[bean] , identifier[String] identifier[property] , identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[InvocationTargetException] {
Keyword[try] {
identifier[getSetterMethod] operator[SEP] identifier[bean] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[property] operator[SEP] operator[SEP] identifier[invoke] operator[SEP] identifier[bean] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ImpossibleException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
|
protected void publish(final LogRecord record) {
if(record instanceof ProgressLogRecord) {
ProgressLogRecord preg = (ProgressLogRecord) record;
Progress prog = preg.getProgress();
JProgressBar pbar = getOrCreateProgressBar(prog);
updateProgressBar(prog, pbar);
if(prog.isComplete()) {
removeProgressBar(prog, pbar);
}
if(prog.isComplete() || prog instanceof StepProgress) {
publishTextRecord(record);
}
}
else {
publishTextRecord(record);
}
}
|
class class_name[name] begin[{]
method[publish, return_type[void], modifier[protected], parameter[record]] begin[{]
if[binary_operation[member[.record], instanceof, type[ProgressLogRecord]]] begin[{]
local_variable[type[ProgressLogRecord], preg]
local_variable[type[Progress], prog]
local_variable[type[JProgressBar], pbar]
call[.updateProgressBar, parameter[member[.prog], member[.pbar]]]
if[call[prog.isComplete, parameter[]]] begin[{]
call[.removeProgressBar, parameter[member[.prog], member[.pbar]]]
else begin[{]
None
end[}]
if[binary_operation[call[prog.isComplete, parameter[]], ||, binary_operation[member[.prog], instanceof, type[StepProgress]]]] begin[{]
call[.publishTextRecord, parameter[member[.record]]]
else begin[{]
None
end[}]
else begin[{]
call[.publishTextRecord, parameter[member[.record]]]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[publish] operator[SEP] Keyword[final] identifier[LogRecord] identifier[record] operator[SEP] {
Keyword[if] operator[SEP] identifier[record] Keyword[instanceof] identifier[ProgressLogRecord] operator[SEP] {
identifier[ProgressLogRecord] identifier[preg] operator[=] operator[SEP] identifier[ProgressLogRecord] operator[SEP] identifier[record] operator[SEP] identifier[Progress] identifier[prog] operator[=] identifier[preg] operator[SEP] identifier[getProgress] operator[SEP] operator[SEP] operator[SEP] identifier[JProgressBar] identifier[pbar] operator[=] identifier[getOrCreateProgressBar] operator[SEP] identifier[prog] operator[SEP] operator[SEP] identifier[updateProgressBar] operator[SEP] identifier[prog] , identifier[pbar] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prog] operator[SEP] identifier[isComplete] operator[SEP] operator[SEP] operator[SEP] {
identifier[removeProgressBar] operator[SEP] identifier[prog] , identifier[pbar] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[prog] operator[SEP] identifier[isComplete] operator[SEP] operator[SEP] operator[||] identifier[prog] Keyword[instanceof] identifier[StepProgress] operator[SEP] {
identifier[publishTextRecord] operator[SEP] identifier[record] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[publishTextRecord] operator[SEP] identifier[record] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public CredentialsProvider createFor(String uri, String username, String password,
String passphrase) {
return createFor(uri, username, password, passphrase, false);
}
|
class class_name[name] begin[{]
method[createFor, return_type[type[CredentialsProvider]], modifier[public], parameter[uri, username, password, passphrase]] begin[{]
return[call[.createFor, parameter[member[.uri], member[.username], member[.password], member[.passphrase], literal[false]]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] identifier[CredentialsProvider] identifier[createFor] operator[SEP] identifier[String] identifier[uri] , identifier[String] identifier[username] , identifier[String] identifier[password] , identifier[String] identifier[passphrase] operator[SEP] {
Keyword[return] identifier[createFor] operator[SEP] identifier[uri] , identifier[username] , identifier[password] , identifier[passphrase] , literal[boolean] operator[SEP] operator[SEP]
}
|
private static boolean fireAfterInvocation(Object runner, Object target, FrameworkMethod method, Throwable thrown) {
if ((runner != null) && (method != null)) {
DepthGauge depthGauge = LifecycleHooks.computeIfAbsent(methodDepth.get(), methodHash(runner, method), newInstance);
if (0 == depthGauge.decreaseDepth()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("afterInvocation: {}", LifecycleHooks.invoke(runner, "describeChild", method));
}
synchronized(methodWatcherLoader) {
for (MethodWatcher watcher : methodWatcherLoader) {
watcher.afterInvocation(runner, target, method, thrown);
}
}
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[fireAfterInvocation, return_type[type[boolean]], modifier[private static], parameter[runner, target, method, thrown]] begin[{]
if[binary_operation[binary_operation[member[.runner], !=, literal[null]], &&, binary_operation[member[.method], !=, literal[null]]]] begin[{]
local_variable[type[DepthGauge], depthGauge]
if[binary_operation[literal[0], ==, call[depthGauge.decreaseDepth, parameter[]]]] begin[{]
if[call[LOGGER.isDebugEnabled, parameter[]]] begin[{]
call[LOGGER.debug, parameter[literal["afterInvocation: {}"], call[LifecycleHooks.invoke, parameter[member[.runner], literal["describeChild"], member[.method]]]]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.methodWatcherLoader]] BEGIN[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=runner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thrown, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterInvocation, postfix_operators=[], prefix_operators=[], qualifier=watcher, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=methodWatcherLoader, 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=MethodWatcher, sub_type=None))), label=None)
END[}]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[fireAfterInvocation] operator[SEP] identifier[Object] identifier[runner] , identifier[Object] identifier[target] , identifier[FrameworkMethod] identifier[method] , identifier[Throwable] identifier[thrown] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[runner] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[method] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[DepthGauge] identifier[depthGauge] operator[=] identifier[LifecycleHooks] operator[SEP] identifier[computeIfAbsent] operator[SEP] identifier[methodDepth] operator[SEP] identifier[get] operator[SEP] operator[SEP] , identifier[methodHash] operator[SEP] identifier[runner] , identifier[method] operator[SEP] , identifier[newInstance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[0] operator[==] identifier[depthGauge] operator[SEP] identifier[decreaseDepth] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[LifecycleHooks] operator[SEP] identifier[invoke] operator[SEP] identifier[runner] , literal[String] , identifier[method] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[methodWatcherLoader] operator[SEP] {
Keyword[for] operator[SEP] identifier[MethodWatcher] identifier[watcher] operator[:] identifier[methodWatcherLoader] operator[SEP] {
identifier[watcher] operator[SEP] identifier[afterInvocation] operator[SEP] identifier[runner] , identifier[target] , identifier[method] , identifier[thrown] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static INDArray pca_factor(INDArray A, double variance, boolean normalize) {
if (normalize) {
// Normalize to mean 0 for each feature ( each column has 0 mean )
INDArray mean = A.mean(0);
A.subiRowVector(mean);
}
long m = A.rows();
long n = A.columns();
// The prepare SVD results, we'll decomp A to UxSxV'
INDArray s = Nd4j.create(A.dataType(), m < n ? m : n);
INDArray VT = Nd4j.create(A.dataType(), new long[]{n, n}, 'f');
// Note - we don't care about U
Nd4j.getBlasWrapper().lapack().gesvd(A, s, null, VT);
// Now convert the eigs of X into the eigs of the covariance matrix
for (int i = 0; i < s.length(); i++) {
s.putScalar(i, Math.sqrt(s.getDouble(i)) / (m - 1));
}
// Now find how many features we need to preserve the required variance
// Which is the same percentage as a cumulative sum of the eigenvalues' percentages
double totalEigSum = s.sumNumber().doubleValue() * variance;
int k = -1; // we will reduce to k dimensions
double runningTotal = 0;
for (int i = 0; i < s.length(); i++) {
runningTotal += s.getDouble(i);
if (runningTotal >= totalEigSum) { // OK I know it's a float, but what else can we do ?
k = i + 1; // we will keep this many features to preserve the reqd. variance
break;
}
}
if (k == -1) { // if we need everything
throw new RuntimeException("No reduction possible for reqd. variance - use smaller variance");
}
// So now let's rip out the appropriate number of left singular vectors from
// the V output (note we pulls rows since VT is a transpose of V)
INDArray V = VT.transpose();
INDArray factor = Nd4j.createUninitialized(A.dataType(), new long[]{n, k}, 'f');
for (int i = 0; i < k; i++) {
factor.putColumn(i, V.getColumn(i));
}
return factor;
}
|
class class_name[name] begin[{]
method[pca_factor, return_type[type[INDArray]], modifier[public static], parameter[A, variance, normalize]] begin[{]
if[member[.normalize]] begin[{]
local_variable[type[INDArray], mean]
call[A.subiRowVector, parameter[member[.mean]]]
else begin[{]
None
end[}]
local_variable[type[long], m]
local_variable[type[long], n]
local_variable[type[INDArray], s]
local_variable[type[INDArray], VT]
call[Nd4j.getBlasWrapper, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=sqrt, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=/)], member=putScalar, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, 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)
local_variable[type[double], totalEigSum]
local_variable[type[int], k]
local_variable[type[double], runningTotal]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=runningTotal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=runningTotal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=totalEigSum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, 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)
if[binary_operation[member[.k], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No reduction possible for reqd. variance - use smaller variance")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[INDArray], V]
local_variable[type[INDArray], factor]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=V, selectors=[], type_arguments=None)], member=putColumn, postfix_operators=[], prefix_operators=[], qualifier=factor, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=k, 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[.factor]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[INDArray] identifier[pca_factor] operator[SEP] identifier[INDArray] identifier[A] , Keyword[double] identifier[variance] , Keyword[boolean] identifier[normalize] operator[SEP] {
Keyword[if] operator[SEP] identifier[normalize] operator[SEP] {
identifier[INDArray] identifier[mean] operator[=] identifier[A] operator[SEP] identifier[mean] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[A] operator[SEP] identifier[subiRowVector] operator[SEP] identifier[mean] operator[SEP] operator[SEP]
}
Keyword[long] identifier[m] operator[=] identifier[A] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[n] operator[=] identifier[A] operator[SEP] identifier[columns] operator[SEP] operator[SEP] operator[SEP] identifier[INDArray] identifier[s] operator[=] identifier[Nd4j] operator[SEP] identifier[create] operator[SEP] identifier[A] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] , identifier[m] operator[<] identifier[n] operator[?] identifier[m] operator[:] identifier[n] operator[SEP] operator[SEP] identifier[INDArray] identifier[VT] operator[=] identifier[Nd4j] operator[SEP] identifier[create] operator[SEP] identifier[A] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] , Keyword[new] Keyword[long] operator[SEP] operator[SEP] {
identifier[n] , identifier[n]
} , literal[String] operator[SEP] operator[SEP] identifier[Nd4j] operator[SEP] identifier[getBlasWrapper] operator[SEP] operator[SEP] operator[SEP] identifier[lapack] operator[SEP] operator[SEP] operator[SEP] identifier[gesvd] operator[SEP] identifier[A] , identifier[s] , Other[null] , identifier[VT] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[s] operator[SEP] identifier[putScalar] operator[SEP] identifier[i] , identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[s] operator[SEP] identifier[getDouble] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[/] operator[SEP] identifier[m] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[double] identifier[totalEigSum] operator[=] identifier[s] operator[SEP] identifier[sumNumber] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[*] identifier[variance] operator[SEP] Keyword[int] identifier[k] operator[=] operator[-] Other[1] operator[SEP] Keyword[double] identifier[runningTotal] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[runningTotal] operator[+=] identifier[s] operator[SEP] identifier[getDouble] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[runningTotal] operator[>=] identifier[totalEigSum] operator[SEP] {
identifier[k] operator[=] identifier[i] operator[+] Other[1] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[k] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[INDArray] identifier[V] operator[=] identifier[VT] operator[SEP] identifier[transpose] operator[SEP] operator[SEP] operator[SEP] identifier[INDArray] identifier[factor] operator[=] identifier[Nd4j] operator[SEP] identifier[createUninitialized] operator[SEP] identifier[A] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] , Keyword[new] Keyword[long] operator[SEP] operator[SEP] {
identifier[n] , identifier[k]
} , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[k] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[factor] operator[SEP] identifier[putColumn] operator[SEP] identifier[i] , identifier[V] operator[SEP] identifier[getColumn] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[factor] operator[SEP]
}
|
public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) {
String verifier = request.getParameter("oauth_verifier");
AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier);
OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null);
return connectionFactory.createConnection(accessToken);
}
|
class class_name[name] begin[{]
method[completeConnection, return_type[type[Connection]], modifier[public], parameter[connectionFactory, request]] begin[{]
local_variable[type[String], verifier]
local_variable[type[AuthorizedRequestToken], requestToken]
local_variable[type[OAuthToken], accessToken]
return[call[connectionFactory.createConnection, parameter[member[.accessToken]]]]
end[}]
END[}]
|
Keyword[public] identifier[Connection] operator[<] operator[?] operator[>] identifier[completeConnection] operator[SEP] identifier[OAuth1ConnectionFactory] operator[<] operator[?] operator[>] identifier[connectionFactory] , identifier[NativeWebRequest] identifier[request] operator[SEP] {
identifier[String] identifier[verifier] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[AuthorizedRequestToken] identifier[requestToken] operator[=] Keyword[new] identifier[AuthorizedRequestToken] operator[SEP] identifier[extractCachedRequestToken] operator[SEP] identifier[request] operator[SEP] , identifier[verifier] operator[SEP] operator[SEP] identifier[OAuthToken] identifier[accessToken] operator[=] identifier[connectionFactory] operator[SEP] identifier[getOAuthOperations] operator[SEP] operator[SEP] operator[SEP] identifier[exchangeForAccessToken] operator[SEP] identifier[requestToken] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[connectionFactory] operator[SEP] identifier[createConnection] operator[SEP] identifier[accessToken] operator[SEP] operator[SEP]
}
|
public static InetAddress[] getInetAddressArray ( Properties props, String key, String delim, InetAddress[] def ) {
String p = props.getProperty(key);
if ( p != null ) {
StringTokenizer tok = new StringTokenizer(p, delim);
int len = tok.countTokens();
InetAddress[] arr = new InetAddress[len];
for ( int i = 0; i < len; i++ ) {
String addr = tok.nextToken();
try {
arr[ i ] = InetAddress.getByName(addr);
}
catch ( UnknownHostException uhe ) {
log.error("Unknown host " + addr, uhe);
return def;
}
}
return arr;
}
return def;
}
|
class class_name[name] begin[{]
method[getInetAddressArray, return_type[type[InetAddress]], modifier[public static], parameter[props, key, delim, def]] begin[{]
local_variable[type[String], p]
if[binary_operation[member[.p], !=, literal[null]]] begin[{]
local_variable[type[StringTokenizer], tok]
local_variable[type[int], len]
local_variable[type[InetAddress], arr]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=tok, selectors=[], type_arguments=None), name=addr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=addr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByName, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown host "), operandr=MemberReference(member=addr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=uhe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=def, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=uhe, types=['UnknownHostException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.arr]]
else begin[{]
None
end[}]
return[member[.def]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[InetAddress] operator[SEP] operator[SEP] identifier[getInetAddressArray] operator[SEP] identifier[Properties] identifier[props] , identifier[String] identifier[key] , identifier[String] identifier[delim] , identifier[InetAddress] operator[SEP] operator[SEP] identifier[def] operator[SEP] {
identifier[String] identifier[p] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
identifier[StringTokenizer] identifier[tok] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[p] , identifier[delim] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[tok] operator[SEP] identifier[countTokens] operator[SEP] operator[SEP] operator[SEP] identifier[InetAddress] operator[SEP] operator[SEP] identifier[arr] operator[=] Keyword[new] identifier[InetAddress] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[addr] operator[=] identifier[tok] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[arr] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[InetAddress] operator[SEP] identifier[getByName] operator[SEP] identifier[addr] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnknownHostException] identifier[uhe] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[addr] , identifier[uhe] operator[SEP] operator[SEP] Keyword[return] identifier[def] operator[SEP]
}
}
Keyword[return] identifier[arr] operator[SEP]
}
Keyword[return] identifier[def] operator[SEP]
}
|
public synchronized void start(final String url, final String path,
final boolean pathAsDirectory,
final int callbackProgressTimes,
final int callbackProgressMinIntervalMillis,
final int autoRetryTimes, final boolean forceReDownload,
final FileDownloadHeader header, final boolean isWifiRequired) {
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "request start the task with url(%s) path(%s) isDirectory(%B)",
url, path, pathAsDirectory);
}
// clear pause all marker so that the delay pause all check doesn't obstruct normal start of
// new task
PauseAllMarker.clearMarker();
final int id = FileDownloadUtils.generateId(url, path, pathAsDirectory);
FileDownloadModel model = mDatabase.find(id);
List<ConnectionModel> dirConnectionModelList = null;
if (!pathAsDirectory && model == null) {
// try dir data.
final int dirCaseId = FileDownloadUtils
.generateId(url, FileDownloadUtils.getParent(path),
true);
model = mDatabase.find(dirCaseId);
if (model != null && path.equals(model.getTargetFilePath())) {
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "task[%d] find model by dirCaseId[%d]", id, dirCaseId);
}
dirConnectionModelList = mDatabase.findConnectionModel(dirCaseId);
}
}
if (FileDownloadHelper.inspectAndInflowDownloading(id, model, this, true)) {
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "has already started download %d", id);
}
return;
}
final String targetFilePath = model != null ? model.getTargetFilePath()
: FileDownloadUtils.getTargetFilePath(path, pathAsDirectory, null);
if (FileDownloadHelper.inspectAndInflowDownloaded(id, targetFilePath, forceReDownload,
true)) {
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "has already completed downloading %d", id);
}
return;
}
final long sofar = model != null ? model.getSoFar() : 0;
final String tempFilePath = model != null ? model.getTempFilePath()
: FileDownloadUtils.getTempPath(targetFilePath);
if (FileDownloadHelper.inspectAndInflowConflictPath(id, sofar, tempFilePath, targetFilePath,
this)) {
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog
.d(this, "there is an another task with the same target-file-path %d %s",
id, targetFilePath);
}
// because of the file is dirty for this task.
if (model != null) {
mDatabase.remove(id);
mDatabase.removeConnections(id);
}
return;
}
// real start
// - create model
boolean needUpdate2DB;
if (model != null
&& (model.getStatus() == FileDownloadStatus.paused
|| model.getStatus() == FileDownloadStatus.error
|| model.getStatus() == FileDownloadStatus.pending
|| model.getStatus() == FileDownloadStatus.started
|| model.getStatus() == FileDownloadStatus.connected) // FileDownloadRunnable
// invoke #isBreakpointAvailable to determine whether it is really invalid.
) {
if (model.getId() != id) {
// in try dir case.
mDatabase.remove(model.getId());
mDatabase.removeConnections(model.getId());
model.setId(id);
model.setPath(path, pathAsDirectory);
if (dirConnectionModelList != null) {
for (ConnectionModel connectionModel : dirConnectionModelList) {
connectionModel.setId(id);
mDatabase.insertConnectionModel(connectionModel);
}
}
needUpdate2DB = true;
} else {
if (!TextUtils.equals(url, model.getUrl())) {
// for cover the case of reusing the downloaded processing with the different
// url( using with idGenerator ).
model.setUrl(url);
needUpdate2DB = true;
} else {
needUpdate2DB = false;
}
}
} else {
if (model == null) {
model = new FileDownloadModel();
}
model.setUrl(url);
model.setPath(path, pathAsDirectory);
model.setId(id);
model.setSoFar(0);
model.setTotal(0);
model.setStatus(FileDownloadStatus.pending);
model.setConnectionCount(1);
needUpdate2DB = true;
}
// - update model to db
if (needUpdate2DB) {
mDatabase.update(model);
}
final DownloadLaunchRunnable.Builder builder = new DownloadLaunchRunnable.Builder();
final DownloadLaunchRunnable runnable =
builder.setModel(model)
.setHeader(header)
.setThreadPoolMonitor(this)
.setMinIntervalMillis(callbackProgressMinIntervalMillis)
.setCallbackProgressMaxCount(callbackProgressTimes)
.setForceReDownload(forceReDownload)
.setWifiRequired(isWifiRequired)
.setMaxRetryTimes(autoRetryTimes)
.build();
// - execute
mThreadPool.execute(runnable);
}
|
class class_name[name] begin[{]
method[start, return_type[void], modifier[synchronized public], parameter[url, path, pathAsDirectory, callbackProgressTimes, callbackProgressMinIntervalMillis, autoRetryTimes, forceReDownload, header, isWifiRequired]] begin[{]
if[member[FileDownloadLog.NEED_LOG]] begin[{]
call[FileDownloadLog.d, parameter[THIS[], literal["request start the task with url(%s) path(%s) isDirectory(%B)"], member[.url], member[.path], member[.pathAsDirectory]]]
else begin[{]
None
end[}]
call[PauseAllMarker.clearMarker, parameter[]]
local_variable[type[int], id]
local_variable[type[FileDownloadModel], model]
local_variable[type[List], dirConnectionModelList]
if[binary_operation[member[.pathAsDirectory], &&, binary_operation[member[.model], ==, literal[null]]]] begin[{]
local_variable[type[int], dirCaseId]
assign[member[.model], call[mDatabase.find, parameter[member[.dirCaseId]]]]
if[binary_operation[binary_operation[member[.model], !=, literal[null]], &&, call[path.equals, parameter[call[model.getTargetFilePath, parameter[]]]]]] begin[{]
if[member[FileDownloadLog.NEED_LOG]] begin[{]
call[FileDownloadLog.d, parameter[THIS[], literal["task[%d] find model by dirCaseId[%d]"], member[.id], member[.dirCaseId]]]
else begin[{]
None
end[}]
assign[member[.dirConnectionModelList], call[mDatabase.findConnectionModel, parameter[member[.dirCaseId]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[FileDownloadHelper.inspectAndInflowDownloading, parameter[member[.id], member[.model], THIS[], literal[true]]]] begin[{]
if[member[FileDownloadLog.NEED_LOG]] begin[{]
call[FileDownloadLog.d, parameter[THIS[], literal["has already started download %d"], member[.id]]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], targetFilePath]
if[call[FileDownloadHelper.inspectAndInflowDownloaded, parameter[member[.id], member[.targetFilePath], member[.forceReDownload], literal[true]]]] begin[{]
if[member[FileDownloadLog.NEED_LOG]] begin[{]
call[FileDownloadLog.d, parameter[THIS[], literal["has already completed downloading %d"], member[.id]]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], sofar]
local_variable[type[String], tempFilePath]
if[call[FileDownloadHelper.inspectAndInflowConflictPath, parameter[member[.id], member[.sofar], member[.tempFilePath], member[.targetFilePath], THIS[]]]] begin[{]
if[member[FileDownloadLog.NEED_LOG]] begin[{]
call[FileDownloadLog.d, parameter[THIS[], literal["there is an another task with the same target-file-path %d %s"], member[.id], member[.targetFilePath]]]
else begin[{]
None
end[}]
if[binary_operation[member[.model], !=, literal[null]]] begin[{]
call[mDatabase.remove, parameter[member[.id]]]
call[mDatabase.removeConnections, parameter[member[.id]]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
local_variable[type[boolean], needUpdate2DB]
if[binary_operation[binary_operation[member[.model], !=, literal[null]], &&, binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[call[model.getStatus, parameter[]], ==, member[FileDownloadStatus.paused]], ||, binary_operation[call[model.getStatus, parameter[]], ==, member[FileDownloadStatus.error]]], ||, binary_operation[call[model.getStatus, parameter[]], ==, member[FileDownloadStatus.pending]]], ||, binary_operation[call[model.getStatus, parameter[]], ==, member[FileDownloadStatus.started]]], ||, binary_operation[call[model.getStatus, parameter[]], ==, member[FileDownloadStatus.connected]]]]] begin[{]
if[binary_operation[call[model.getId, parameter[]], !=, member[.id]]] begin[{]
call[mDatabase.remove, parameter[call[model.getId, parameter[]]]]
call[mDatabase.removeConnections, parameter[call[model.getId, parameter[]]]]
call[model.setId, parameter[member[.id]]]
call[model.setPath, parameter[member[.path], member[.pathAsDirectory]]]
if[binary_operation[member[.dirConnectionModelList], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setId, postfix_operators=[], prefix_operators=[], qualifier=connectionModel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=connectionModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insertConnectionModel, postfix_operators=[], prefix_operators=[], qualifier=mDatabase, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dirConnectionModelList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=connectionModel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConnectionModel, sub_type=None))), label=None)
else begin[{]
None
end[}]
assign[member[.needUpdate2DB], literal[true]]
else begin[{]
if[call[TextUtils.equals, parameter[member[.url], call[model.getUrl, parameter[]]]]] begin[{]
call[model.setUrl, parameter[member[.url]]]
assign[member[.needUpdate2DB], literal[true]]
else begin[{]
assign[member[.needUpdate2DB], literal[false]]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.model], ==, literal[null]]] begin[{]
assign[member[.model], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileDownloadModel, sub_type=None))]
else begin[{]
None
end[}]
call[model.setUrl, parameter[member[.url]]]
call[model.setPath, parameter[member[.path], member[.pathAsDirectory]]]
call[model.setId, parameter[member[.id]]]
call[model.setSoFar, parameter[literal[0]]]
call[model.setTotal, parameter[literal[0]]]
call[model.setStatus, parameter[member[FileDownloadStatus.pending]]]
call[model.setConnectionCount, parameter[literal[1]]]
assign[member[.needUpdate2DB], literal[true]]
end[}]
if[member[.needUpdate2DB]] begin[{]
call[mDatabase.update, parameter[member[.model]]]
else begin[{]
None
end[}]
local_variable[type[DownloadLaunchRunnable], builder]
local_variable[type[DownloadLaunchRunnable], runnable]
call[mThreadPool.execute, parameter[member[.runnable]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[start] operator[SEP] Keyword[final] identifier[String] identifier[url] , Keyword[final] identifier[String] identifier[path] , Keyword[final] Keyword[boolean] identifier[pathAsDirectory] , Keyword[final] Keyword[int] identifier[callbackProgressTimes] , Keyword[final] Keyword[int] identifier[callbackProgressMinIntervalMillis] , Keyword[final] Keyword[int] identifier[autoRetryTimes] , Keyword[final] Keyword[boolean] identifier[forceReDownload] , Keyword[final] identifier[FileDownloadHeader] identifier[header] , Keyword[final] Keyword[boolean] identifier[isWifiRequired] operator[SEP] {
Keyword[if] operator[SEP] identifier[FileDownloadLog] operator[SEP] identifier[NEED_LOG] operator[SEP] {
identifier[FileDownloadLog] operator[SEP] identifier[d] operator[SEP] Keyword[this] , literal[String] , identifier[url] , identifier[path] , identifier[pathAsDirectory] operator[SEP] operator[SEP]
}
identifier[PauseAllMarker] operator[SEP] identifier[clearMarker] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[id] operator[=] identifier[FileDownloadUtils] operator[SEP] identifier[generateId] operator[SEP] identifier[url] , identifier[path] , identifier[pathAsDirectory] operator[SEP] operator[SEP] identifier[FileDownloadModel] identifier[model] operator[=] identifier[mDatabase] operator[SEP] identifier[find] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ConnectionModel] operator[>] identifier[dirConnectionModelList] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[pathAsDirectory] operator[&&] identifier[model] operator[==] Other[null] operator[SEP] {
Keyword[final] Keyword[int] identifier[dirCaseId] operator[=] identifier[FileDownloadUtils] operator[SEP] identifier[generateId] operator[SEP] identifier[url] , identifier[FileDownloadUtils] operator[SEP] identifier[getParent] operator[SEP] identifier[path] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[model] operator[=] identifier[mDatabase] operator[SEP] identifier[find] operator[SEP] identifier[dirCaseId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[model] operator[!=] Other[null] operator[&&] identifier[path] operator[SEP] identifier[equals] operator[SEP] identifier[model] operator[SEP] identifier[getTargetFilePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[FileDownloadLog] operator[SEP] identifier[NEED_LOG] operator[SEP] {
identifier[FileDownloadLog] operator[SEP] identifier[d] operator[SEP] Keyword[this] , literal[String] , identifier[id] , identifier[dirCaseId] operator[SEP] operator[SEP]
}
identifier[dirConnectionModelList] operator[=] identifier[mDatabase] operator[SEP] identifier[findConnectionModel] operator[SEP] identifier[dirCaseId] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[FileDownloadHelper] operator[SEP] identifier[inspectAndInflowDownloading] operator[SEP] identifier[id] , identifier[model] , Keyword[this] , literal[boolean] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[FileDownloadLog] operator[SEP] identifier[NEED_LOG] operator[SEP] {
identifier[FileDownloadLog] operator[SEP] identifier[d] operator[SEP] Keyword[this] , literal[String] , identifier[id] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[final] identifier[String] identifier[targetFilePath] operator[=] identifier[model] operator[!=] Other[null] operator[?] identifier[model] operator[SEP] identifier[getTargetFilePath] operator[SEP] operator[SEP] operator[:] identifier[FileDownloadUtils] operator[SEP] identifier[getTargetFilePath] operator[SEP] identifier[path] , identifier[pathAsDirectory] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[FileDownloadHelper] operator[SEP] identifier[inspectAndInflowDownloaded] operator[SEP] identifier[id] , identifier[targetFilePath] , identifier[forceReDownload] , literal[boolean] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[FileDownloadLog] operator[SEP] identifier[NEED_LOG] operator[SEP] {
identifier[FileDownloadLog] operator[SEP] identifier[d] operator[SEP] Keyword[this] , literal[String] , identifier[id] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[final] Keyword[long] identifier[sofar] operator[=] identifier[model] operator[!=] Other[null] operator[?] identifier[model] operator[SEP] identifier[getSoFar] operator[SEP] operator[SEP] operator[:] Other[0] operator[SEP] Keyword[final] identifier[String] identifier[tempFilePath] operator[=] identifier[model] operator[!=] Other[null] operator[?] identifier[model] operator[SEP] identifier[getTempFilePath] operator[SEP] operator[SEP] operator[:] identifier[FileDownloadUtils] operator[SEP] identifier[getTempPath] operator[SEP] identifier[targetFilePath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[FileDownloadHelper] operator[SEP] identifier[inspectAndInflowConflictPath] operator[SEP] identifier[id] , identifier[sofar] , identifier[tempFilePath] , identifier[targetFilePath] , Keyword[this] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[FileDownloadLog] operator[SEP] identifier[NEED_LOG] operator[SEP] {
identifier[FileDownloadLog] operator[SEP] identifier[d] operator[SEP] Keyword[this] , literal[String] , identifier[id] , identifier[targetFilePath] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[model] operator[!=] Other[null] operator[SEP] {
identifier[mDatabase] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[mDatabase] operator[SEP] identifier[removeConnections] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[boolean] identifier[needUpdate2DB] operator[SEP] Keyword[if] operator[SEP] identifier[model] operator[!=] Other[null] operator[&&] operator[SEP] identifier[model] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[FileDownloadStatus] operator[SEP] identifier[paused] operator[||] identifier[model] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[FileDownloadStatus] operator[SEP] identifier[error] operator[||] identifier[model] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[FileDownloadStatus] operator[SEP] identifier[pending] operator[||] identifier[model] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[FileDownloadStatus] operator[SEP] identifier[started] operator[||] identifier[model] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[FileDownloadStatus] operator[SEP] identifier[connected] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[model] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[!=] identifier[id] operator[SEP] {
identifier[mDatabase] operator[SEP] identifier[remove] operator[SEP] identifier[model] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mDatabase] operator[SEP] identifier[removeConnections] operator[SEP] identifier[model] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setId] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setPath] operator[SEP] identifier[path] , identifier[pathAsDirectory] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dirConnectionModelList] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[ConnectionModel] identifier[connectionModel] operator[:] identifier[dirConnectionModelList] operator[SEP] {
identifier[connectionModel] operator[SEP] identifier[setId] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[mDatabase] operator[SEP] identifier[insertConnectionModel] operator[SEP] identifier[connectionModel] operator[SEP] operator[SEP]
}
}
identifier[needUpdate2DB] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[TextUtils] operator[SEP] identifier[equals] operator[SEP] identifier[url] , identifier[model] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[model] operator[SEP] identifier[setUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[needUpdate2DB] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[needUpdate2DB] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[model] operator[==] Other[null] operator[SEP] {
identifier[model] operator[=] Keyword[new] identifier[FileDownloadModel] operator[SEP] operator[SEP] operator[SEP]
}
identifier[model] operator[SEP] identifier[setUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setPath] operator[SEP] identifier[path] , identifier[pathAsDirectory] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setId] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setSoFar] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setTotal] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setStatus] operator[SEP] identifier[FileDownloadStatus] operator[SEP] identifier[pending] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setConnectionCount] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[needUpdate2DB] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[needUpdate2DB] operator[SEP] {
identifier[mDatabase] operator[SEP] identifier[update] operator[SEP] identifier[model] operator[SEP] operator[SEP]
}
Keyword[final] identifier[DownloadLaunchRunnable] operator[SEP] identifier[Builder] identifier[builder] operator[=] Keyword[new] identifier[DownloadLaunchRunnable] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[DownloadLaunchRunnable] identifier[runnable] operator[=] identifier[builder] operator[SEP] identifier[setModel] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[setHeader] operator[SEP] identifier[header] operator[SEP] operator[SEP] identifier[setThreadPoolMonitor] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[setMinIntervalMillis] operator[SEP] identifier[callbackProgressMinIntervalMillis] operator[SEP] operator[SEP] identifier[setCallbackProgressMaxCount] operator[SEP] identifier[callbackProgressTimes] operator[SEP] operator[SEP] identifier[setForceReDownload] operator[SEP] identifier[forceReDownload] operator[SEP] operator[SEP] identifier[setWifiRequired] operator[SEP] identifier[isWifiRequired] operator[SEP] operator[SEP] identifier[setMaxRetryTimes] operator[SEP] identifier[autoRetryTimes] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[mThreadPool] operator[SEP] identifier[execute] operator[SEP] identifier[runnable] operator[SEP] operator[SEP]
}
|
public void preApprove(BareJid user) throws NotLoggedInException, NotConnectedException, InterruptedException, FeatureNotSupportedException {
final XMPPConnection connection = connection();
if (!isSubscriptionPreApprovalSupported()) {
throw new FeatureNotSupportedException("Pre-approving");
}
Presence presencePacket = new Presence(Presence.Type.subscribed);
presencePacket.setTo(user);
connection.sendStanza(presencePacket);
}
|
class class_name[name] begin[{]
method[preApprove, return_type[void], modifier[public], parameter[user]] begin[{]
local_variable[type[XMPPConnection], connection]
if[call[.isSubscriptionPreApprovalSupported, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Pre-approving")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FeatureNotSupportedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Presence], presencePacket]
call[presencePacket.setTo, parameter[member[.user]]]
call[connection.sendStanza, parameter[member[.presencePacket]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[preApprove] operator[SEP] identifier[BareJid] identifier[user] operator[SEP] Keyword[throws] identifier[NotLoggedInException] , identifier[NotConnectedException] , identifier[InterruptedException] , identifier[FeatureNotSupportedException] {
Keyword[final] identifier[XMPPConnection] identifier[connection] operator[=] identifier[connection] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isSubscriptionPreApprovalSupported] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FeatureNotSupportedException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Presence] identifier[presencePacket] operator[=] Keyword[new] identifier[Presence] operator[SEP] identifier[Presence] operator[SEP] identifier[Type] operator[SEP] identifier[subscribed] operator[SEP] operator[SEP] identifier[presencePacket] operator[SEP] identifier[setTo] operator[SEP] identifier[user] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[sendStanza] operator[SEP] identifier[presencePacket] operator[SEP] operator[SEP]
}
|
static public BagObject resource (Class context, String name) {
return resource (context, name, () -> null);
}
|
class class_name[name] begin[{]
method[resource, return_type[type[BagObject]], modifier[public static], parameter[context, name]] begin[{]
return[call[.resource, parameter[member[.context], member[.name], LambdaExpression(body=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), parameters=[])]]]
end[}]
END[}]
|
Keyword[static] Keyword[public] identifier[BagObject] identifier[resource] operator[SEP] identifier[Class] identifier[context] , identifier[String] identifier[name] operator[SEP] {
Keyword[return] identifier[resource] operator[SEP] identifier[context] , identifier[name] , operator[SEP] operator[SEP] operator[->] Other[null] operator[SEP] operator[SEP]
}
|
public LineStringTo toTransferObject(LineString input) {
LineStringTo result = new LineStringTo();
result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
result.setCoordinates(getPoints(input));
return result;
}
|
class class_name[name] begin[{]
method[toTransferObject, return_type[type[LineStringTo]], modifier[public], parameter[input]] begin[{]
local_variable[type[LineStringTo], result]
call[result.setCrs, parameter[call[GeoJsonTo.createCrsTo, parameter[binary_operation[literal["EPSG:"], +, call[input.getSRID, parameter[]]]]]]]
call[result.setCoordinates, parameter[call[.getPoints, parameter[member[.input]]]]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[LineStringTo] identifier[toTransferObject] operator[SEP] identifier[LineString] identifier[input] operator[SEP] {
identifier[LineStringTo] identifier[result] operator[=] Keyword[new] identifier[LineStringTo] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setCrs] operator[SEP] identifier[GeoJsonTo] operator[SEP] identifier[createCrsTo] operator[SEP] literal[String] operator[+] identifier[input] operator[SEP] identifier[getSRID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setCoordinates] operator[SEP] identifier[getPoints] operator[SEP] identifier[input] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Deprecated
public List<Membership> getMemberships(String projectKey)
throws RedmineException {
return transport.getChildEntries(Project.class, projectKey, Membership.class);
}
|
class class_name[name] begin[{]
method[getMemberships, return_type[type[List]], modifier[public], parameter[projectKey]] begin[{]
return[call[transport.getChildEntries, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Project, sub_type=None)), member[.projectKey], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Membership, sub_type=None))]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] identifier[List] operator[<] identifier[Membership] operator[>] identifier[getMemberships] operator[SEP] identifier[String] identifier[projectKey] operator[SEP] Keyword[throws] identifier[RedmineException] {
Keyword[return] identifier[transport] operator[SEP] identifier[getChildEntries] operator[SEP] identifier[Project] operator[SEP] Keyword[class] , identifier[projectKey] , identifier[Membership] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static double stringToDouble(String string) {
string = string.trim();
if (Checker.isDecimal(string)) {
return Double.parseDouble(string);
}
return -1;
}
|
class class_name[name] begin[{]
method[stringToDouble, return_type[type[double]], modifier[public static], parameter[string]] begin[{]
assign[member[.string], call[string.trim, parameter[]]]
if[call[Checker.isDecimal, parameter[member[.string]]]] begin[{]
return[call[Double.parseDouble, parameter[member[.string]]]]
else begin[{]
None
end[}]
return[literal[1]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] identifier[stringToDouble] operator[SEP] identifier[String] identifier[string] operator[SEP] {
identifier[string] operator[=] identifier[string] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Checker] operator[SEP] identifier[isDecimal] operator[SEP] identifier[string] operator[SEP] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[string] operator[SEP] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public static Builder forAuth(final String auth) {
// split with limit=2 to catch case where password contains a colon
final String[] authParams = Base64.decodeAsString(auth).split(":", 2);
if (authParams.length != 2) {
return builder();
}
return builder()
.username(authParams[0].trim())
.password(authParams[1].trim());
}
|
class class_name[name] begin[{]
method[forAuth, return_type[type[Builder]], modifier[public static], parameter[auth]] begin[{]
local_variable[type[String], authParams]
if[binary_operation[member[authParams.length], !=, literal[2]]] begin[{]
return[call[.builder, parameter[]]]
else begin[{]
None
end[}]
return[call[.builder, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Builder] identifier[forAuth] operator[SEP] Keyword[final] identifier[String] identifier[auth] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[authParams] operator[=] identifier[Base64] operator[SEP] identifier[decodeAsString] operator[SEP] identifier[auth] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[authParams] operator[SEP] identifier[length] operator[!=] Other[2] operator[SEP] {
Keyword[return] identifier[builder] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[username] operator[SEP] identifier[authParams] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[password] operator[SEP] identifier[authParams] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public com.google.api.ads.adwords.axis.v201809.cm.UniversalAppBiddingStrategyGoalType getUniversalAppBiddingStrategyGoalType() {
return universalAppBiddingStrategyGoalType;
}
|
class class_name[name] begin[{]
method[getUniversalAppBiddingStrategyGoalType, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.universalAppBiddingStrategyGoalType]]
end[}]
END[}]
|
Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[UniversalAppBiddingStrategyGoalType] identifier[getUniversalAppBiddingStrategyGoalType] operator[SEP] operator[SEP] {
Keyword[return] identifier[universalAppBiddingStrategyGoalType] operator[SEP]
}
|
public void endElement(String uri, String localName, String qName)
throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#endElement: " + qName);
if (m_contentHandler != null)
{
m_contentHandler.endElement(uri, localName, qName);
}
}
|
class class_name[name] begin[{]
method[endElement, return_type[void], modifier[public], parameter[uri, localName, qName]] begin[{]
if[member[.DEBUG]] begin[{]
call[System.out.println, parameter[binary_operation[literal["TransformerHandlerImpl#endElement: "], +, member[.qName]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_contentHandler], !=, literal[null]]] begin[{]
call[m_contentHandler.endElement, parameter[member[.uri], member[.localName], member[.qName]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[endElement] operator[SEP] identifier[String] identifier[uri] , identifier[String] identifier[localName] , identifier[String] identifier[qName] operator[SEP] Keyword[throws] identifier[SAXException] {
Keyword[if] operator[SEP] identifier[DEBUG] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[qName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_contentHandler] operator[!=] Other[null] operator[SEP] {
identifier[m_contentHandler] operator[SEP] identifier[endElement] operator[SEP] identifier[uri] , identifier[localName] , identifier[qName] operator[SEP] operator[SEP]
}
}
|
public ServiceFuture<UserInner> getPublishingUserAsync(final ServiceCallback<UserInner> serviceCallback) {
return ServiceFuture.fromResponse(getPublishingUserWithServiceResponseAsync(), serviceCallback);
}
|
class class_name[name] begin[{]
method[getPublishingUserAsync, return_type[type[ServiceFuture]], modifier[public], parameter[serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.getPublishingUserWithServiceResponseAsync, parameter[]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[UserInner] operator[>] identifier[getPublishingUserAsync] operator[SEP] Keyword[final] identifier[ServiceCallback] operator[<] identifier[UserInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[getPublishingUserWithServiceResponseAsync] operator[SEP] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private void countClassAccess(final @DottedClassName String calledClass) {
if (calledClass.equals(clsName) || isAssociatedClass(calledClass)) {
if (getPrevOpcode(1) != Const.ALOAD_0) {
thisClsAccessCount++;
}
} else {
String calledPackage = SignatureUtils.getPackageName(calledClass);
if (SignatureUtils.similarPackages(calledPackage, packageName, 2) && !generalPurpose(calledClass)) {
BitSet lineNumbers = clsAccessCount.get(calledClass);
if (lineNumbers == null) {
lineNumbers = new BitSet();
addLineNumber(lineNumbers);
clsAccessCount.put(calledClass, lineNumbers);
} else {
addLineNumber(lineNumbers);
}
}
}
}
|
class class_name[name] begin[{]
method[countClassAccess, return_type[void], modifier[private], parameter[calledClass]] begin[{]
if[binary_operation[call[calledClass.equals, parameter[member[.clsName]]], ||, call[.isAssociatedClass, parameter[member[.calledClass]]]]] begin[{]
if[binary_operation[call[.getPrevOpcode, parameter[literal[1]]], !=, member[Const.ALOAD_0]]] begin[{]
member[.thisClsAccessCount]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[String], calledPackage]
if[binary_operation[call[SignatureUtils.similarPackages, parameter[member[.calledPackage], member[.packageName], literal[2]]], &&, call[.generalPurpose, parameter[member[.calledClass]]]]] begin[{]
local_variable[type[BitSet], lineNumbers]
if[binary_operation[member[.lineNumbers], ==, literal[null]]] begin[{]
assign[member[.lineNumbers], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BitSet, sub_type=None))]
call[.addLineNumber, parameter[member[.lineNumbers]]]
call[clsAccessCount.put, parameter[member[.calledClass], member[.lineNumbers]]]
else begin[{]
call[.addLineNumber, parameter[member[.lineNumbers]]]
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[countClassAccess] operator[SEP] Keyword[final] annotation[@] identifier[DottedClassName] identifier[String] identifier[calledClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[calledClass] operator[SEP] identifier[equals] operator[SEP] identifier[clsName] operator[SEP] operator[||] identifier[isAssociatedClass] operator[SEP] identifier[calledClass] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getPrevOpcode] operator[SEP] Other[1] operator[SEP] operator[!=] identifier[Const] operator[SEP] identifier[ALOAD_0] operator[SEP] {
identifier[thisClsAccessCount] operator[++] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[calledPackage] operator[=] identifier[SignatureUtils] operator[SEP] identifier[getPackageName] operator[SEP] identifier[calledClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[SignatureUtils] operator[SEP] identifier[similarPackages] operator[SEP] identifier[calledPackage] , identifier[packageName] , Other[2] operator[SEP] operator[&&] operator[!] identifier[generalPurpose] operator[SEP] identifier[calledClass] operator[SEP] operator[SEP] {
identifier[BitSet] identifier[lineNumbers] operator[=] identifier[clsAccessCount] operator[SEP] identifier[get] operator[SEP] identifier[calledClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lineNumbers] operator[==] Other[null] operator[SEP] {
identifier[lineNumbers] operator[=] Keyword[new] identifier[BitSet] operator[SEP] operator[SEP] operator[SEP] identifier[addLineNumber] operator[SEP] identifier[lineNumbers] operator[SEP] operator[SEP] identifier[clsAccessCount] operator[SEP] identifier[put] operator[SEP] identifier[calledClass] , identifier[lineNumbers] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[addLineNumber] operator[SEP] identifier[lineNumbers] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public StreamImpl openReadImpl() throws IOException
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
}
InputStream is = loader.getResourceAsStream(getTrimPath());
if (is == null) {
throw new FileNotFoundException(getURL());
}
return new VfsStreamOld(is, null);
}
|
class class_name[name] begin[{]
method[openReadImpl, return_type[type[StreamImpl]], modifier[public], parameter[]] begin[{]
local_variable[type[ClassLoader], loader]
if[binary_operation[member[.loader], ==, literal[null]]] begin[{]
assign[member[.loader], call[ClassLoader.getSystemClassLoader, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[InputStream], is]
if[binary_operation[member[.is], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VfsStreamOld, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[StreamImpl] identifier[openReadImpl] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ClassLoader] identifier[loader] 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[loader] operator[==] Other[null] operator[SEP] {
identifier[loader] operator[=] identifier[ClassLoader] operator[SEP] identifier[getSystemClassLoader] operator[SEP] operator[SEP] operator[SEP]
}
identifier[InputStream] identifier[is] operator[=] identifier[loader] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[getTrimPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[is] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] identifier[getURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[VfsStreamOld] operator[SEP] identifier[is] , Other[null] operator[SEP] operator[SEP]
}
|
public CmsJspImageBean createRatioVariation(String ratioStr) {
CmsJspImageBean result = null;
try {
int i = ratioStr.indexOf('-');
if (i > 0) {
ratioStr = ratioStr.replace(',', '.');
double ratioW = Double.valueOf(ratioStr.substring(0, i)).doubleValue();
double ratioH = Double.valueOf(ratioStr.substring(i + 1)).doubleValue();
int targetWidth, targetHeight;
double ratioFactorW = getScaler().getWidth() / ratioW;
targetWidth = getScaler().getWidth();
targetHeight = (int)Math.round(ratioH * ratioFactorW);
if (targetHeight > getScaler().getHeight()) {
double ratioFactorH = getScaler().getHeight() / ratioH;
targetWidth = (int)Math.round(ratioW * ratioFactorH);
targetHeight = getScaler().getHeight();
}
CmsImageScaler targetScaler = createVariation(
getWidth(),
getHeight(),
getBaseScaler(),
targetWidth,
targetHeight,
getQuality());
if (targetScaler != null) {
result = createVariation(targetScaler);
result.m_ratio = ratioStr;
result.m_ratioHeightPercentage = calcRatioHeightPercentage(ratioW, ratioH);
}
}
} catch (NumberFormatException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(String.format("Illegal ratio format: '%s' not usable for image scaling", ratioStr));
}
}
return result;
}
|
class class_name[name] begin[{]
method[createRatioVariation, return_type[type[CmsJspImageBean]], modifier[public], parameter[ratioStr]] begin[{]
local_variable[type[CmsJspImageBean], result]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=ratioStr, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ratioStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=','), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=replace, postfix_operators=[], prefix_operators=[], qualifier=ratioStr, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=ratioStr, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[MethodInvocation(arguments=[], member=doubleValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ratioW)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=ratioStr, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[MethodInvocation(arguments=[], member=doubleValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ratioH)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=targetWidth), VariableDeclarator(dimensions=[], initializer=None, name=targetHeight)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=ratioW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=ratioFactorW)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=targetWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=targetHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=ratioH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ratioFactorW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], member=round, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=targetHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getHeight, 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=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getHeight, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=ratioH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=ratioFactorH)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=targetWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=ratioW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ratioFactorH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], member=round, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=targetHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getHeight, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getBaseScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=targetWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getQuality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=createVariation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=targetScaler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsImageScaler, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=targetScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=targetScaler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createVariation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_ratio, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), type==, value=MemberReference(member=ratioStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_ratioHeightPercentage, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ratioW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ratioH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=calcRatioHeightPercentage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]))]))], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal ratio format: '%s' not usable for image scaling"), MemberReference(member=ratioStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[CmsJspImageBean] identifier[createRatioVariation] operator[SEP] identifier[String] identifier[ratioStr] operator[SEP] {
identifier[CmsJspImageBean] identifier[result] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[int] identifier[i] operator[=] identifier[ratioStr] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[ratioStr] operator[=] identifier[ratioStr] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[double] identifier[ratioW] operator[=] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[ratioStr] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[ratioH] operator[=] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[ratioStr] operator[SEP] identifier[substring] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[targetWidth] , identifier[targetHeight] operator[SEP] Keyword[double] identifier[ratioFactorW] operator[=] identifier[getScaler] operator[SEP] operator[SEP] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[/] identifier[ratioW] operator[SEP] identifier[targetWidth] operator[=] identifier[getScaler] operator[SEP] operator[SEP] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] identifier[targetHeight] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[ratioH] operator[*] identifier[ratioFactorW] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetHeight] operator[>] identifier[getScaler] operator[SEP] operator[SEP] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[ratioFactorH] operator[=] identifier[getScaler] operator[SEP] operator[SEP] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[/] identifier[ratioH] operator[SEP] identifier[targetWidth] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[ratioW] operator[*] identifier[ratioFactorH] operator[SEP] operator[SEP] identifier[targetHeight] operator[=] identifier[getScaler] operator[SEP] operator[SEP] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP]
}
identifier[CmsImageScaler] identifier[targetScaler] operator[=] identifier[createVariation] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[getHeight] operator[SEP] operator[SEP] , identifier[getBaseScaler] operator[SEP] operator[SEP] , identifier[targetWidth] , identifier[targetHeight] , identifier[getQuality] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetScaler] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[createVariation] operator[SEP] identifier[targetScaler] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[m_ratio] operator[=] identifier[ratioStr] operator[SEP] identifier[result] operator[SEP] identifier[m_ratioHeightPercentage] operator[=] identifier[calcRatioHeightPercentage] operator[SEP] identifier[ratioW] , identifier[ratioH] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[ratioStr] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static String uniquePath(String name, String ext) throws IOException
{
File file = File.createTempFile(name, ext);
String path = file.getAbsolutePath();
file.delete();
return path;
}
|
class class_name[name] begin[{]
method[uniquePath, return_type[type[String]], modifier[public static], parameter[name, ext]] begin[{]
local_variable[type[File], file]
local_variable[type[String], path]
call[file.delete, parameter[]]
return[member[.path]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[uniquePath] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[ext] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] identifier[file] operator[=] identifier[File] operator[SEP] identifier[createTempFile] operator[SEP] identifier[name] , identifier[ext] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] identifier[file] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP]
}
|
public String[] dev_inform(final DeviceProxy deviceProxy) throws DevFailed {
checkIfTaco(deviceProxy, "dev_inform");
if (deviceProxy.taco_device == null && deviceProxy.devname != null) {
build_connection(deviceProxy);
}
return deviceProxy.taco_device.dev_inform();
}
|
class class_name[name] begin[{]
method[dev_inform, return_type[type[String]], modifier[public], parameter[deviceProxy]] begin[{]
call[.checkIfTaco, parameter[member[.deviceProxy], literal["dev_inform"]]]
if[binary_operation[binary_operation[member[deviceProxy.taco_device], ==, literal[null]], &&, binary_operation[member[deviceProxy.devname], !=, literal[null]]]] begin[{]
call[.build_connection, parameter[member[.deviceProxy]]]
else begin[{]
None
end[}]
return[call[deviceProxy.taco_device.dev_inform, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[dev_inform] operator[SEP] Keyword[final] identifier[DeviceProxy] identifier[deviceProxy] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[checkIfTaco] operator[SEP] identifier[deviceProxy] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deviceProxy] operator[SEP] identifier[taco_device] operator[==] Other[null] operator[&&] identifier[deviceProxy] operator[SEP] identifier[devname] operator[!=] Other[null] operator[SEP] {
identifier[build_connection] operator[SEP] identifier[deviceProxy] operator[SEP] operator[SEP]
}
Keyword[return] identifier[deviceProxy] operator[SEP] identifier[taco_device] operator[SEP] identifier[dev_inform] operator[SEP] operator[SEP] operator[SEP]
}
|
public void init() {
initConfigurators();
configuratorsBeforeInit();
initHistoryLevel();
initExpressionManager();
if (usingRelationalDatabase) {
initDataSource();
}
initAgendaFactory();
initHelpers();
initVariableTypes();
initBeans();
initScriptingEngines();
initClock();
initBusinessCalendarManager();
initCommandContextFactory();
initTransactionContextFactory();
initCommandExecutors();
initServices();
initIdGenerator();
initBehaviorFactory();
initListenerFactory();
initBpmnParser();
initProcessDefinitionCache();
initProcessDefinitionInfoCache();
initKnowledgeBaseCache();
initJobHandlers();
initJobManager();
initAsyncExecutor();
initTransactionFactory();
if (usingRelationalDatabase) {
initSqlSessionFactory();
}
initSessionFactories();
initDataManagers();
initEntityManagers();
initHistoryManager();
initJpa();
initDeployers();
initDelegateInterceptor();
initEventHandlers();
initFailedJobCommandFactory();
initEventDispatcher();
initProcessValidator();
initDatabaseEventLogging();
configuratorsAfterInit();
}
|
class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[]] begin[{]
call[.initConfigurators, parameter[]]
call[.configuratorsBeforeInit, parameter[]]
call[.initHistoryLevel, parameter[]]
call[.initExpressionManager, parameter[]]
if[member[.usingRelationalDatabase]] begin[{]
call[.initDataSource, parameter[]]
else begin[{]
None
end[}]
call[.initAgendaFactory, parameter[]]
call[.initHelpers, parameter[]]
call[.initVariableTypes, parameter[]]
call[.initBeans, parameter[]]
call[.initScriptingEngines, parameter[]]
call[.initClock, parameter[]]
call[.initBusinessCalendarManager, parameter[]]
call[.initCommandContextFactory, parameter[]]
call[.initTransactionContextFactory, parameter[]]
call[.initCommandExecutors, parameter[]]
call[.initServices, parameter[]]
call[.initIdGenerator, parameter[]]
call[.initBehaviorFactory, parameter[]]
call[.initListenerFactory, parameter[]]
call[.initBpmnParser, parameter[]]
call[.initProcessDefinitionCache, parameter[]]
call[.initProcessDefinitionInfoCache, parameter[]]
call[.initKnowledgeBaseCache, parameter[]]
call[.initJobHandlers, parameter[]]
call[.initJobManager, parameter[]]
call[.initAsyncExecutor, parameter[]]
call[.initTransactionFactory, parameter[]]
if[member[.usingRelationalDatabase]] begin[{]
call[.initSqlSessionFactory, parameter[]]
else begin[{]
None
end[}]
call[.initSessionFactories, parameter[]]
call[.initDataManagers, parameter[]]
call[.initEntityManagers, parameter[]]
call[.initHistoryManager, parameter[]]
call[.initJpa, parameter[]]
call[.initDeployers, parameter[]]
call[.initDelegateInterceptor, parameter[]]
call[.initEventHandlers, parameter[]]
call[.initFailedJobCommandFactory, parameter[]]
call[.initEventDispatcher, parameter[]]
call[.initProcessValidator, parameter[]]
call[.initDatabaseEventLogging, parameter[]]
call[.configuratorsAfterInit, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[init] operator[SEP] operator[SEP] {
identifier[initConfigurators] operator[SEP] operator[SEP] operator[SEP] identifier[configuratorsBeforeInit] operator[SEP] operator[SEP] operator[SEP] identifier[initHistoryLevel] operator[SEP] operator[SEP] operator[SEP] identifier[initExpressionManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[usingRelationalDatabase] operator[SEP] {
identifier[initDataSource] operator[SEP] operator[SEP] operator[SEP]
}
identifier[initAgendaFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initHelpers] operator[SEP] operator[SEP] operator[SEP] identifier[initVariableTypes] operator[SEP] operator[SEP] operator[SEP] identifier[initBeans] operator[SEP] operator[SEP] operator[SEP] identifier[initScriptingEngines] operator[SEP] operator[SEP] operator[SEP] identifier[initClock] operator[SEP] operator[SEP] operator[SEP] identifier[initBusinessCalendarManager] operator[SEP] operator[SEP] operator[SEP] identifier[initCommandContextFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initTransactionContextFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initCommandExecutors] operator[SEP] operator[SEP] operator[SEP] identifier[initServices] operator[SEP] operator[SEP] operator[SEP] identifier[initIdGenerator] operator[SEP] operator[SEP] operator[SEP] identifier[initBehaviorFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initListenerFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initBpmnParser] operator[SEP] operator[SEP] operator[SEP] identifier[initProcessDefinitionCache] operator[SEP] operator[SEP] operator[SEP] identifier[initProcessDefinitionInfoCache] operator[SEP] operator[SEP] operator[SEP] identifier[initKnowledgeBaseCache] operator[SEP] operator[SEP] operator[SEP] identifier[initJobHandlers] operator[SEP] operator[SEP] operator[SEP] identifier[initJobManager] operator[SEP] operator[SEP] operator[SEP] identifier[initAsyncExecutor] operator[SEP] operator[SEP] operator[SEP] identifier[initTransactionFactory] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[usingRelationalDatabase] operator[SEP] {
identifier[initSqlSessionFactory] operator[SEP] operator[SEP] operator[SEP]
}
identifier[initSessionFactories] operator[SEP] operator[SEP] operator[SEP] identifier[initDataManagers] operator[SEP] operator[SEP] operator[SEP] identifier[initEntityManagers] operator[SEP] operator[SEP] operator[SEP] identifier[initHistoryManager] operator[SEP] operator[SEP] operator[SEP] identifier[initJpa] operator[SEP] operator[SEP] operator[SEP] identifier[initDeployers] operator[SEP] operator[SEP] operator[SEP] identifier[initDelegateInterceptor] operator[SEP] operator[SEP] operator[SEP] identifier[initEventHandlers] operator[SEP] operator[SEP] operator[SEP] identifier[initFailedJobCommandFactory] operator[SEP] operator[SEP] operator[SEP] identifier[initEventDispatcher] operator[SEP] operator[SEP] operator[SEP] identifier[initProcessValidator] operator[SEP] operator[SEP] operator[SEP] identifier[initDatabaseEventLogging] operator[SEP] operator[SEP] operator[SEP] identifier[configuratorsAfterInit] operator[SEP] operator[SEP] operator[SEP]
}
|
@Bean
public ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new WebServlet());
servletRegistrationBean.addUrlMappings("/h2/*");
return servletRegistrationBean;
}
|
class class_name[name] begin[{]
method[h2servletRegistration, return_type[type[ServletRegistrationBean]], modifier[public], parameter[]] begin[{]
local_variable[type[ServletRegistrationBean], servletRegistrationBean]
call[servletRegistrationBean.addUrlMappings, parameter[literal["/h2/*"]]]
return[member[.servletRegistrationBean]]
end[}]
END[}]
|
annotation[@] identifier[Bean] Keyword[public] identifier[ServletRegistrationBean] identifier[h2servletRegistration] operator[SEP] operator[SEP] {
identifier[ServletRegistrationBean] identifier[servletRegistrationBean] operator[=] Keyword[new] identifier[ServletRegistrationBean] operator[SEP] Keyword[new] identifier[WebServlet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[servletRegistrationBean] operator[SEP] identifier[addUrlMappings] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[servletRegistrationBean] operator[SEP]
}
|
@Override
public boolean isValid() {
BigInteger maxNumberOfEdges = BigInteger.valueOf(getNumberOfNodes());
maxNumberOfEdges = maxNumberOfEdges.multiply(maxNumberOfEdges.subtract(BigInteger.ONE));
maxNumberOfEdges = maxNumberOfEdges.divide(BigInteger.valueOf(2));
return super.isValid() && numberOfEdges > 0 && BigInteger.valueOf(numberOfEdges).compareTo(maxNumberOfEdges) < 1;
}
|
class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[BigInteger], maxNumberOfEdges]
assign[member[.maxNumberOfEdges], call[maxNumberOfEdges.multiply, parameter[call[maxNumberOfEdges.subtract, parameter[member[BigInteger.ONE]]]]]]
assign[member[.maxNumberOfEdges], call[maxNumberOfEdges.divide, parameter[call[BigInteger.valueOf, parameter[literal[2]]]]]]
return[binary_operation[binary_operation[SuperMethodInvocation(arguments=[], member=isValid, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), &&, binary_operation[member[.numberOfEdges], >, literal[0]]], &&, binary_operation[call[BigInteger.valueOf, parameter[member[.numberOfEdges]]], <, literal[1]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isValid] operator[SEP] operator[SEP] {
identifier[BigInteger] identifier[maxNumberOfEdges] operator[=] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[getNumberOfNodes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[maxNumberOfEdges] operator[=] identifier[maxNumberOfEdges] operator[SEP] identifier[multiply] operator[SEP] identifier[maxNumberOfEdges] operator[SEP] identifier[subtract] operator[SEP] identifier[BigInteger] operator[SEP] identifier[ONE] operator[SEP] operator[SEP] operator[SEP] identifier[maxNumberOfEdges] operator[=] identifier[maxNumberOfEdges] operator[SEP] identifier[divide] operator[SEP] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[&&] identifier[numberOfEdges] operator[>] Other[0] operator[&&] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[numberOfEdges] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[maxNumberOfEdges] operator[SEP] operator[<] Other[1] operator[SEP]
}
|
public synchronized T get ()
{
while (_count == 0) {
try { wait(); } catch (InterruptedException e) {}
}
// pull the object off, and clear our reference to it
T retval = _items[_start];
_items[_start] = null;
_start = (_start + 1) % _size;
_count--;
// if we are only filling 1/8th of the space, shrink by half
if ((_size > MIN_SHRINK_SIZE) && (_size > _suggestedSize) &&
(_count < (_size >> 3))) shrink();
return retval;
}
|
class class_name[name] begin[{]
method[get, return_type[type[T]], modifier[synchronized public], parameter[]] begin[{]
while[binary_operation[member[._count], ==, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, 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=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
local_variable[type[T], retval]
assign[member[._items], literal[null]]
assign[member[._start], binary_operation[binary_operation[member[._start], +, literal[1]], %, member[._size]]]
member[._count]
if[binary_operation[binary_operation[binary_operation[member[._size], >, member[.MIN_SHRINK_SIZE]], &&, binary_operation[member[._size], >, member[._suggestedSize]]], &&, binary_operation[member[._count], <, binary_operation[member[._size], >>, literal[3]]]]] begin[{]
call[.shrink, parameter[]]
else begin[{]
None
end[}]
return[member[.retval]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] identifier[T] identifier[get] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[_count] operator[==] Other[0] operator[SEP] {
Keyword[try] {
identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
}
identifier[T] identifier[retval] operator[=] identifier[_items] operator[SEP] identifier[_start] operator[SEP] operator[SEP] identifier[_items] operator[SEP] identifier[_start] operator[SEP] operator[=] Other[null] operator[SEP] identifier[_start] operator[=] operator[SEP] identifier[_start] operator[+] Other[1] operator[SEP] operator[%] identifier[_size] operator[SEP] identifier[_count] operator[--] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[_size] operator[>] identifier[MIN_SHRINK_SIZE] operator[SEP] operator[&&] operator[SEP] identifier[_size] operator[>] identifier[_suggestedSize] operator[SEP] operator[&&] operator[SEP] identifier[_count] operator[<] operator[SEP] identifier[_size] operator[>] operator[>] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[shrink] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[retval] operator[SEP]
}
|
protected double splitThresholdSq( Point2D_I32 a , Point2D_I32 b ) {
return Math.max(2,a.distance2(b)* toleranceFractionSq);
}
|
class class_name[name] begin[{]
method[splitThresholdSq, return_type[type[double]], modifier[protected], parameter[a, b]] begin[{]
return[call[Math.max, parameter[literal[2], binary_operation[call[a.distance2, parameter[member[.b]]], *, member[.toleranceFractionSq]]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[double] identifier[splitThresholdSq] operator[SEP] identifier[Point2D_I32] identifier[a] , identifier[Point2D_I32] identifier[b] operator[SEP] {
Keyword[return] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[2] , identifier[a] operator[SEP] identifier[distance2] operator[SEP] identifier[b] operator[SEP] operator[*] identifier[toleranceFractionSq] operator[SEP] operator[SEP]
}
|
public OperationStatus updateRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) {
return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[updateRegexEntityRole, return_type[type[OperationStatus]], modifier[public], parameter[appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter]] begin[{]
return[call[.updateRegexEntityRoleWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.entityId], member[.roleId], member[.updateRegexEntityRoleOptionalParameter]]]]
end[}]
END[}]
|
Keyword[public] identifier[OperationStatus] identifier[updateRegexEntityRole] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[UUID] identifier[entityId] , identifier[UUID] identifier[roleId] , identifier[UpdateRegexEntityRoleOptionalParameter] identifier[updateRegexEntityRoleOptionalParameter] operator[SEP] {
Keyword[return] identifier[updateRegexEntityRoleWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[entityId] , identifier[roleId] , identifier[updateRegexEntityRoleOptionalParameter] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
static public Variable findVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) {
for (Variable v : ds.getVariables()) {
String haveValue = ds.findAttValueIgnoreCase(v, attName, null);
if ((haveValue != null) && haveValue.equals(attValue))
return v;
}
// descend into structures
for (Variable v : ds.getVariables()) {
if (v instanceof Structure) {
Variable vn = findVariableWithAttributeValue((Structure) v, attName, attValue);
if (null != vn) return vn;
}
}
return null;
}
|
class class_name[name] begin[{]
method[findVariableWithAttributeValue, return_type[type[Variable]], modifier[public static], parameter[ds, attName, attValue]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=findAttValueIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=ds, selectors=[], type_arguments=None), name=haveValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=haveValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=attValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=haveValue, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getVariables, postfix_operators=[], prefix_operators=[], qualifier=ds, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variable, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Structure, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Structure, sub_type=None)), MemberReference(member=attName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findVariableWithAttributeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=vn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=vn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=vn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getVariables, postfix_operators=[], prefix_operators=[], qualifier=ds, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variable, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[static] Keyword[public] identifier[Variable] identifier[findVariableWithAttributeValue] operator[SEP] identifier[NetcdfDataset] identifier[ds] , identifier[String] identifier[attName] , identifier[String] identifier[attValue] operator[SEP] {
Keyword[for] operator[SEP] identifier[Variable] identifier[v] operator[:] identifier[ds] operator[SEP] identifier[getVariables] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[haveValue] operator[=] identifier[ds] operator[SEP] identifier[findAttValueIgnoreCase] operator[SEP] identifier[v] , identifier[attName] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[haveValue] operator[!=] Other[null] operator[SEP] operator[&&] identifier[haveValue] operator[SEP] identifier[equals] operator[SEP] identifier[attValue] operator[SEP] operator[SEP] Keyword[return] identifier[v] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Variable] identifier[v] operator[:] identifier[ds] operator[SEP] identifier[getVariables] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[v] Keyword[instanceof] identifier[Structure] operator[SEP] {
identifier[Variable] identifier[vn] operator[=] identifier[findVariableWithAttributeValue] operator[SEP] operator[SEP] identifier[Structure] operator[SEP] identifier[v] , identifier[attName] , identifier[attValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[vn] operator[SEP] Keyword[return] identifier[vn] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void setErrors(java.util.Collection<BatchDeleteImportDataError> errors) {
if (errors == null) {
this.errors = null;
return;
}
this.errors = new java.util.ArrayList<BatchDeleteImportDataError>(errors);
}
|
class class_name[name] begin[{]
method[setErrors, return_type[void], modifier[public], parameter[errors]] begin[{]
if[binary_operation[member[.errors], ==, literal[null]]] begin[{]
assign[THIS[member[None.errors]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.errors]], ClassCreator(arguments=[MemberReference(member=errors, 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=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BatchDeleteImportDataError, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setErrors] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[BatchDeleteImportDataError] operator[>] identifier[errors] operator[SEP] {
Keyword[if] operator[SEP] identifier[errors] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[errors] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[errors] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[BatchDeleteImportDataError] operator[>] operator[SEP] identifier[errors] operator[SEP] operator[SEP]
}
|
public void streamResult(OutputStream os,
HeadersAmp headers,
String address,
long qId,
int sequence,
List<Object> values,
Throwable exn,
boolean isComplete)
throws IOException
{
init(os);
OutH3 out = _out;
if (out == null) {
return;
}
if (log.isLoggable(_level)) {
log.log(_level, "hamp-stream-result-w " + values + "," + isComplete + " (in " + this + ")"
+ "\n {id:" + qId + " to:" + address + ", " + headers + "," + os + "}");
}
try {
out.writeLong(MessageTypeHamp.STREAM_RESULT.ordinal());
writeHeaders(out, headers);
writeToAddress(out, address);
out.writeLong(qId);
out.writeLong(sequence);
out.writeObject(values);
out.writeObject(exn);
out.writeBoolean(isComplete);
//out.flushBuffer();
out.flush();
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
throw e;
}
}
|
class class_name[name] begin[{]
method[streamResult, return_type[void], modifier[public], parameter[os, headers, address, qId, sequence, values, exn, isComplete]] begin[{]
call[.init, parameter[member[.os]]]
local_variable[type[OutH3], out]
if[binary_operation[member[.out], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[call[log.isLoggable, parameter[member[._level]]]] begin[{]
call[log.log, parameter[member[._level], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["hamp-stream-result-w "], +, member[.values]], +, literal[","]], +, member[.isComplete]], +, literal[" (in "]], +, THIS[]], +, literal[")"]], +, literal["\n {id:"]], +, member[.qId]], +, literal[" to:"]], +, member[.address]], +, literal[", "]], +, member[.headers]], +, literal[","]], +, member[.os]], +, literal["}"]]]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=MessageTypeHamp.STREAM_RESULT, selectors=[], type_arguments=None)], member=writeLong, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeToAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=qId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeLong, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeLong, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=exn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=isComplete, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeBoolean, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[streamResult] operator[SEP] identifier[OutputStream] identifier[os] , identifier[HeadersAmp] identifier[headers] , identifier[String] identifier[address] , Keyword[long] identifier[qId] , Keyword[int] identifier[sequence] , identifier[List] operator[<] identifier[Object] operator[>] identifier[values] , identifier[Throwable] identifier[exn] , Keyword[boolean] identifier[isComplete] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[init] operator[SEP] identifier[os] operator[SEP] operator[SEP] identifier[OutH3] identifier[out] operator[=] identifier[_out] operator[SEP] Keyword[if] operator[SEP] identifier[out] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[_level] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[_level] , literal[String] operator[+] identifier[values] operator[+] literal[String] operator[+] identifier[isComplete] operator[+] literal[String] operator[+] Keyword[this] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[qId] operator[+] literal[String] operator[+] identifier[address] operator[+] literal[String] operator[+] identifier[headers] operator[+] literal[String] operator[+] identifier[os] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[out] operator[SEP] identifier[writeLong] operator[SEP] identifier[MessageTypeHamp] operator[SEP] identifier[STREAM_RESULT] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writeHeaders] operator[SEP] identifier[out] , identifier[headers] operator[SEP] operator[SEP] identifier[writeToAddress] operator[SEP] identifier[out] , identifier[address] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeLong] operator[SEP] identifier[qId] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeLong] operator[SEP] identifier[sequence] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeObject] operator[SEP] identifier[values] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeObject] operator[SEP] identifier[exn] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[isComplete] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
public static String convert32(String s)
{
try {
byte[] bytes = s.getBytes();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
bytes = md.digest();
int j = bytes.length;
char[] chars = new char[j * 2];
int k = 0;
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
chars[k++] = hexChars[b >>> 4 & 0xf];
chars[k++] = hexChars[b & 0xf];
}
return new String(chars);
}
catch (Exception e){
return null;
}
}
|
class class_name[name] begin[{]
method[convert32, return_type[type[String]], modifier[public static], parameter[s]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=bytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="MD5")], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=MessageDigest, selectors=[], type_arguments=None), name=md)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MessageDigest, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=digest, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bytes, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=*)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=char)), name=chars)], modifiers=set(), type=BasicType(dimensions=[None], name=char)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=chars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=hexChars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xf), operator=&))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=chars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=hexChars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xf), operator=&))])), 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=bytes, 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=ClassCreator(arguments=[MemberReference(member=chars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), 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[String] identifier[convert32] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[s] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] identifier[MessageDigest] identifier[md] operator[=] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[md] operator[SEP] identifier[update] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[md] operator[SEP] identifier[digest] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[bytes] operator[SEP] identifier[length] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[chars] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[j] operator[*] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[k] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[bytes] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[byte] identifier[b] operator[=] identifier[bytes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[chars] operator[SEP] identifier[k] operator[++] operator[SEP] operator[=] identifier[hexChars] operator[SEP] identifier[b] operator[>] operator[>] operator[>] Other[4] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[chars] operator[SEP] identifier[k] operator[++] operator[SEP] operator[=] identifier[hexChars] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[chars] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public int setDateTime(java.util.Date date, boolean bDisplayOption, int moveMode)
{
if (date != null)
{
m_calendar.setTime(date);
m_calendar.set(Calendar.YEAR, DBConstants.FIRST_YEAR);
m_calendar.set(Calendar.MONTH, Calendar.JANUARY);
m_calendar.set(Calendar.DATE, 1);
date = m_calendar.getTime();
return this.setValue(date.getTime(), bDisplayOption, moveMode);
}
else
return this.setData(null, bDisplayOption, moveMode);
}
|
class class_name[name] begin[{]
method[setDateTime, return_type[type[int]], modifier[public], parameter[date, bDisplayOption, moveMode]] begin[{]
if[binary_operation[member[.date], !=, literal[null]]] begin[{]
call[m_calendar.setTime, parameter[member[.date]]]
call[m_calendar.set, parameter[member[Calendar.YEAR], member[DBConstants.FIRST_YEAR]]]
call[m_calendar.set, parameter[member[Calendar.MONTH], member[Calendar.JANUARY]]]
call[m_calendar.set, parameter[member[Calendar.DATE], literal[1]]]
assign[member[.date], call[m_calendar.getTime, parameter[]]]
return[THIS[call[None.setValue, parameter[call[date.getTime, parameter[]], member[.bDisplayOption], member[.moveMode]]]]]
else begin[{]
return[THIS[call[None.setData, parameter[literal[null], member[.bDisplayOption], member[.moveMode]]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[setDateTime] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Date] identifier[date] , Keyword[boolean] identifier[bDisplayOption] , Keyword[int] identifier[moveMode] operator[SEP] {
Keyword[if] operator[SEP] identifier[date] operator[!=] Other[null] operator[SEP] {
identifier[m_calendar] operator[SEP] identifier[setTime] operator[SEP] identifier[date] operator[SEP] operator[SEP] identifier[m_calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] , identifier[DBConstants] operator[SEP] identifier[FIRST_YEAR] operator[SEP] operator[SEP] identifier[m_calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , identifier[Calendar] operator[SEP] identifier[JANUARY] operator[SEP] operator[SEP] identifier[m_calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DATE] , Other[1] operator[SEP] operator[SEP] identifier[date] operator[=] identifier[m_calendar] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[setValue] operator[SEP] identifier[date] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] , identifier[bDisplayOption] , identifier[moveMode] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[return] Keyword[this] operator[SEP] identifier[setData] operator[SEP] Other[null] , identifier[bDisplayOption] , identifier[moveMode] operator[SEP] operator[SEP]
}
|
private void setDefaultSerializeSettings() {
if (!serializeSettings.containsKey(ELEMENT_CONTENT_WHITESPACE)) {
serializeSettings.put(ELEMENT_CONTENT_WHITESPACE, true);
}
if (!serializeSettings.containsKey(SPLIT_CDATA_SECTIONS)) {
serializeSettings.put(SPLIT_CDATA_SECTIONS, false);
}
if (!serializeSettings.containsKey(FORMAT_PRETTY_PRINT)) {
serializeSettings.put(FORMAT_PRETTY_PRINT, true);
}
if (!serializeSettings.containsKey(XML_DECLARATION)) {
serializeSettings.put(XML_DECLARATION, true);
}
}
|
class class_name[name] begin[{]
method[setDefaultSerializeSettings, return_type[void], modifier[private], parameter[]] begin[{]
if[call[serializeSettings.containsKey, parameter[member[.ELEMENT_CONTENT_WHITESPACE]]]] begin[{]
call[serializeSettings.put, parameter[member[.ELEMENT_CONTENT_WHITESPACE], literal[true]]]
else begin[{]
None
end[}]
if[call[serializeSettings.containsKey, parameter[member[.SPLIT_CDATA_SECTIONS]]]] begin[{]
call[serializeSettings.put, parameter[member[.SPLIT_CDATA_SECTIONS], literal[false]]]
else begin[{]
None
end[}]
if[call[serializeSettings.containsKey, parameter[member[.FORMAT_PRETTY_PRINT]]]] begin[{]
call[serializeSettings.put, parameter[member[.FORMAT_PRETTY_PRINT], literal[true]]]
else begin[{]
None
end[}]
if[call[serializeSettings.containsKey, parameter[member[.XML_DECLARATION]]]] begin[{]
call[serializeSettings.put, parameter[member[.XML_DECLARATION], literal[true]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[setDefaultSerializeSettings] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[serializeSettings] operator[SEP] identifier[containsKey] operator[SEP] identifier[ELEMENT_CONTENT_WHITESPACE] operator[SEP] operator[SEP] {
identifier[serializeSettings] operator[SEP] identifier[put] operator[SEP] identifier[ELEMENT_CONTENT_WHITESPACE] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[serializeSettings] operator[SEP] identifier[containsKey] operator[SEP] identifier[SPLIT_CDATA_SECTIONS] operator[SEP] operator[SEP] {
identifier[serializeSettings] operator[SEP] identifier[put] operator[SEP] identifier[SPLIT_CDATA_SECTIONS] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[serializeSettings] operator[SEP] identifier[containsKey] operator[SEP] identifier[FORMAT_PRETTY_PRINT] operator[SEP] operator[SEP] {
identifier[serializeSettings] operator[SEP] identifier[put] operator[SEP] identifier[FORMAT_PRETTY_PRINT] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[serializeSettings] operator[SEP] identifier[containsKey] operator[SEP] identifier[XML_DECLARATION] operator[SEP] operator[SEP] {
identifier[serializeSettings] operator[SEP] identifier[put] operator[SEP] identifier[XML_DECLARATION] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public boolean matchesAssignment(WorkerHeartbeat whb, Map<Integer, LocalAssignment> assignedTasks) {
boolean isMatch = true;
LocalAssignment localAssignment = assignedTasks.get(whb.getPort());
if (localAssignment == null) {
LOG.debug("Following worker has been removed, port=" + whb.getPort() + ", assignedTasks=" + assignedTasks);
isMatch = false;
} else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
// topology id not equal
LOG.info("topology id not equal whb=" + whb.getTopologyId() + ",localAssignment=" + localAssignment.getTopologyId());
isMatch = false;
}/*
* else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) { // task-id isn't equal LOG.info("task-id isn't equal whb=" + whb.getTaskIds() +
* ",localAssignment=" + localAssignment.getTaskIds()); isMatch = false; }
*/
return isMatch;
}
|
class class_name[name] begin[{]
method[matchesAssignment, return_type[type[boolean]], modifier[public], parameter[whb, assignedTasks]] begin[{]
local_variable[type[boolean], isMatch]
local_variable[type[LocalAssignment], localAssignment]
if[binary_operation[member[.localAssignment], ==, literal[null]]] begin[{]
call[LOG.debug, parameter[binary_operation[binary_operation[binary_operation[literal["Following worker has been removed, port="], +, call[whb.getPort, parameter[]]], +, literal[", assignedTasks="]], +, member[.assignedTasks]]]]
assign[member[.isMatch], literal[false]]
else begin[{]
if[call[whb.getTopologyId, parameter[]]] begin[{]
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[literal["topology id not equal whb="], +, call[whb.getTopologyId, parameter[]]], +, literal[",localAssignment="]], +, call[localAssignment.getTopologyId, parameter[]]]]]
assign[member[.isMatch], literal[false]]
else begin[{]
None
end[}]
end[}]
return[member[.isMatch]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[matchesAssignment] operator[SEP] identifier[WorkerHeartbeat] identifier[whb] , identifier[Map] operator[<] identifier[Integer] , identifier[LocalAssignment] operator[>] identifier[assignedTasks] operator[SEP] {
Keyword[boolean] identifier[isMatch] operator[=] literal[boolean] operator[SEP] identifier[LocalAssignment] identifier[localAssignment] operator[=] identifier[assignedTasks] operator[SEP] identifier[get] operator[SEP] identifier[whb] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[localAssignment] operator[==] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[whb] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[assignedTasks] operator[SEP] operator[SEP] identifier[isMatch] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[whb] operator[SEP] identifier[getTopologyId] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[localAssignment] operator[SEP] identifier[getTopologyId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[whb] operator[SEP] identifier[getTopologyId] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[localAssignment] operator[SEP] identifier[getTopologyId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isMatch] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[isMatch] operator[SEP]
}
|
public void setProxy(String proxyHost, int proxyPort, String username, String password) {
setProxy(proxyHost, proxyPort);
proxyAuth = true;
proxyUser = username;
proxyPassword = password;
}
|
class class_name[name] begin[{]
method[setProxy, return_type[void], modifier[public], parameter[proxyHost, proxyPort, username, password]] begin[{]
call[.setProxy, parameter[member[.proxyHost], member[.proxyPort]]]
assign[member[.proxyAuth], literal[true]]
assign[member[.proxyUser], member[.username]]
assign[member[.proxyPassword], member[.password]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setProxy] operator[SEP] identifier[String] identifier[proxyHost] , Keyword[int] identifier[proxyPort] , identifier[String] identifier[username] , identifier[String] identifier[password] operator[SEP] {
identifier[setProxy] operator[SEP] identifier[proxyHost] , identifier[proxyPort] operator[SEP] operator[SEP] identifier[proxyAuth] operator[=] literal[boolean] operator[SEP] identifier[proxyUser] operator[=] identifier[username] operator[SEP] identifier[proxyPassword] operator[=] identifier[password] operator[SEP]
}
|
@ObjectiveCName("isLargeDialogMessage:")
public boolean isLargeDialogMessage(ContentType contentType) {
switch (contentType) {
case SERVICE:
case SERVICE_AVATAR:
case SERVICE_AVATAR_REMOVED:
case SERVICE_CREATED:
case SERVICE_TITLE:
case SERVICE_LEAVE:
case SERVICE_REGISTERED:
case SERVICE_KICK:
case SERVICE_ADD:
case SERVICE_JOINED:
case SERVICE_CALL_ENDED:
case SERVICE_CALL_MISSED:
case SERVICE_ABOUT:
case SERVICE_TOPIC:
return true;
default:
return false;
}
}
|
class class_name[name] begin[{]
method[isLargeDialogMessage, return_type[type[boolean]], modifier[public], parameter[contentType]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['SERVICE', 'SERVICE_AVATAR', 'SERVICE_AVATAR_REMOVED', 'SERVICE_CREATED', 'SERVICE_TITLE', 'SERVICE_LEAVE', 'SERVICE_REGISTERED', 'SERVICE_KICK', 'SERVICE_ADD', 'SERVICE_JOINED', 'SERVICE_CALL_ENDED', 'SERVICE_CALL_MISSED', 'SERVICE_ABOUT', 'SERVICE_TOPIC'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]), SwitchStatementCase(case=[], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])], expression=MemberReference(member=contentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
annotation[@] identifier[ObjectiveCName] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[boolean] identifier[isLargeDialogMessage] operator[SEP] identifier[ContentType] identifier[contentType] operator[SEP] {
Keyword[switch] operator[SEP] identifier[contentType] operator[SEP] {
Keyword[case] identifier[SERVICE] operator[:] Keyword[case] identifier[SERVICE_AVATAR] operator[:] Keyword[case] identifier[SERVICE_AVATAR_REMOVED] operator[:] Keyword[case] identifier[SERVICE_CREATED] operator[:] Keyword[case] identifier[SERVICE_TITLE] operator[:] Keyword[case] identifier[SERVICE_LEAVE] operator[:] Keyword[case] identifier[SERVICE_REGISTERED] operator[:] Keyword[case] identifier[SERVICE_KICK] operator[:] Keyword[case] identifier[SERVICE_ADD] operator[:] Keyword[case] identifier[SERVICE_JOINED] operator[:] Keyword[case] identifier[SERVICE_CALL_ENDED] operator[:] Keyword[case] identifier[SERVICE_CALL_MISSED] operator[:] Keyword[case] identifier[SERVICE_ABOUT] operator[:] Keyword[case] identifier[SERVICE_TOPIC] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[default] operator[:] Keyword[return] literal[boolean] operator[SEP]
}
}
|
public void rollback(File rollbackToDir) {
logger.info("Rolling back store '" + getName() + "'");
fileModificationLock.writeLock().lock();
try {
if(rollbackToDir == null)
throw new VoldemortException("Version directory specified to rollback is null");
if(!rollbackToDir.exists())
throw new VoldemortException("Version directory " + rollbackToDir.getAbsolutePath()
+ " specified to rollback does not exist");
long versionId = ReadOnlyUtils.getVersionId(rollbackToDir);
if(versionId == -1)
throw new VoldemortException("Cannot parse version id");
File[] backUpDirs = ReadOnlyUtils.getVersionDirs(storeDir, versionId, Long.MAX_VALUE);
if(backUpDirs == null || backUpDirs.length <= 1) {
logger.warn("No rollback performed since there are no back-up directories");
return;
}
backUpDirs = ReadOnlyUtils.findKthVersionedDir(backUpDirs, 0, backUpDirs.length - 1);
if(isOpen)
close();
// open the rollback directory
open(rollbackToDir);
// back-up all other directories
DateFormat df = new SimpleDateFormat("MM-dd-yyyy");
for(int index = 1; index < backUpDirs.length; index++) {
Utils.move(backUpDirs[index], new File(storeDir, backUpDirs[index].getName() + "."
+ df.format(new Date()) + ".bak"));
}
} finally {
fileModificationLock.writeLock().unlock();
logger.info("Rollback operation completed on '" + getName() + "', releasing lock.");
}
}
|
class class_name[name] begin[{]
method[rollback, return_type[void], modifier[public], parameter[rollbackToDir]] begin[{]
call[logger.info, parameter[binary_operation[binary_operation[literal["Rolling back store '"], +, call[.getName, parameter[]]], +, literal["'"]]]]
call[fileModificationLock.writeLock, parameter[]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rollbackToDir, 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="Version directory specified to rollback is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VoldemortException, sub_type=None)), label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=rollbackToDir, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Version directory "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=rollbackToDir, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" specified to rollback does not exist"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VoldemortException, sub_type=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rollbackToDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVersionId, postfix_operators=[], prefix_operators=[], qualifier=ReadOnlyUtils, selectors=[], type_arguments=None), name=versionId)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=versionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot parse version id")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VoldemortException, sub_type=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=storeDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[])], member=getVersionDirs, postfix_operators=[], prefix_operators=[], qualifier=ReadOnlyUtils, selectors=[], type_arguments=None), name=backUpDirs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=File, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=backUpDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=backUpDirs, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<=), 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="No rollback performed since there are no back-up directories")], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=backUpDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=backUpDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=backUpDirs, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=findKthVersionedDir, postfix_operators=[], prefix_operators=[], qualifier=ReadOnlyUtils, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MemberReference(member=isOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rollbackToDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="MM-dd-yyyy")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleDateFormat, sub_type=None)), name=df)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateFormat, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=backUpDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), ClassCreator(arguments=[MemberReference(member=storeDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=backUpDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))], member=format, postfix_operators=[], prefix_operators=[], qualifier=df, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".bak"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=move, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=backUpDirs, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=fileModificationLock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Rollback operation completed on '"), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="', releasing lock."), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[rollback] operator[SEP] identifier[File] identifier[rollbackToDir] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[fileModificationLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[rollbackToDir] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[VoldemortException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[rollbackToDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[VoldemortException] operator[SEP] literal[String] operator[+] identifier[rollbackToDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[versionId] operator[=] identifier[ReadOnlyUtils] operator[SEP] identifier[getVersionId] operator[SEP] identifier[rollbackToDir] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[versionId] operator[==] operator[-] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[VoldemortException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[File] operator[SEP] operator[SEP] identifier[backUpDirs] operator[=] identifier[ReadOnlyUtils] operator[SEP] identifier[getVersionDirs] operator[SEP] identifier[storeDir] , identifier[versionId] , identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[backUpDirs] operator[==] Other[null] operator[||] identifier[backUpDirs] operator[SEP] identifier[length] operator[<=] Other[1] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[backUpDirs] operator[=] identifier[ReadOnlyUtils] operator[SEP] identifier[findKthVersionedDir] operator[SEP] identifier[backUpDirs] , Other[0] , identifier[backUpDirs] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isOpen] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[open] operator[SEP] identifier[rollbackToDir] operator[SEP] operator[SEP] identifier[DateFormat] identifier[df] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[1] operator[SEP] identifier[index] operator[<] identifier[backUpDirs] operator[SEP] identifier[length] operator[SEP] identifier[index] operator[++] operator[SEP] {
identifier[Utils] operator[SEP] identifier[move] operator[SEP] identifier[backUpDirs] operator[SEP] identifier[index] operator[SEP] , Keyword[new] identifier[File] operator[SEP] identifier[storeDir] , identifier[backUpDirs] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[df] operator[SEP] identifier[format] operator[SEP] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[fileModificationLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
String getCppName(Method method) {
ClassMapping mapping = mappings.get(method.getDeclaringClass());
if (mapping != null) {
String name = method.getName() + "(" + Datatype.generateJNISignature(method.getParameterTypes()) + ")";
Wrappe wrappedMethod = mapping.getMethods().findWrappe(name);
if (wrappedMethod != null && !Utils.isNullOrEmpty(wrappedMethod.getCppName())) {
return wrappedMethod.getCppName();
}
}
Java4CppWrappe annot = method.getAnnotation(Java4CppWrappe.class);
if (annot != null && !Utils.isNullOrEmpty(annot.value())) {
return annot.value();
}
return mappings.escapeName(method.getName());
}
|
class class_name[name] begin[{]
method[getCppName, return_type[type[String]], modifier[default], parameter[method]] begin[{]
local_variable[type[ClassMapping], mapping]
if[binary_operation[member[.mapping], !=, literal[null]]] begin[{]
local_variable[type[String], name]
local_variable[type[Wrappe], wrappedMethod]
if[binary_operation[binary_operation[member[.wrappedMethod], !=, literal[null]], &&, call[Utils.isNullOrEmpty, parameter[call[wrappedMethod.getCppName, parameter[]]]]]] begin[{]
return[call[wrappedMethod.getCppName, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[Java4CppWrappe], annot]
if[binary_operation[binary_operation[member[.annot], !=, literal[null]], &&, call[Utils.isNullOrEmpty, parameter[call[annot.value, parameter[]]]]]] begin[{]
return[call[annot.value, parameter[]]]
else begin[{]
None
end[}]
return[call[mappings.escapeName, parameter[call[method.getName, parameter[]]]]]
end[}]
END[}]
|
identifier[String] identifier[getCppName] operator[SEP] identifier[Method] identifier[method] operator[SEP] {
identifier[ClassMapping] identifier[mapping] operator[=] identifier[mappings] operator[SEP] identifier[get] operator[SEP] identifier[method] operator[SEP] identifier[getDeclaringClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mapping] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[Datatype] operator[SEP] identifier[generateJNISignature] operator[SEP] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[Wrappe] identifier[wrappedMethod] operator[=] identifier[mapping] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] identifier[findWrappe] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wrappedMethod] operator[!=] Other[null] operator[&&] operator[!] identifier[Utils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[wrappedMethod] operator[SEP] identifier[getCppName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[wrappedMethod] operator[SEP] identifier[getCppName] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[Java4CppWrappe] identifier[annot] operator[=] identifier[method] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Java4CppWrappe] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[annot] operator[!=] Other[null] operator[&&] operator[!] identifier[Utils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[annot] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[annot] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mappings] operator[SEP] identifier[escapeName] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void add(final int[] e) {
if (size == list.length) list = Array.copyOf(list, newSize());
list[size++] = e;
}
|
class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[e]] begin[{]
if[binary_operation[member[.size], ==, member[list.length]]] begin[{]
assign[member[.list], call[Array.copyOf, parameter[member[.list], call[.newSize, parameter[]]]]]
else begin[{]
None
end[}]
assign[member[.list], member[.e]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[add] operator[SEP] Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[==] identifier[list] operator[SEP] identifier[length] operator[SEP] identifier[list] operator[=] identifier[Array] operator[SEP] identifier[copyOf] operator[SEP] identifier[list] , identifier[newSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[size] operator[++] operator[SEP] operator[=] identifier[e] operator[SEP]
}
|
public boolean join(Set<T> s1, Set<T> s2) {
return s1.addAll(s2);
}
|
class class_name[name] begin[{]
method[join, return_type[type[boolean]], modifier[public], parameter[s1, s2]] begin[{]
return[call[s1.addAll, parameter[member[.s2]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[join] operator[SEP] identifier[Set] operator[<] identifier[T] operator[>] identifier[s1] , identifier[Set] operator[<] identifier[T] operator[>] identifier[s2] operator[SEP] {
Keyword[return] identifier[s1] operator[SEP] identifier[addAll] operator[SEP] identifier[s2] operator[SEP] operator[SEP]
}
|
public void setXPathVariableResolver(XPathVariableResolver resolver) {
// resolver cannot be null
if (resolver == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_NULL_XPATH_VARIABLE_RESOLVER,
new Object[] { CLASS_NAME } );
throw new NullPointerException( fmsg );
}
xPathVariableResolver = resolver;
}
|
class class_name[name] begin[{]
method[setXPathVariableResolver, return_type[void], modifier[public], parameter[resolver]] begin[{]
if[binary_operation[member[.resolver], ==, literal[null]]] begin[{]
local_variable[type[String], fmsg]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=fmsg, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.xPathVariableResolver], member[.resolver]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setXPathVariableResolver] operator[SEP] identifier[XPathVariableResolver] identifier[resolver] operator[SEP] {
Keyword[if] operator[SEP] identifier[resolver] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[fmsg] operator[=] identifier[XSLMessages] operator[SEP] identifier[createXPATHMessage] operator[SEP] identifier[XPATHErrorResources] operator[SEP] identifier[ER_NULL_XPATH_VARIABLE_RESOLVER] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[CLASS_NAME]
} operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] identifier[fmsg] operator[SEP] operator[SEP]
}
identifier[xPathVariableResolver] operator[=] identifier[resolver] operator[SEP]
}
|
public SAMFormat getFormat(final Path path) throws PathNotFoundException {
SAMFormat fmt = formatMap.get(path);
if (fmt != null || formatMap.containsKey(path))
return fmt;
if (givenMap)
throw new IllegalArgumentException(
"SAM format for '"+path+"' not in given map");
if (this.conf == null)
throw new IllegalStateException("Don't have a Configuration yet");
if (trustExtensions(conf)) {
final SAMFormat f = SAMFormat.inferFromFilePath(path);
if (f != null) {
formatMap.put(path, f);
return f;
}
}
try {
FileSystem fileSystem = path.getFileSystem(conf);
if (!fileSystem.exists(path)) {
throw new PathNotFoundException(path.toString());
}
fmt = SAMFormat.inferFromData(fileSystem.open(path));
} catch (IOException e) {}
formatMap.put(path, fmt);
return fmt;
}
|
class class_name[name] begin[{]
method[getFormat, return_type[type[SAMFormat]], modifier[public], parameter[path]] begin[{]
local_variable[type[SAMFormat], fmt]
if[binary_operation[binary_operation[member[.fmt], !=, literal[null]], ||, call[formatMap.containsKey, parameter[member[.path]]]]] begin[{]
return[member[.fmt]]
else begin[{]
None
end[}]
if[member[.givenMap]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SAM format for '"), operandr=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' not in given map"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.conf]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Don't have a Configuration yet")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[.trustExtensions, parameter[member[.conf]]]] begin[{]
local_variable[type[SAMFormat], f]
if[binary_operation[member[.f], !=, literal[null]]] begin[{]
call[formatMap.put, parameter[member[.path], member[.f]]]
return[member[.f]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFileSystem, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), name=fileSystem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileSystem, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=fileSystem, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathNotFoundException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=fmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=open, postfix_operators=[], prefix_operators=[], qualifier=fileSystem, selectors=[], type_arguments=None)], member=inferFromData, postfix_operators=[], prefix_operators=[], qualifier=SAMFormat, 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)
call[formatMap.put, parameter[member[.path], member[.fmt]]]
return[member[.fmt]]
end[}]
END[}]
|
Keyword[public] identifier[SAMFormat] identifier[getFormat] operator[SEP] Keyword[final] identifier[Path] identifier[path] operator[SEP] Keyword[throws] identifier[PathNotFoundException] {
identifier[SAMFormat] identifier[fmt] operator[=] identifier[formatMap] operator[SEP] identifier[get] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fmt] operator[!=] Other[null] operator[||] identifier[formatMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[fmt] operator[SEP] Keyword[if] operator[SEP] identifier[givenMap] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[path] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[conf] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trustExtensions] operator[SEP] identifier[conf] operator[SEP] operator[SEP] {
Keyword[final] identifier[SAMFormat] identifier[f] operator[=] identifier[SAMFormat] operator[SEP] identifier[inferFromFilePath] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[!=] Other[null] operator[SEP] {
identifier[formatMap] operator[SEP] identifier[put] operator[SEP] identifier[path] , identifier[f] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP]
}
}
Keyword[try] {
identifier[FileSystem] identifier[fileSystem] operator[=] identifier[path] operator[SEP] identifier[getFileSystem] operator[SEP] identifier[conf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[fileSystem] operator[SEP] identifier[exists] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PathNotFoundException] operator[SEP] identifier[path] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[fmt] operator[=] identifier[SAMFormat] operator[SEP] identifier[inferFromData] operator[SEP] identifier[fileSystem] operator[SEP] identifier[open] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
identifier[formatMap] operator[SEP] identifier[put] operator[SEP] identifier[path] , identifier[fmt] operator[SEP] operator[SEP] Keyword[return] identifier[fmt] operator[SEP]
}
|
@SuppressWarnings("unchecked")
protected <E> GloboDnsRoot<E> parse(String responseAsString, Type type) throws GloboDnsException {
try {
GloboDnsRoot<E> globoDnsRoot = new GloboDnsRoot<E>();
if ("".equalsIgnoreCase(responseAsString)) {
// Empty response, just return empty object
return globoDnsRoot;
}
boolean isList = false;
if (responseAsString.startsWith("[") && responseAsString.endsWith("]")) {
// This means it's a list
isList = true;
}
Reader in = new StringReader(responseAsString);
if (isList) {
List<E> retList = (List<E>) parser.parseAndClose(in, type);
globoDnsRoot.setObjectList(retList);
} else {
E retObj = (E) parser.parseAndClose(in, type);
globoDnsRoot.getObjectList().add(retObj);
}
return globoDnsRoot;
} catch (IOException e) {
throw new GloboDnsParseException("IOError Parse: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[parse, return_type[type[GloboDnsRoot]], modifier[protected], parameter[responseAsString, type]] begin[{]
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=E, sub_type=None))], dimensions=None, name=GloboDnsRoot, sub_type=None)), name=globoDnsRoot)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=GloboDnsRoot, sub_type=None)), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=responseAsString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=""), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=globoDnsRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=isList)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=responseAsString, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=responseAsString, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=responseAsString, 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)), name=in)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Reader, sub_type=None)), IfStatement(condition=MemberReference(member=isList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseAndClose, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), name=retObj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getObjectList, postfix_operators=[], prefix_operators=[], qualifier=globoDnsRoot, selectors=[MethodInvocation(arguments=[MemberReference(member=retObj, 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)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseAndClose, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=List, sub_type=None)), name=retList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=retList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setObjectList, postfix_operators=[], prefix_operators=[], qualifier=globoDnsRoot, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=globoDnsRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IOError Parse: "), 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=GloboDnsParseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] operator[<] identifier[E] operator[>] identifier[GloboDnsRoot] operator[<] identifier[E] operator[>] identifier[parse] operator[SEP] identifier[String] identifier[responseAsString] , identifier[Type] identifier[type] operator[SEP] Keyword[throws] identifier[GloboDnsException] {
Keyword[try] {
identifier[GloboDnsRoot] operator[<] identifier[E] operator[>] identifier[globoDnsRoot] operator[=] Keyword[new] identifier[GloboDnsRoot] operator[<] identifier[E] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[responseAsString] operator[SEP] operator[SEP] {
Keyword[return] identifier[globoDnsRoot] operator[SEP]
}
Keyword[boolean] identifier[isList] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[responseAsString] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[responseAsString] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[isList] operator[=] literal[boolean] operator[SEP]
}
identifier[Reader] identifier[in] operator[=] Keyword[new] identifier[StringReader] operator[SEP] identifier[responseAsString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isList] operator[SEP] {
identifier[List] operator[<] identifier[E] operator[>] identifier[retList] operator[=] operator[SEP] identifier[List] operator[<] identifier[E] operator[>] operator[SEP] identifier[parser] operator[SEP] identifier[parseAndClose] operator[SEP] identifier[in] , identifier[type] operator[SEP] operator[SEP] identifier[globoDnsRoot] operator[SEP] identifier[setObjectList] operator[SEP] identifier[retList] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[E] identifier[retObj] operator[=] operator[SEP] identifier[E] operator[SEP] identifier[parser] operator[SEP] identifier[parseAndClose] operator[SEP] identifier[in] , identifier[type] operator[SEP] operator[SEP] identifier[globoDnsRoot] operator[SEP] identifier[getObjectList] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[retObj] operator[SEP] operator[SEP]
}
Keyword[return] identifier[globoDnsRoot] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GloboDnsParseException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static synchronized Process getProcess(String applicationName, String scopedInstancePath) {
return PROCESS_MAP.get(toAgentId(applicationName, scopedInstancePath));
}
|
class class_name[name] begin[{]
method[getProcess, return_type[type[Process]], modifier[synchronized public static], parameter[applicationName, scopedInstancePath]] begin[{]
return[call[PROCESS_MAP.get, parameter[call[.toAgentId, parameter[member[.applicationName], member[.scopedInstancePath]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[synchronized] identifier[Process] identifier[getProcess] operator[SEP] identifier[String] identifier[applicationName] , identifier[String] identifier[scopedInstancePath] operator[SEP] {
Keyword[return] identifier[PROCESS_MAP] operator[SEP] identifier[get] operator[SEP] identifier[toAgentId] operator[SEP] identifier[applicationName] , identifier[scopedInstancePath] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void populateInterfaceElements(
JvmDeclaredType jvmElement,
Map<ActionPrototype, JvmOperation> operations,
Map<String, JvmField> fields,
IActionPrototypeProvider sarlSignatureProvider) {
for (final JvmFeature feature : jvmElement.getAllFeatures()) {
if (!"java.lang.Object".equals(feature.getDeclaringType().getQualifiedName())) { //$NON-NLS-1$
if (operations != null && feature instanceof JvmOperation) {
final JvmOperation operation = (JvmOperation) feature;
final ActionParameterTypes sig = sarlSignatureProvider.createParameterTypesFromJvmModel(
operation.isVarArgs(), operation.getParameters());
final ActionPrototype actionKey = sarlSignatureProvider.createActionPrototype(
operation.getSimpleName(), sig);
operations.put(actionKey, operation);
} else if (fields != null && feature instanceof JvmField) {
fields.put(feature.getSimpleName(), (JvmField) feature);
}
}
}
}
|
class class_name[name] begin[{]
method[populateInterfaceElements, return_type[void], modifier[public static], parameter[jvmElement, operations, fields, sarlSignatureProvider]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDeclaringType, postfix_operators=[], prefix_operators=[], qualifier=feature, selectors=[MethodInvocation(arguments=[], member=getQualifiedName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="java.lang.Object"), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=operations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JvmOperation, sub_type=None), operator=instanceof), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JvmField, sub_type=None), operator=instanceof), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=feature, selectors=[], type_arguments=None), Cast(expression=MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JvmField, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JvmOperation, sub_type=None)), name=operation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JvmOperation, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isVarArgs, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=createParameterTypesFromJvmModel, postfix_operators=[], prefix_operators=[], qualifier=sarlSignatureProvider, selectors=[], type_arguments=None), name=sig)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionParameterTypes, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createActionPrototype, postfix_operators=[], prefix_operators=[], qualifier=sarlSignatureProvider, selectors=[], type_arguments=None), name=actionKey)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionPrototype, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=operations, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllFeatures, postfix_operators=[], prefix_operators=[], qualifier=jvmElement, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JvmFeature, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[populateInterfaceElements] operator[SEP] identifier[JvmDeclaredType] identifier[jvmElement] , identifier[Map] operator[<] identifier[ActionPrototype] , identifier[JvmOperation] operator[>] identifier[operations] , identifier[Map] operator[<] identifier[String] , identifier[JvmField] operator[>] identifier[fields] , identifier[IActionPrototypeProvider] identifier[sarlSignatureProvider] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[JvmFeature] identifier[feature] operator[:] identifier[jvmElement] operator[SEP] identifier[getAllFeatures] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[feature] operator[SEP] identifier[getDeclaringType] operator[SEP] operator[SEP] operator[SEP] identifier[getQualifiedName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[operations] operator[!=] Other[null] operator[&&] identifier[feature] Keyword[instanceof] identifier[JvmOperation] operator[SEP] {
Keyword[final] identifier[JvmOperation] identifier[operation] operator[=] operator[SEP] identifier[JvmOperation] operator[SEP] identifier[feature] operator[SEP] Keyword[final] identifier[ActionParameterTypes] identifier[sig] operator[=] identifier[sarlSignatureProvider] operator[SEP] identifier[createParameterTypesFromJvmModel] operator[SEP] identifier[operation] operator[SEP] identifier[isVarArgs] operator[SEP] operator[SEP] , identifier[operation] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ActionPrototype] identifier[actionKey] operator[=] identifier[sarlSignatureProvider] operator[SEP] identifier[createActionPrototype] operator[SEP] identifier[operation] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[sig] operator[SEP] operator[SEP] identifier[operations] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fields] operator[!=] Other[null] operator[&&] identifier[feature] Keyword[instanceof] identifier[JvmField] operator[SEP] {
identifier[fields] operator[SEP] identifier[put] operator[SEP] identifier[feature] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , operator[SEP] identifier[JvmField] operator[SEP] identifier[feature] operator[SEP] operator[SEP]
}
}
}
}
|
public static SimpleColor getRandomColor(double opacity) {
Random ran = new Random();
int b = ran.nextInt(255);
int r = 255 - b;
return new SimpleColor(b + ran.nextInt(r), b + ran.nextInt(r), b + ran.nextInt(r), opacity);
}
|
class class_name[name] begin[{]
method[getRandomColor, return_type[type[SimpleColor]], modifier[public static], parameter[opacity]] begin[{]
local_variable[type[Random], ran]
local_variable[type[int], b]
local_variable[type[int], r]
return[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=ran, selectors=[], type_arguments=None), operator=+), BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=ran, selectors=[], type_arguments=None), operator=+), BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=ran, selectors=[], type_arguments=None), operator=+), MemberReference(member=opacity, 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=SimpleColor, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SimpleColor] identifier[getRandomColor] operator[SEP] Keyword[double] identifier[opacity] operator[SEP] {
identifier[Random] identifier[ran] operator[=] Keyword[new] identifier[Random] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[b] operator[=] identifier[ran] operator[SEP] identifier[nextInt] operator[SEP] Other[255] operator[SEP] operator[SEP] Keyword[int] identifier[r] operator[=] Other[255] operator[-] identifier[b] operator[SEP] Keyword[return] Keyword[new] identifier[SimpleColor] operator[SEP] identifier[b] operator[+] identifier[ran] operator[SEP] identifier[nextInt] operator[SEP] identifier[r] operator[SEP] , identifier[b] operator[+] identifier[ran] operator[SEP] identifier[nextInt] operator[SEP] identifier[r] operator[SEP] , identifier[b] operator[+] identifier[ran] operator[SEP] identifier[nextInt] operator[SEP] identifier[r] operator[SEP] , identifier[opacity] operator[SEP] operator[SEP]
}
|
public String convertCRCResourceManagementFmtQualToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
|
class class_name[name] begin[{]
method[convertCRCResourceManagementFmtQualToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[convertCRCResourceManagementFmtQualToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void close() {
LOG.entering(CLASS_NAME, "close");
synchronized (this.schedule) {
if (this.isClosed) {
LOG.exiting(CLASS_NAME, "close", "Clock has already been closed");
return;
}
this.isClosed = true;
final Time stopEvent = new StopTime(Math.max(this.timer.getCurrent(), this.lastClientAlarm + 1));
LOG.log(Level.FINE,
"Graceful shutdown scheduled: {0} Outstanding client alarms: {1}",
new Object[] {stopEvent, this.numClientAlarms});
this.schedule.add(stopEvent);
this.schedule.notify();
}
LOG.exiting(CLASS_NAME, "close");
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
call[LOG.entering, parameter[member[.CLASS_NAME], literal["close"]]]
SYNCHRONIZED[THIS[member[None.schedule]]] BEGIN[{]
if[THIS[member[None.isClosed]]] begin[{]
call[LOG.exiting, parameter[member[.CLASS_NAME], literal["close"], literal["Clock has already been closed"]]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.isClosed]], literal[true]]
local_variable[type[Time], stopEvent]
call[LOG.log, parameter[member[Level.FINE], literal["Graceful shutdown scheduled: {0} Outstanding client alarms: {1}"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=stopEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=numClientAlarms, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
THIS[member[None.schedule]call[None.add, parameter[member[.stopEvent]]]]
THIS[member[None.schedule]call[None.notify, parameter[]]]
END[}]
call[LOG.exiting, parameter[member[.CLASS_NAME], literal["close"]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[entering] operator[SEP] identifier[CLASS_NAME] , literal[String] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[schedule] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isClosed] operator[SEP] {
identifier[LOG] operator[SEP] identifier[exiting] operator[SEP] identifier[CLASS_NAME] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[isClosed] operator[=] literal[boolean] operator[SEP] Keyword[final] identifier[Time] identifier[stopEvent] operator[=] Keyword[new] identifier[StopTime] operator[SEP] identifier[Math] operator[SEP] identifier[max] operator[SEP] Keyword[this] operator[SEP] identifier[timer] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[lastClientAlarm] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[stopEvent] , Keyword[this] operator[SEP] identifier[numClientAlarms]
} operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[schedule] operator[SEP] identifier[add] operator[SEP] identifier[stopEvent] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[schedule] operator[SEP] identifier[notify] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[exiting] operator[SEP] identifier[CLASS_NAME] , literal[String] operator[SEP] operator[SEP]
}
|
private void shrink() {
int oldCapacity = keys.length;
if (oldCapacity <= LinearProbing.DEFAULT_INITIAL_CAPACITY)
return;
K oldKeys[] = keys;
V oldValues[] = values;
int newCapacity = oldCapacity >> 1;
@SuppressWarnings("unchecked")
K newKeys[] = (K[]) new Object[newCapacity];
@SuppressWarnings("unchecked")
V newValues[] = (V[]) new Object[newCapacity];
for (int i = 0; i < oldCapacity; i++) {
K key = oldKeys[i];
if (key != null)
putKeyValue(newKeys, newValues, key, oldValues[i]);
}
this.keys = newKeys;
this.values = newValues;
}
|
class class_name[name] begin[{]
method[shrink, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[int], oldCapacity]
if[binary_operation[member[.oldCapacity], <=, member[LinearProbing.DEFAULT_INITIAL_CAPACITY]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[K], oldKeys]
local_variable[type[V], oldValues]
local_variable[type[int], newCapacity]
local_variable[type[K], newKeys]
local_variable[type[V], newValues]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=oldKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oldValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=putKeyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=oldCapacity, 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)
assign[THIS[member[None.keys]], member[.newKeys]]
assign[THIS[member[None.values]], member[.newValues]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[shrink] operator[SEP] operator[SEP] {
Keyword[int] identifier[oldCapacity] operator[=] identifier[keys] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[oldCapacity] operator[<=] identifier[LinearProbing] operator[SEP] identifier[DEFAULT_INITIAL_CAPACITY] operator[SEP] Keyword[return] operator[SEP] identifier[K] identifier[oldKeys] operator[SEP] operator[SEP] operator[=] identifier[keys] operator[SEP] identifier[V] identifier[oldValues] operator[SEP] operator[SEP] operator[=] identifier[values] operator[SEP] Keyword[int] identifier[newCapacity] operator[=] identifier[oldCapacity] operator[>] operator[>] Other[1] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[K] identifier[newKeys] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[K] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[newCapacity] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[V] identifier[newValues] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[V] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[newCapacity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[oldCapacity] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[K] identifier[key] operator[=] identifier[oldKeys] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[!=] Other[null] operator[SEP] identifier[putKeyValue] operator[SEP] identifier[newKeys] , identifier[newValues] , identifier[key] , identifier[oldValues] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[keys] operator[=] identifier[newKeys] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[=] identifier[newValues] operator[SEP]
}
|
private void sendPingFrame(ChannelHandlerContext ctx, SendPingCommand msg,
ChannelPromise promise) {
// Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown
// but before termination. After termination, messages will no longer arrive because the
// pipeline clears all handlers on channel close.
PingCallback callback = msg.callback();
Executor executor = msg.executor();
// we only allow one outstanding ping at a time, so just add the callback to
// any outstanding operation
if (ping != null) {
promise.setSuccess();
ping.addCallback(callback, executor);
return;
}
// Use a new promise to prevent calling the callback twice on write failure: here and in
// NettyClientTransport.ping(). It may appear strange, but it will behave the same as if
// ping != null above.
promise.setSuccess();
promise = ctx().newPromise();
// set outstanding operation
long data = USER_PING_PAYLOAD;
Stopwatch stopwatch = stopwatchFactory.get();
stopwatch.start();
ping = new Http2Ping(data, stopwatch);
ping.addCallback(callback, executor);
// and then write the ping
encoder().writePing(ctx, false, USER_PING_PAYLOAD, promise);
ctx.flush();
final Http2Ping finalPing = ping;
promise.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
transportTracer.reportKeepAliveSent();
} else {
Throwable cause = future.cause();
if (cause instanceof ClosedChannelException) {
cause = lifecycleManager.getShutdownThrowable();
if (cause == null) {
cause = Status.UNKNOWN.withDescription("Ping failed but for unknown reason.")
.withCause(future.cause()).asException();
}
}
finalPing.failed(cause);
if (ping == finalPing) {
ping = null;
}
}
}
});
}
|
class class_name[name] begin[{]
method[sendPingFrame, return_type[void], modifier[private], parameter[ctx, msg, promise]] begin[{]
local_variable[type[PingCallback], callback]
local_variable[type[Executor], executor]
if[binary_operation[member[.ping], !=, literal[null]]] begin[{]
call[promise.setSuccess, parameter[]]
call[ping.addCallback, parameter[member[.callback], member[.executor]]]
return[None]
else begin[{]
None
end[}]
call[promise.setSuccess, parameter[]]
assign[member[.promise], call[.ctx, parameter[]]]
local_variable[type[long], data]
local_variable[type[Stopwatch], stopwatch]
call[stopwatch.start, parameter[]]
assign[member[.ping], ClassCreator(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stopwatch, 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=Http2Ping, sub_type=None))]
call[ping.addCallback, parameter[member[.callback], member[.executor]]]
call[.encoder, parameter[]]
call[ctx.flush, parameter[]]
local_variable[type[Http2Ping], finalPing]
call[promise.addListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), name=cause)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ClosedChannelException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getShutdownThrowable, postfix_operators=[], prefix_operators=[], qualifier=lifecycleManager, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ping failed but for unknown reason.")], member=withDescription, postfix_operators=[], prefix_operators=[], qualifier=Status.UNKNOWN, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None)], member=withCause, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=asException, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=failed, postfix_operators=[], prefix_operators=[], qualifier=finalPing, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=finalPing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=reportKeepAliveSent, postfix_operators=[], prefix_operators=[], qualifier=transportTracer, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=operationComplete, parameters=[FormalParameter(annotations=[], modifiers=set(), name=future, type=ReferenceType(arguments=None, dimensions=[], name=ChannelFuture, sub_type=None), varargs=False)], return_type=None, throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelFutureListener, sub_type=None))]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[sendPingFrame] operator[SEP] identifier[ChannelHandlerContext] identifier[ctx] , identifier[SendPingCommand] identifier[msg] , identifier[ChannelPromise] identifier[promise] operator[SEP] {
identifier[PingCallback] identifier[callback] operator[=] identifier[msg] operator[SEP] identifier[callback] operator[SEP] operator[SEP] operator[SEP] identifier[Executor] identifier[executor] operator[=] identifier[msg] operator[SEP] identifier[executor] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ping] operator[!=] Other[null] operator[SEP] {
identifier[promise] operator[SEP] identifier[setSuccess] operator[SEP] operator[SEP] operator[SEP] identifier[ping] operator[SEP] identifier[addCallback] operator[SEP] identifier[callback] , identifier[executor] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[promise] operator[SEP] identifier[setSuccess] operator[SEP] operator[SEP] operator[SEP] identifier[promise] operator[=] identifier[ctx] operator[SEP] operator[SEP] operator[SEP] identifier[newPromise] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[data] operator[=] identifier[USER_PING_PAYLOAD] operator[SEP] identifier[Stopwatch] identifier[stopwatch] operator[=] identifier[stopwatchFactory] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[stopwatch] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[ping] operator[=] Keyword[new] identifier[Http2Ping] operator[SEP] identifier[data] , identifier[stopwatch] operator[SEP] operator[SEP] identifier[ping] operator[SEP] identifier[addCallback] operator[SEP] identifier[callback] , identifier[executor] operator[SEP] operator[SEP] identifier[encoder] operator[SEP] operator[SEP] operator[SEP] identifier[writePing] operator[SEP] identifier[ctx] , literal[boolean] , identifier[USER_PING_PAYLOAD] , identifier[promise] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Http2Ping] identifier[finalPing] operator[=] identifier[ping] operator[SEP] identifier[promise] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[ChannelFutureListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[operationComplete] operator[SEP] identifier[ChannelFuture] identifier[future] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[future] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[SEP] {
identifier[transportTracer] operator[SEP] identifier[reportKeepAliveSent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Throwable] identifier[cause] operator[=] identifier[future] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] Keyword[instanceof] identifier[ClosedChannelException] operator[SEP] {
identifier[cause] operator[=] identifier[lifecycleManager] operator[SEP] identifier[getShutdownThrowable] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] operator[==] Other[null] operator[SEP] {
identifier[cause] operator[=] identifier[Status] operator[SEP] identifier[UNKNOWN] operator[SEP] identifier[withDescription] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[withCause] operator[SEP] identifier[future] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[asException] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[finalPing] operator[SEP] identifier[failed] operator[SEP] identifier[cause] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ping] operator[==] identifier[finalPing] operator[SEP] {
identifier[ping] operator[=] Other[null] operator[SEP]
}
}
}
} operator[SEP] operator[SEP]
}
|
@Nonnull
public ApiFuture<WriteResult> create(@Nonnull Map<String, Object> fields) {
WriteBatch writeBatch = firestore.batch();
return extractFirst(writeBatch.create(this, fields).commit());
}
|
class class_name[name] begin[{]
method[create, return_type[type[ApiFuture]], modifier[public], parameter[fields]] begin[{]
local_variable[type[WriteBatch], writeBatch]
return[call[.extractFirst, parameter[call[writeBatch.create, parameter[THIS[], member[.fields]]]]]]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] identifier[ApiFuture] operator[<] identifier[WriteResult] operator[>] identifier[create] operator[SEP] annotation[@] identifier[Nonnull] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[fields] operator[SEP] {
identifier[WriteBatch] identifier[writeBatch] operator[=] identifier[firestore] operator[SEP] identifier[batch] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[extractFirst] operator[SEP] identifier[writeBatch] operator[SEP] identifier[create] operator[SEP] Keyword[this] , identifier[fields] operator[SEP] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void add(ResourceCollection rc) {
if (rc instanceof FileSet) {
FileSet fs = (FileSet) rc;
fs.setProject(getProject());
}
resources.add(rc);
}
|
class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[rc]] begin[{]
if[binary_operation[member[.rc], instanceof, type[FileSet]]] begin[{]
local_variable[type[FileSet], fs]
call[fs.setProject, parameter[call[.getProject, parameter[]]]]
else begin[{]
None
end[}]
call[resources.add, parameter[member[.rc]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[ResourceCollection] identifier[rc] operator[SEP] {
Keyword[if] operator[SEP] identifier[rc] Keyword[instanceof] identifier[FileSet] operator[SEP] {
identifier[FileSet] identifier[fs] operator[=] operator[SEP] identifier[FileSet] operator[SEP] identifier[rc] operator[SEP] identifier[fs] operator[SEP] identifier[setProject] operator[SEP] identifier[getProject] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[resources] operator[SEP] identifier[add] operator[SEP] identifier[rc] operator[SEP] operator[SEP]
}
|
public boolean isWifiFake(String ipAddress, int port) {
SocketChannel socketChannel = null;
try {
socketChannel = SocketChannel.open();
socketChannel.connect(new InetSocketAddress(ipAddress, port));
} catch (IOException e) {
Log.d(TAG, "Current Wifi is stupid!!! by IOException");
return true;
} catch (UnresolvedAddressException e) {
Log.d(TAG, "Current Wifi is stupid!!! by InetSocketAddress");
return true;
} finally {
if (socketChannel != null)
try {
socketChannel.close();
} catch (IOException e) {
Log.d(TAG, "Error occured while closing SocketChannel");
}
}
return false;
}
|
class class_name[name] begin[{]
method[isWifiFake, return_type[type[boolean]], modifier[public], parameter[ipAddress, port]] begin[{]
local_variable[type[SocketChannel], socketChannel]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=socketChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=SocketChannel, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, 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=InetSocketAddress, sub_type=None))], member=connect, postfix_operators=[], prefix_operators=[], qualifier=socketChannel, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Current Wifi is stupid!!! by IOException")], member=d, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Current Wifi is stupid!!! by InetSocketAddress")], member=d, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnresolvedAddressException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=socketChannel, 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=TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=socketChannel, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error occured while closing SocketChannel")], member=d, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None))], label=None, resources=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isWifiFake] operator[SEP] identifier[String] identifier[ipAddress] , Keyword[int] identifier[port] operator[SEP] {
identifier[SocketChannel] identifier[socketChannel] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[socketChannel] operator[=] identifier[SocketChannel] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] identifier[socketChannel] operator[SEP] identifier[connect] operator[SEP] Keyword[new] identifier[InetSocketAddress] operator[SEP] identifier[ipAddress] , identifier[port] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnresolvedAddressException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[socketChannel] operator[!=] Other[null] operator[SEP] Keyword[try] {
identifier[socketChannel] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setHasBold(boolean v) {
if (DocumentBlock_Type.featOkTst && ((DocumentBlock_Type)jcasType).casFeat_hasBold == null)
jcasType.jcas.throwFeatMissing("hasBold", "ch.epfl.bbp.uima.types.DocumentBlock");
jcasType.ll_cas.ll_setBooleanValue(addr, ((DocumentBlock_Type)jcasType).casFeatCode_hasBold, v);}
|
class class_name[name] begin[{]
method[setHasBold, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[DocumentBlock_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DocumentBlock_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["hasBold"], literal["ch.epfl.bbp.uima.types.DocumentBlock"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setBooleanValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DocumentBlock_Type, sub_type=None)), member[.v]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setHasBold] operator[SEP] Keyword[boolean] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[DocumentBlock_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[DocumentBlock_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_hasBold] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setBooleanValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[DocumentBlock_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_hasBold] , identifier[v] operator[SEP] operator[SEP]
}
|
public synchronized String makeCompactString() {
StringBuffer buffer = new StringBuffer();
boolean first = true;
for(Group group: this){
for(Counter counter: group) {
if (first) {
first = false;
} else {
buffer.append(',');
}
buffer.append(group.getDisplayName());
buffer.append('.');
buffer.append(counter.getDisplayName());
buffer.append(':');
buffer.append(counter.getCounter());
}
}
return buffer.toString();
}
|
class class_name[name] begin[{]
method[makeCompactString, return_type[type[String]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[StringBuffer], buffer]
local_variable[type[boolean], first]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=counter, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCounter, postfix_operators=[], prefix_operators=[], qualifier=counter, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=counter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Counter, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=group)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None))), label=None)
return[call[buffer.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] identifier[String] identifier[makeCompactString] operator[SEP] operator[SEP] {
identifier[StringBuffer] identifier[buffer] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Group] identifier[group] operator[:] Keyword[this] operator[SEP] {
Keyword[for] operator[SEP] identifier[Counter] identifier[counter] operator[:] identifier[group] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] {
identifier[first] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[group] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[counter] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[counter] operator[SEP] identifier[getCounter] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[buffer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addMatrix(double[][] m) {
assert (m.length == dim);
assert (m[0].length == dim);
// reset inverse transformation - needs recomputation.
inv = null;
// extend the matrix with an extra row and column
double[][] ht = new double[dim + 1][dim + 1];
for(int i = 0; i < dim; i++) {
for(int j = 0; j < dim; j++) {
ht[i][j] = m[i][j];
}
}
// the other cells default to identity matrix
ht[dim][dim] = 1.0;
// Multiply from left.
trans = times(ht, trans);
}
|
class class_name[name] begin[{]
method[addMatrix, return_type[void], modifier[public], parameter[m]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[]), operandr=MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), label=None, value=None)
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), label=None, value=None)
assign[member[.inv], literal[null]]
local_variable[type[double], ht]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ht, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dim, 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=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dim, 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)
assign[member[.ht], literal[1.0]]
assign[member[.trans], call[.times, parameter[member[.ht], member[.trans]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addMatrix] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] {
Keyword[assert] operator[SEP] identifier[m] operator[SEP] identifier[length] operator[==] identifier[dim] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[m] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[==] identifier[dim] operator[SEP] operator[SEP] identifier[inv] operator[=] Other[null] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ht] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[dim] operator[+] Other[1] operator[SEP] operator[SEP] identifier[dim] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[dim] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[dim] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[ht] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[m] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
}
identifier[ht] operator[SEP] identifier[dim] operator[SEP] operator[SEP] identifier[dim] operator[SEP] operator[=] literal[Float] operator[SEP] identifier[trans] operator[=] identifier[times] operator[SEP] identifier[ht] , identifier[trans] operator[SEP] operator[SEP]
}
|
public ServiceFuture<Void> publishEventsAsync(String topicHostname, List<EventGridEvent> events, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(publishEventsWithServiceResponseAsync(topicHostname, events), serviceCallback);
}
|
class class_name[name] begin[{]
method[publishEventsAsync, return_type[type[ServiceFuture]], modifier[public], parameter[topicHostname, events, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.publishEventsWithServiceResponseAsync, parameter[member[.topicHostname], member[.events]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[Void] operator[>] identifier[publishEventsAsync] operator[SEP] identifier[String] identifier[topicHostname] , identifier[List] operator[<] identifier[EventGridEvent] operator[>] identifier[events] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Void] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[publishEventsWithServiceResponseAsync] operator[SEP] identifier[topicHostname] , identifier[events] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
double findMax() {
double max = exploded.stream().reduce(Double.MIN_VALUE, (x, y) -> x > y ? x : y);
return max;
}
|
class class_name[name] begin[{]
method[findMax, return_type[type[double]], modifier[default], parameter[]] begin[{]
local_variable[type[double], max]
return[member[.max]]
end[}]
END[}]
|
Keyword[double] identifier[findMax] operator[SEP] operator[SEP] {
Keyword[double] identifier[max] operator[=] identifier[exploded] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[reduce] operator[SEP] identifier[Double] operator[SEP] identifier[MIN_VALUE] , operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[->] identifier[x] operator[>] identifier[y] operator[?] identifier[x] operator[:] identifier[y] operator[SEP] operator[SEP] Keyword[return] identifier[max] operator[SEP]
}
|
public void printSubgraph( Node node,
String lead,
int depthOfSubgraph,
int maxDepthOfSubgraph ) throws RepositoryException {
int currentDepth = node.getDepth() - depthOfSubgraph + 1;
if (currentDepth > maxDepthOfSubgraph) return;
if (lead == null) lead = "";
String nodeLead = lead + createString(' ', (currentDepth - 1) * 2);
StringBuilder sb = new StringBuilder();
sb.append(nodeLead);
if (node.getDepth() == 0) {
sb.append("/");
} else {
sb.append(node.getName());
if (node.getIndex() != 1) {
sb.append('[').append(node.getIndex()).append(']');
}
}
sb.append(" jcr:primaryType=" + node.getPrimaryNodeType().getName());
boolean referenceable = node.isNodeType("mix:referenceable");
if (node.getMixinNodeTypes().length != 0) {
sb.append(" jcr:mixinTypes=[");
boolean first = true;
for (NodeType mixin : node.getMixinNodeTypes()) {
if (first) first = false;
else sb.append(',');
sb.append(mixin.getName());
}
sb.append(']');
}
if (referenceable) {
sb.append(" jcr:uuid=" + node.getIdentifier());
}
print(sb);
List<String> propertyNames = new LinkedList<String>();
for (PropertyIterator iter = node.getProperties(); iter.hasNext();) {
Property property = iter.nextProperty();
String name = property.getName();
if (name.equals("jcr:primaryType") || name.equals("jcr:mixinTypes") || name.equals("jcr:uuid")) continue;
propertyNames.add(property.getName());
}
Collections.sort(propertyNames);
for (String propertyName : propertyNames) {
Property property = node.getProperty(propertyName);
sb = new StringBuilder();
sb.append(nodeLead).append(" - ").append(propertyName).append('=');
int type = property.getType();
boolean binary = type == PropertyType.BINARY;
if (property.isMultiple()) {
sb.append('[');
boolean first = true;
for (Value value : property.getValues()) {
if (first) first = false;
else sb.append(',');
if (binary) {
sb.append(value.getBinary());
} else {
sb.append(getStringValue(value, type));
}
}
sb.append(']');
} else {
Value value = property.getValue();
if (binary) {
sb.append(value.getBinary());
} else {
sb.append(getStringValue(value, type));
}
}
print(sb);
}
if (currentDepth < maxDepthOfSubgraph) {
for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
Node child = iter.nextNode();
printSubgraph(child, lead, depthOfSubgraph, maxDepthOfSubgraph);
}
}
}
|
class class_name[name] begin[{]
method[printSubgraph, return_type[void], modifier[public], parameter[node, lead, depthOfSubgraph, maxDepthOfSubgraph]] begin[{]
local_variable[type[int], currentDepth]
if[binary_operation[member[.currentDepth], >, member[.maxDepthOfSubgraph]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.lead], ==, literal[null]]] begin[{]
assign[member[.lead], literal[""]]
else begin[{]
None
end[}]
local_variable[type[String], nodeLead]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[member[.nodeLead]]]
if[binary_operation[call[node.getDepth, parameter[]], ==, literal[0]]] begin[{]
call[sb.append, parameter[literal["/"]]]
else begin[{]
call[sb.append, parameter[call[node.getName, parameter[]]]]
if[binary_operation[call[node.getIndex, parameter[]], !=, literal[1]]] begin[{]
call[sb.append, parameter[literal['[']]]
else begin[{]
None
end[}]
end[}]
call[sb.append, parameter[binary_operation[literal[" jcr:primaryType="], +, call[node.getPrimaryNodeType, parameter[]]]]]
local_variable[type[boolean], referenceable]
if[binary_operation[call[node.getMixinNodeTypes, parameter[]], !=, literal[0]]] begin[{]
call[sb.append, parameter[literal[" jcr:mixinTypes=["]]]
local_variable[type[boolean], first]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=mixin, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMixinNodeTypes, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mixin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeType, sub_type=None))), label=None)
call[sb.append, parameter[literal[']']]]
else begin[{]
None
end[}]
if[member[.referenceable]] begin[{]
call[sb.append, parameter[binary_operation[literal[" jcr:uuid="], +, call[node.getIdentifier, parameter[]]]]]
else begin[{]
None
end[}]
call[.print, parameter[member[.sb]]]
local_variable[type[List], propertyNames]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextProperty, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=property)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Property, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jcr:primaryType")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jcr:mixinTypes")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), operator=||), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jcr:uuid")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=propertyNames, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getProperties, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyIterator, sub_type=None)), update=None), label=None)
call[Collections.sort, parameter[member[.propertyNames]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), name=property)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Property, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nodeLead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" - ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='=')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), name=type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=BINARY, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), name=binary)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[], member=isMultiple, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None)), IfStatement(condition=MemberReference(member=binary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getStringValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBinary, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='[')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=first)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)), IfStatement(condition=MemberReference(member=binary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getStringValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBinary, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=propertyNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=propertyName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[binary_operation[member[.currentDepth], <, member[.maxDepthOfSubgraph]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextNode, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=depthOfSubgraph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxDepthOfSubgraph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printSubgraph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeIterator, sub_type=None)), update=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[printSubgraph] operator[SEP] identifier[Node] identifier[node] , identifier[String] identifier[lead] , Keyword[int] identifier[depthOfSubgraph] , Keyword[int] identifier[maxDepthOfSubgraph] operator[SEP] Keyword[throws] identifier[RepositoryException] {
Keyword[int] identifier[currentDepth] operator[=] identifier[node] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[-] identifier[depthOfSubgraph] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[currentDepth] operator[>] identifier[maxDepthOfSubgraph] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[lead] operator[==] Other[null] operator[SEP] identifier[lead] operator[=] literal[String] operator[SEP] identifier[String] identifier[nodeLead] operator[=] identifier[lead] operator[+] identifier[createString] operator[SEP] literal[String] , operator[SEP] identifier[currentDepth] operator[-] Other[1] operator[SEP] operator[*] Other[2] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[nodeLead] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[node] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[node] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[node] operator[SEP] identifier[getPrimaryNodeType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[referenceable] operator[=] identifier[node] operator[SEP] identifier[isNodeType] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getMixinNodeTypes] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[!=] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[NodeType] identifier[mixin] operator[:] identifier[node] operator[SEP] identifier[getMixinNodeTypes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[else] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[mixin] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[referenceable] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[node] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[print] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[propertyNames] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[PropertyIterator] identifier[iter] operator[=] identifier[node] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Property] identifier[property] operator[=] identifier[iter] operator[SEP] identifier[nextProperty] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] identifier[property] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] identifier[propertyNames] operator[SEP] identifier[add] operator[SEP] identifier[property] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[propertyNames] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[propertyName] operator[:] identifier[propertyNames] operator[SEP] {
identifier[Property] identifier[property] operator[=] identifier[node] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[nodeLead] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[type] operator[=] identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[binary] operator[=] identifier[type] operator[==] identifier[PropertyType] operator[SEP] identifier[BINARY] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isMultiple] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Value] identifier[value] operator[:] identifier[property] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[else] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binary] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] identifier[getBinary] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[getStringValue] operator[SEP] identifier[value] , identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Value] identifier[value] operator[=] identifier[property] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binary] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] identifier[getBinary] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[getStringValue] operator[SEP] identifier[value] , identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[print] operator[SEP] identifier[sb] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentDepth] operator[<] identifier[maxDepthOfSubgraph] operator[SEP] {
Keyword[for] operator[SEP] identifier[NodeIterator] identifier[iter] operator[=] identifier[node] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Node] identifier[child] operator[=] identifier[iter] operator[SEP] identifier[nextNode] operator[SEP] operator[SEP] operator[SEP] identifier[printSubgraph] operator[SEP] identifier[child] , identifier[lead] , identifier[depthOfSubgraph] , identifier[maxDepthOfSubgraph] operator[SEP] operator[SEP]
}
}
}
|
void handleConref() {
// Get pure conref targets
final Set<URI> pureConrefTargets = new HashSet<>(conrefTargetSet.size());
for (final URI target: conrefTargetSet) {
if (!nonConrefCopytoTargetSet.contains(target)) {
pureConrefTargets.add(target);
}
}
pureConrefTargets.remove(rootFile);
conrefTargetSet = pureConrefTargets;
// Remove pure conref targets from fullTopicSet
fullTopicSet.removeAll(pureConrefTargets);
}
|
class class_name[name] begin[{]
method[handleConref, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[Set], pureConrefTargets]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=nonConrefCopytoTargetSet, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=pureConrefTargets, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=conrefTargetSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=target)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None))), label=None)
call[pureConrefTargets.remove, parameter[member[.rootFile]]]
assign[member[.conrefTargetSet], member[.pureConrefTargets]]
call[fullTopicSet.removeAll, parameter[member[.pureConrefTargets]]]
end[}]
END[}]
|
Keyword[void] identifier[handleConref] operator[SEP] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[URI] operator[>] identifier[pureConrefTargets] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[conrefTargetSet] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[URI] identifier[target] operator[:] identifier[conrefTargetSet] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[nonConrefCopytoTargetSet] operator[SEP] identifier[contains] operator[SEP] identifier[target] operator[SEP] operator[SEP] {
identifier[pureConrefTargets] operator[SEP] identifier[add] operator[SEP] identifier[target] operator[SEP] operator[SEP]
}
}
identifier[pureConrefTargets] operator[SEP] identifier[remove] operator[SEP] identifier[rootFile] operator[SEP] operator[SEP] identifier[conrefTargetSet] operator[=] identifier[pureConrefTargets] operator[SEP] identifier[fullTopicSet] operator[SEP] identifier[removeAll] operator[SEP] identifier[pureConrefTargets] operator[SEP] operator[SEP]
}
|
private static String languageVersion(String language, String className, String methodOrFieldName, boolean isMethod) {
StringBuilder sb = new StringBuilder();
try {
Class<?> clz = Class.forName(className);
sb.append(language);
String version = isMethod ? (String) clz.getMethod(methodOrFieldName).invoke(null) : (String) clz.getField(methodOrFieldName).get(null);
concat(sb, version, "/");
} catch (ClassNotFoundException e) {
//Ignore
} catch (Exception e) {
if (log.isTraceEnabled()){
log.trace("Exception attempting to get " + language + " version.", e);
}
}
return sb.toString();
}
|
class class_name[name] begin[{]
method[languageVersion, return_type[type[String]], modifier[private static], parameter[language, className, methodOrFieldName, isMethod]] begin[{]
local_variable[type[StringBuilder], sb]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), name=clz)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MemberReference(member=isMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Cast(expression=MethodInvocation(arguments=[MemberReference(member=methodOrFieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=clz, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), if_true=Cast(expression=MethodInvocation(arguments=[MemberReference(member=methodOrFieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=clz, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), name=version)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=concat, 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=['ClassNotFoundException'])), CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception attempting to get "), operandr=MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" version."), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=trace, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[String] identifier[languageVersion] operator[SEP] identifier[String] identifier[language] , identifier[String] identifier[className] , identifier[String] identifier[methodOrFieldName] , Keyword[boolean] identifier[isMethod] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Class] operator[<] operator[?] operator[>] identifier[clz] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[language] operator[SEP] operator[SEP] identifier[String] identifier[version] operator[=] identifier[isMethod] operator[?] operator[SEP] identifier[String] operator[SEP] identifier[clz] operator[SEP] identifier[getMethod] operator[SEP] identifier[methodOrFieldName] operator[SEP] operator[SEP] identifier[invoke] operator[SEP] Other[null] operator[SEP] operator[:] operator[SEP] identifier[String] operator[SEP] identifier[clz] operator[SEP] identifier[getField] operator[SEP] identifier[methodOrFieldName] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[concat] operator[SEP] identifier[sb] , identifier[version] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[language] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected List<ImageDTO> extractImagesFromCursor(Cursor cursor, int offset, int limit) {
List<ImageDTO> images = new ArrayList<>();
int count = 0;
int begin = offset > 0 ? offset : 0;
if (cursor.moveToPosition(begin)) {
do {
ImageDTO image = extractOneImageFromCurrentCursor(cursor);
images.add(image);
count++;
if (limit > 0 && count > limit) {
break;
}
} while (cursor.moveToNext());
}
cursor.close();
return images;
}
|
class class_name[name] begin[{]
method[extractImagesFromCursor, return_type[type[List]], modifier[protected], parameter[cursor, offset, limit]] begin[{]
local_variable[type[List], images]
local_variable[type[int], count]
local_variable[type[int], begin]
if[call[cursor.moveToPosition, parameter[member[.begin]]]] begin[{]
do[call[cursor.moveToNext, parameter[]]] begin[{]
local_variable[type[ImageDTO], image]
call[images.add, parameter[member[.image]]]
member[.count]
if[binary_operation[binary_operation[member[.limit], >, literal[0]], &&, binary_operation[member[.count], >, member[.limit]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
call[cursor.close, parameter[]]
return[member[.images]]
end[}]
END[}]
|
Keyword[protected] identifier[List] operator[<] identifier[ImageDTO] operator[>] identifier[extractImagesFromCursor] operator[SEP] identifier[Cursor] identifier[cursor] , Keyword[int] identifier[offset] , Keyword[int] identifier[limit] operator[SEP] {
identifier[List] operator[<] identifier[ImageDTO] operator[>] identifier[images] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[int] identifier[begin] operator[=] identifier[offset] operator[>] Other[0] operator[?] identifier[offset] operator[:] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[moveToPosition] operator[SEP] identifier[begin] operator[SEP] operator[SEP] {
Keyword[do] {
identifier[ImageDTO] identifier[image] operator[=] identifier[extractOneImageFromCurrentCursor] operator[SEP] identifier[cursor] operator[SEP] operator[SEP] identifier[images] operator[SEP] identifier[add] operator[SEP] identifier[image] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[limit] operator[>] Other[0] operator[&&] identifier[count] operator[>] identifier[limit] operator[SEP] {
Keyword[break] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[cursor] operator[SEP] identifier[moveToNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[cursor] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[images] operator[SEP]
}
|
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.FNIRG__GCGID:
return getGCGID();
case AfplibPackage.FNIRG__CHAR_INC:
return getCharInc();
case AfplibPackage.FNIRG__ASCEND_HT:
return getAscendHt();
case AfplibPackage.FNIRG__DESCEND_DP:
return getDescendDp();
case AfplibPackage.FNIRG__RESERVED:
return getReserved();
case AfplibPackage.FNIRG__FNM_CNT:
return getFNMCnt();
case AfplibPackage.FNIRG__ASPACE:
return getASpace();
case AfplibPackage.FNIRG__BSPACE:
return getBSpace();
case AfplibPackage.FNIRG__CSPACE:
return getCSpace();
case AfplibPackage.FNIRG__RESERVED2:
return getReserved2();
case AfplibPackage.FNIRG__BASE_OSET:
return getBaseOset();
}
return super.eGet(featureID, resolve, coreType);
}
|
class class_name[name] begin[{]
method[eGet, return_type[type[Object]], modifier[public], parameter[featureID, resolve, coreType]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=FNIRG__GCGID, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getGCGID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__CHAR_INC, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getCharInc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__ASCEND_HT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getAscendHt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__DESCEND_DP, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getDescendDp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__RESERVED, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getReserved, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__FNM_CNT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getFNMCnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__ASPACE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getASpace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__BSPACE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getBSpace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__CSPACE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getCSpace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__RESERVED2, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getReserved2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FNIRG__BASE_OSET, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getBaseOset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resolve, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=coreType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[eGet] operator[SEP] Keyword[int] identifier[featureID] , Keyword[boolean] identifier[resolve] , Keyword[boolean] identifier[coreType] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__GCGID] operator[:] Keyword[return] identifier[getGCGID] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__CHAR_INC] operator[:] Keyword[return] identifier[getCharInc] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__ASCEND_HT] operator[:] Keyword[return] identifier[getAscendHt] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__DESCEND_DP] operator[:] Keyword[return] identifier[getDescendDp] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__RESERVED] operator[:] Keyword[return] identifier[getReserved] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__FNM_CNT] operator[:] Keyword[return] identifier[getFNMCnt] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__ASPACE] operator[:] Keyword[return] identifier[getASpace] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__BSPACE] operator[:] Keyword[return] identifier[getBSpace] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__CSPACE] operator[:] Keyword[return] identifier[getCSpace] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__RESERVED2] operator[:] Keyword[return] identifier[getReserved2] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[FNIRG__BASE_OSET] operator[:] Keyword[return] identifier[getBaseOset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eGet] operator[SEP] identifier[featureID] , identifier[resolve] , identifier[coreType] operator[SEP] operator[SEP]
}
|
protected Map<String, Object> prepareEntityUpdateKeyMap(BehaviorCommandMeta meta) {
final Entity entity = extractArgumentEntity(meta); // always can get if entity update
if (entity == null) { // no way, just in case
return Collections.emptyMap();
}
final DBMeta dbmeta = entity.asDBMeta();
final Map<String, Object> keyMap;
final Set<String> uniqueProps = entity.myuniqueDrivenProperties();
if (!uniqueProps.isEmpty()) {
final Map<String, Object> uniqueMap = uniqueProps.stream().map(prop -> {
return dbmeta.findColumnInfo(prop);
}).collect(Collectors.toMap(col -> col.getColumnDbName(), col -> col.read(entity)));
keyMap = uniqueMap;
} else if (dbmeta.hasPrimaryKey() && entity.hasPrimaryKeyValue()) {
keyMap = dbmeta.extractPrimaryKeyMap(entity);
} else { // no way if entity update, just in case
keyMap = Collections.emptyMap();
}
return keyMap;
}
|
class class_name[name] begin[{]
method[prepareEntityUpdateKeyMap, return_type[type[Map]], modifier[protected], parameter[meta]] begin[{]
local_variable[type[Entity], entity]
if[binary_operation[member[.entity], ==, literal[null]]] begin[{]
return[call[Collections.emptyMap, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[DBMeta], dbmeta]
local_variable[type[Map], keyMap]
local_variable[type[Set], uniqueProps]
if[call[uniqueProps.isEmpty, parameter[]]] begin[{]
local_variable[type[Map], uniqueMap]
assign[member[.keyMap], member[.uniqueMap]]
else begin[{]
if[binary_operation[call[dbmeta.hasPrimaryKey, parameter[]], &&, call[entity.hasPrimaryKeyValue, parameter[]]]] begin[{]
assign[member[.keyMap], call[dbmeta.extractPrimaryKeyMap, parameter[member[.entity]]]]
else begin[{]
assign[member[.keyMap], call[Collections.emptyMap, parameter[]]]
end[}]
end[}]
return[member[.keyMap]]
end[}]
END[}]
|
Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[prepareEntityUpdateKeyMap] operator[SEP] identifier[BehaviorCommandMeta] identifier[meta] operator[SEP] {
Keyword[final] identifier[Entity] identifier[entity] operator[=] identifier[extractArgumentEntity] operator[SEP] identifier[meta] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entity] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[DBMeta] identifier[dbmeta] operator[=] identifier[entity] operator[SEP] identifier[asDBMeta] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[keyMap] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[uniqueProps] operator[=] identifier[entity] operator[SEP] identifier[myuniqueDrivenProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[uniqueProps] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[uniqueMap] operator[=] identifier[uniqueProps] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[prop] operator[->] {
Keyword[return] identifier[dbmeta] operator[SEP] identifier[findColumnInfo] operator[SEP] identifier[prop] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toMap] operator[SEP] identifier[col] operator[->] identifier[col] operator[SEP] identifier[getColumnDbName] operator[SEP] operator[SEP] , identifier[col] operator[->] identifier[col] operator[SEP] identifier[read] operator[SEP] identifier[entity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[keyMap] operator[=] identifier[uniqueMap] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dbmeta] operator[SEP] identifier[hasPrimaryKey] operator[SEP] operator[SEP] operator[&&] identifier[entity] operator[SEP] identifier[hasPrimaryKeyValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[keyMap] operator[=] identifier[dbmeta] operator[SEP] identifier[extractPrimaryKeyMap] operator[SEP] identifier[entity] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[keyMap] operator[=] identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[keyMap] operator[SEP]
}
|
public String get(final long index) {
return doWithJedis(new JedisCallable<String>() {
@Override
public String call(Jedis jedis) {
return jedis.lindex(getKey(), index);
}
});
}
|
class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[index]] begin[{]
return[call[.doWithJedis, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lindex, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[FormalParameter(annotations=[], modifiers=set(), name=jedis, type=ReferenceType(arguments=None, dimensions=[], name=Jedis, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=JedisCallable, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[get] operator[SEP] Keyword[final] Keyword[long] identifier[index] operator[SEP] {
Keyword[return] identifier[doWithJedis] operator[SEP] Keyword[new] identifier[JedisCallable] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[call] operator[SEP] identifier[Jedis] identifier[jedis] operator[SEP] {
Keyword[return] identifier[jedis] operator[SEP] identifier[lindex] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[index] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected final char[] getCopyBuffer()
{
char[] buf = mCopyBuffer;
if (buf == null) {
mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN);
}
return buf;
}
|
class class_name[name] begin[{]
method[getCopyBuffer, return_type[type[char]], modifier[final protected], parameter[]] begin[{]
local_variable[type[char], buf]
if[binary_operation[member[.buf], ==, literal[null]]] begin[{]
assign[member[.mCopyBuffer], assign[member[.buf], call[mConfig.allocMediumCBuffer, parameter[member[.DEFAULT_COPYBUFFER_LEN]]]]]
else begin[{]
None
end[}]
return[member[.buf]]
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[getCopyBuffer] operator[SEP] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[buf] operator[=] identifier[mCopyBuffer] operator[SEP] Keyword[if] operator[SEP] identifier[buf] operator[==] Other[null] operator[SEP] {
identifier[mCopyBuffer] operator[=] identifier[buf] operator[=] identifier[mConfig] operator[SEP] identifier[allocMediumCBuffer] operator[SEP] identifier[DEFAULT_COPYBUFFER_LEN] operator[SEP] operator[SEP]
}
Keyword[return] identifier[buf] operator[SEP]
}
|
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) {
logger.debug("Processing send request with '{}' payload", message.getMessage());
// collections for all the different variants:
final VariantMap variants = new VariantMap();
final List<String> variantIDs = message.getCriteria().getVariants();
// if the criteria payload did specify the "variants" field,
// we look up each of those mentioned variants, by their "variantID":
if (variantIDs != null) {
variantIDs.forEach(variantID -> {
Variant variant = genericVariantService.get().findByVariantID(variantID);
// does the variant exist ?
if (variant != null) {
variants.add(variant);
}
});
} else {
// No specific variants have been requested,
// we get all the variants, from the given PushApplicationEntity:
variants.addAll(pushApplication.getVariants());
}
// TODO: Not sure the transformation should be done here...
// There are likely better places to check if the metadata is way to long
String jsonMessageContent = message.toStrippedJsonString() ;
if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) {
jsonMessageContent = message.toMinimizedJsonString();
}
final FlatPushMessageInformation pushMessageInformation =
metricsService.storeNewRequestFrom(
pushApplication.getPushApplicationID(),
jsonMessageContent,
message.getIpAddress(),
message.getClientIdentifier()
);
// we split the variants per type since each type may have its own configuration (e.g. batch size)
variants.forEach((variantType, variant) -> {
logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier()));
dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant));
});
}
|
class class_name[name] begin[{]
method[submit, return_type[void], modifier[public], parameter[pushApplication, message]] begin[{]
call[logger.debug, parameter[literal["Processing send request with '{}' payload"], call[message.getMessage, parameter[]]]]
local_variable[type[VariantMap], variants]
local_variable[type[List], variantIDs]
if[binary_operation[member[.variantIDs], !=, literal[null]]] begin[{]
call[variantIDs.forEach, parameter[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=genericVariantService, selectors=[MethodInvocation(arguments=[MemberReference(member=variantID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findByVariantID, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=variant)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variant, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=variant, 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=variant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=variants, selectors=[], type_arguments=None), label=None)]))], parameters=[MemberReference(member=variantID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
else begin[{]
call[variants.addAll, parameter[call[pushApplication.getVariants, parameter[]]]]
end[}]
local_variable[type[String], jsonMessageContent]
if[binary_operation[binary_operation[member[.jsonMessageContent], !=, literal[null]], &&, binary_operation[call[jsonMessageContent.length, parameter[]], >=, literal[4500]]]] begin[{]
assign[member[.jsonMessageContent], call[message.toMinimizedJsonString, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[FlatPushMessageInformation], pushMessageInformation]
call[variants.forEach, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Internal dispatching of push message for one %s variant (by %s)"), MethodInvocation(arguments=[], member=getTypeName, postfix_operators=[], prefix_operators=[], qualifier=variantType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getClientIdentifier, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=pushMessageInformation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=variantType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=variant, 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=MessageHolderWithVariants, sub_type=None))], member=fire, postfix_operators=[], prefix_operators=[], qualifier=dispatchVariantMessageEvent, selectors=[], type_arguments=None), label=None)], parameters=[InferredFormalParameter(name=variantType), InferredFormalParameter(name=variant)])]]
end[}]
END[}]
|
annotation[@] identifier[TransactionAttribute] operator[SEP] identifier[TransactionAttributeType] operator[SEP] identifier[REQUIRED] operator[SEP] Keyword[public] Keyword[void] identifier[submit] operator[SEP] identifier[PushApplication] identifier[pushApplication] , identifier[InternalUnifiedPushMessage] identifier[message] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[message] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[VariantMap] identifier[variants] operator[=] Keyword[new] identifier[VariantMap] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[variantIDs] operator[=] identifier[message] operator[SEP] identifier[getCriteria] operator[SEP] operator[SEP] operator[SEP] identifier[getVariants] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[variantIDs] operator[!=] Other[null] operator[SEP] {
identifier[variantIDs] operator[SEP] identifier[forEach] operator[SEP] identifier[variantID] operator[->] {
identifier[Variant] identifier[variant] operator[=] identifier[genericVariantService] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[findByVariantID] operator[SEP] identifier[variantID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[variant] operator[!=] Other[null] operator[SEP] {
identifier[variants] operator[SEP] identifier[add] operator[SEP] identifier[variant] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[variants] operator[SEP] identifier[addAll] operator[SEP] identifier[pushApplication] operator[SEP] identifier[getVariants] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[jsonMessageContent] operator[=] identifier[message] operator[SEP] identifier[toStrippedJsonString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonMessageContent] operator[!=] Other[null] operator[&&] identifier[jsonMessageContent] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>=] Other[4500] operator[SEP] {
identifier[jsonMessageContent] operator[=] identifier[message] operator[SEP] identifier[toMinimizedJsonString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[FlatPushMessageInformation] identifier[pushMessageInformation] operator[=] identifier[metricsService] operator[SEP] identifier[storeNewRequestFrom] operator[SEP] identifier[pushApplication] operator[SEP] identifier[getPushApplicationID] operator[SEP] operator[SEP] , identifier[jsonMessageContent] , identifier[message] operator[SEP] identifier[getIpAddress] operator[SEP] operator[SEP] , identifier[message] operator[SEP] identifier[getClientIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[variants] operator[SEP] identifier[forEach] operator[SEP] operator[SEP] identifier[variantType] , identifier[variant] operator[SEP] operator[->] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[variantType] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] , identifier[message] operator[SEP] identifier[getClientIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[dispatchVariantMessageEvent] operator[SEP] identifier[fire] operator[SEP] Keyword[new] identifier[MessageHolderWithVariants] operator[SEP] identifier[pushMessageInformation] , identifier[message] , identifier[variantType] , identifier[variant] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
static String parse(final byte content[], final Metadata metadata, final int limit) throws TikaException, IOException {
// check that its not unprivileged code like a script
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
}
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
@Override
public String run() throws TikaException, IOException {
return TIKA_INSTANCE.parseToString(StreamInput.wrap(content), metadata, limit);
}
});
} catch (PrivilegedActionException e) {
// checked exception from tika: unbox it
Throwable cause = e.getCause();
if (cause instanceof TikaException) {
throw (TikaException) cause;
} else if (cause instanceof IOException) {
throw (IOException) cause;
} else {
throw new AssertionError(cause);
}
}
}
|
class class_name[name] begin[{]
method[parse, return_type[type[String]], modifier[static], parameter[content, metadata, limit]] begin[{]
local_variable[type[SecurityManager], sm]
if[binary_operation[member[.sm], !=, literal[null]]] begin[{]
call[sm.checkPermission, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpecialPermission, sub_type=None))]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=StreamInput, selectors=[], type_arguments=None), MemberReference(member=metadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseToString, postfix_operators=[], prefix_operators=[], qualifier=TIKA_INSTANCE, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=['TikaException', 'IOException'], 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=String, sub_type=None))], dimensions=None, name=PrivilegedExceptionAction, sub_type=None))], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=AccessController, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=cause)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=TikaException, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=cause, 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=AssertionError, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TikaException, sub_type=None)), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['PrivilegedActionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[static] identifier[String] identifier[parse] operator[SEP] Keyword[final] Keyword[byte] identifier[content] operator[SEP] operator[SEP] , Keyword[final] identifier[Metadata] identifier[metadata] , Keyword[final] Keyword[int] identifier[limit] operator[SEP] Keyword[throws] identifier[TikaException] , identifier[IOException] {
identifier[SecurityManager] identifier[sm] operator[=] identifier[System] operator[SEP] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sm] operator[!=] Other[null] operator[SEP] {
identifier[sm] operator[SEP] identifier[checkPermission] operator[SEP] Keyword[new] identifier[SpecialPermission] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] Keyword[new] identifier[PrivilegedExceptionAction] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[TikaException] , identifier[IOException] {
Keyword[return] identifier[TIKA_INSTANCE] operator[SEP] identifier[parseToString] operator[SEP] identifier[StreamInput] operator[SEP] identifier[wrap] operator[SEP] identifier[content] operator[SEP] , identifier[metadata] , identifier[limit] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PrivilegedActionException] identifier[e] operator[SEP] {
identifier[Throwable] identifier[cause] operator[=] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] Keyword[instanceof] identifier[TikaException] operator[SEP] {
Keyword[throw] operator[SEP] identifier[TikaException] operator[SEP] identifier[cause] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cause] Keyword[instanceof] identifier[IOException] operator[SEP] {
Keyword[throw] operator[SEP] identifier[IOException] operator[SEP] identifier[cause] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[AssertionError] operator[SEP] identifier[cause] operator[SEP] operator[SEP]
}
}
}
|
public boolean contains(double lat, double lon) {
if (lat < minLat || lat > maxLat || lon < minLon || lon > maxLon) {
return false;
}
double rayStartLat = maxLat - (minLat / 2);
double rayStartLon = minLon - epsilon;
boolean inside = false;
int len = this.lat.length;
for (int i = 0; i < len; i++) {
if (edgesAreIntersecting(rayStartLon, rayStartLat, lon, lat, this.lon[i], this.lat[i], this.lon[(i + 1) % len], this.lat[(i + 1) % len]))
inside = !inside;
}
return inside;
}
|
class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[lat, lon]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.lat], <, member[.minLat]], ||, binary_operation[member[.lat], >, member[.maxLat]]], ||, binary_operation[member[.lon], <, member[.minLon]]], ||, binary_operation[member[.lon], >, member[.maxLon]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[double], rayStartLat]
local_variable[type[double], rayStartLon]
local_variable[type[boolean], inside]
local_variable[type[int], len]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=rayStartLon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rayStartLat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lon, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lat, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lon, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%))]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lat, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%))])], member=edgesAreIntersecting, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=inside, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=inside, 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=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.inside]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] Keyword[double] identifier[lat] , Keyword[double] identifier[lon] operator[SEP] {
Keyword[if] operator[SEP] identifier[lat] operator[<] identifier[minLat] operator[||] identifier[lat] operator[>] identifier[maxLat] operator[||] identifier[lon] operator[<] identifier[minLon] operator[||] identifier[lon] operator[>] identifier[maxLon] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[double] identifier[rayStartLat] operator[=] identifier[maxLat] operator[-] operator[SEP] identifier[minLat] operator[/] Other[2] operator[SEP] operator[SEP] Keyword[double] identifier[rayStartLon] operator[=] identifier[minLon] operator[-] identifier[epsilon] operator[SEP] Keyword[boolean] identifier[inside] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[len] operator[=] Keyword[this] operator[SEP] identifier[lat] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[edgesAreIntersecting] operator[SEP] identifier[rayStartLon] , identifier[rayStartLat] , identifier[lon] , identifier[lat] , Keyword[this] operator[SEP] identifier[lon] operator[SEP] identifier[i] operator[SEP] , Keyword[this] operator[SEP] identifier[lat] operator[SEP] identifier[i] operator[SEP] , Keyword[this] operator[SEP] identifier[lon] operator[SEP] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[%] identifier[len] operator[SEP] , Keyword[this] operator[SEP] identifier[lat] operator[SEP] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[%] identifier[len] operator[SEP] operator[SEP] operator[SEP] identifier[inside] operator[=] operator[!] identifier[inside] operator[SEP]
}
Keyword[return] identifier[inside] operator[SEP]
}
|
@Override
public PointFeature next() throws NoSuchElementException {
if (!hasNext()) {
throw new NoSuchElementException("This iterator has no more elements.");
}
assert pointFeature != null;
PointFeature ret = pointFeature;
calcBounds(ret);
pointFeature = null; // Feature has been consumed.
return ret;
}
|
class class_name[name] begin[{]
method[next, return_type[type[PointFeature]], modifier[public], parameter[]] begin[{]
if[call[.hasNext, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This iterator has no more elements.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)), label=None)
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=pointFeature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
local_variable[type[PointFeature], ret]
call[.calcBounds, parameter[member[.ret]]]
assign[member[.pointFeature], literal[null]]
return[member[.ret]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[PointFeature] identifier[next] operator[SEP] operator[SEP] Keyword[throws] identifier[NoSuchElementException] {
Keyword[if] operator[SEP] operator[!] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[assert] identifier[pointFeature] operator[!=] Other[null] operator[SEP] identifier[PointFeature] identifier[ret] operator[=] identifier[pointFeature] operator[SEP] identifier[calcBounds] operator[SEP] identifier[ret] operator[SEP] operator[SEP] identifier[pointFeature] operator[=] Other[null] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public static Document parseXml(final InputStream is, final String rootNames, final String forceNamespace) throws Exception {
final Document doc;
SAXParser parser;
final SAXParserFactory factory = SAXParserFactory.newInstance();
parser = factory.newSAXParser();
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// turn off validator and loading external dtd
dbf.setValidating(false);
dbf.setNamespaceAware(true);
dbf.setFeature("http://xml.org/sax/features/namespaces", false);
dbf.setFeature("http://xml.org/sax/features/validation", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
final DocumentBuilder docBuilder = dbf.newDocumentBuilder();
doc = docBuilder.newDocument();
final Stack<Element> elementStack = new Stack<Element>();
final StringBuilder textBuffer = new StringBuilder();
final DefaultHandler handler = new DefaultHandler() {
private Locator locator;
private boolean found;
@Override
public void setDocumentLocator(final Locator locator) {
this.locator = locator; // Save the locator, so that it can be used later for line tracking when traversing nodes.
this.found = rootNames == null;
}
private boolean isRootName(String qName) {
for (String root : rootNames.split(",")) {
if (qName.equals(root)) {
return true;
}
}
return false;
}
@Override
public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException {
addTextIfNeeded();
if (rootNames != null && !found) {
if (isRootName(qName)) {
found = true;
}
}
if (found) {
Element el;
if (forceNamespace != null) {
el = doc.createElementNS(forceNamespace, qName);
} else {
el = doc.createElement(qName);
}
for (int i = 0; i < attributes.getLength(); i++) {
el.setAttribute(attributes.getQName(i), attributes.getValue(i));
}
el.setUserData(LINE_NUMBER, String.valueOf(this.locator.getLineNumber()), null);
el.setUserData(COLUMN_NUMBER, String.valueOf(this.locator.getColumnNumber()), null);
elementStack.push(el);
}
}
@Override
public void endElement(final String uri, final String localName, final String qName) {
if (!found) {
return;
}
addTextIfNeeded();
final Element closedEl = elementStack.isEmpty() ? null : elementStack.pop();
if (closedEl != null) {
if (elementStack.isEmpty()) {
// Is this the root element?
doc.appendChild(closedEl);
} else {
final Element parentEl = elementStack.peek();
parentEl.appendChild(closedEl);
}
closedEl.setUserData(LINE_NUMBER_END, String.valueOf(this.locator.getLineNumber()), null);
closedEl.setUserData(COLUMN_NUMBER_END, String.valueOf(this.locator.getColumnNumber()), null);
}
}
@Override
public void characters(final char ch[], final int start, final int length) throws SAXException {
textBuffer.append(ch, start, length);
}
@Override
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
// do not resolve external dtd
return new InputSource(new StringReader(""));
}
// Outputs text accumulated under the current node
private void addTextIfNeeded() {
if (textBuffer.length() > 0) {
final Element el = elementStack.isEmpty() ? null : elementStack.peek();
if (el != null) {
final Node textNode = doc.createTextNode(textBuffer.toString());
el.appendChild(textNode);
textBuffer.delete(0, textBuffer.length());
}
}
}
};
parser.parse(is, handler);
return doc;
}
|
class class_name[name] begin[{]
method[parseXml, return_type[type[Document]], modifier[public static], parameter[is, rootNames, forceNamespace]] begin[{]
local_variable[type[Document], doc]
local_variable[type[SAXParser], parser]
local_variable[type[SAXParserFactory], factory]
assign[member[.parser], call[factory.newSAXParser, parameter[]]]
local_variable[type[DocumentBuilderFactory], dbf]
call[dbf.setValidating, parameter[literal[false]]]
call[dbf.setNamespaceAware, parameter[literal[true]]]
call[dbf.setFeature, parameter[literal["http://xml.org/sax/features/namespaces"], literal[false]]]
call[dbf.setFeature, parameter[literal["http://xml.org/sax/features/validation"], literal[false]]]
call[dbf.setFeature, parameter[literal["http://apache.org/xml/features/nonvalidating/load-dtd-grammar"], literal[false]]]
call[dbf.setFeature, parameter[literal["http://apache.org/xml/features/nonvalidating/load-external-dtd"], literal[false]]]
call[dbf.setFeature, parameter[literal["http://xml.org/sax/features/external-parameter-entities"], literal[false]]]
call[dbf.setFeature, parameter[literal["http://xml.org/sax/features/external-general-entities"], literal[false]]]
local_variable[type[DocumentBuilder], docBuilder]
assign[member[.doc], call[docBuilder.newDocument, parameter[]]]
local_variable[type[Stack], elementStack]
local_variable[type[StringBuilder], textBuffer]
local_variable[type[DefaultHandler], handler]
call[parser.parse, parameter[member[.is], member[.handler]]]
return[member[.doc]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Document] identifier[parseXml] operator[SEP] Keyword[final] identifier[InputStream] identifier[is] , Keyword[final] identifier[String] identifier[rootNames] , Keyword[final] identifier[String] identifier[forceNamespace] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[Document] identifier[doc] operator[SEP] identifier[SAXParser] identifier[parser] operator[SEP] Keyword[final] identifier[SAXParserFactory] identifier[factory] operator[=] identifier[SAXParserFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[parser] operator[=] identifier[factory] operator[SEP] identifier[newSAXParser] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[DocumentBuilderFactory] identifier[dbf] operator[=] identifier[DocumentBuilderFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setValidating] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setNamespaceAware] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[dbf] operator[SEP] identifier[setFeature] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[DocumentBuilder] identifier[docBuilder] operator[=] identifier[dbf] operator[SEP] identifier[newDocumentBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[doc] operator[=] identifier[docBuilder] operator[SEP] identifier[newDocument] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Stack] operator[<] identifier[Element] operator[>] identifier[elementStack] operator[=] Keyword[new] identifier[Stack] operator[<] identifier[Element] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[textBuffer] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[DefaultHandler] identifier[handler] operator[=] Keyword[new] identifier[DefaultHandler] operator[SEP] operator[SEP] {
Keyword[private] identifier[Locator] identifier[locator] operator[SEP] Keyword[private] Keyword[boolean] identifier[found] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setDocumentLocator] operator[SEP] Keyword[final] identifier[Locator] identifier[locator] operator[SEP] {
Keyword[this] operator[SEP] identifier[locator] operator[=] identifier[locator] operator[SEP] Keyword[this] operator[SEP] identifier[found] operator[=] identifier[rootNames] operator[==] Other[null] operator[SEP]
}
Keyword[private] Keyword[boolean] identifier[isRootName] operator[SEP] identifier[String] identifier[qName] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[root] operator[:] identifier[rootNames] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[qName] operator[SEP] identifier[equals] operator[SEP] identifier[root] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[startElement] operator[SEP] Keyword[final] identifier[String] identifier[uri] , Keyword[final] identifier[String] identifier[localName] , Keyword[final] identifier[String] identifier[qName] , Keyword[final] identifier[Attributes] identifier[attributes] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[addTextIfNeeded] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rootNames] operator[!=] Other[null] operator[&&] operator[!] identifier[found] operator[SEP] {
Keyword[if] operator[SEP] identifier[isRootName] operator[SEP] identifier[qName] operator[SEP] operator[SEP] {
identifier[found] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[found] operator[SEP] {
identifier[Element] identifier[el] operator[SEP] Keyword[if] operator[SEP] identifier[forceNamespace] operator[!=] Other[null] operator[SEP] {
identifier[el] operator[=] identifier[doc] operator[SEP] identifier[createElementNS] operator[SEP] identifier[forceNamespace] , identifier[qName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[el] operator[=] identifier[doc] operator[SEP] identifier[createElement] operator[SEP] identifier[qName] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[attributes] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[el] operator[SEP] identifier[setAttribute] operator[SEP] identifier[attributes] operator[SEP] identifier[getQName] operator[SEP] identifier[i] operator[SEP] , identifier[attributes] operator[SEP] identifier[getValue] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[el] operator[SEP] identifier[setUserData] operator[SEP] identifier[LINE_NUMBER] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] Keyword[this] operator[SEP] identifier[locator] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[el] operator[SEP] identifier[setUserData] operator[SEP] identifier[COLUMN_NUMBER] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] Keyword[this] operator[SEP] identifier[locator] operator[SEP] identifier[getColumnNumber] operator[SEP] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[elementStack] operator[SEP] identifier[push] operator[SEP] identifier[el] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[endElement] operator[SEP] Keyword[final] identifier[String] identifier[uri] , Keyword[final] identifier[String] identifier[localName] , Keyword[final] identifier[String] identifier[qName] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[found] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[addTextIfNeeded] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Element] identifier[closedEl] operator[=] identifier[elementStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] Other[null] operator[:] identifier[elementStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[closedEl] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[elementStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[doc] operator[SEP] identifier[appendChild] operator[SEP] identifier[closedEl] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[Element] identifier[parentEl] operator[=] identifier[elementStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] identifier[parentEl] operator[SEP] identifier[appendChild] operator[SEP] identifier[closedEl] operator[SEP] operator[SEP]
}
identifier[closedEl] operator[SEP] identifier[setUserData] operator[SEP] identifier[LINE_NUMBER_END] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] Keyword[this] operator[SEP] identifier[locator] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[closedEl] operator[SEP] identifier[setUserData] operator[SEP] identifier[COLUMN_NUMBER_END] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] Keyword[this] operator[SEP] identifier[locator] operator[SEP] identifier[getColumnNumber] operator[SEP] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[characters] operator[SEP] Keyword[final] Keyword[char] identifier[ch] operator[SEP] operator[SEP] , Keyword[final] Keyword[int] identifier[start] , Keyword[final] Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[textBuffer] operator[SEP] identifier[append] operator[SEP] identifier[ch] , identifier[start] , identifier[length] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[InputSource] identifier[resolveEntity] operator[SEP] identifier[String] identifier[publicId] , identifier[String] identifier[systemId] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SAXException] {
Keyword[return] Keyword[new] identifier[InputSource] operator[SEP] Keyword[new] identifier[StringReader] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[private] Keyword[void] identifier[addTextIfNeeded] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[textBuffer] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[final] identifier[Element] identifier[el] operator[=] identifier[elementStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] Other[null] operator[:] identifier[elementStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[el] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[Node] identifier[textNode] operator[=] identifier[doc] operator[SEP] identifier[createTextNode] operator[SEP] identifier[textBuffer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[el] operator[SEP] identifier[appendChild] operator[SEP] identifier[textNode] operator[SEP] operator[SEP] identifier[textBuffer] operator[SEP] identifier[delete] operator[SEP] Other[0] , identifier[textBuffer] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[is] , identifier[handler] operator[SEP] operator[SEP] Keyword[return] identifier[doc] operator[SEP]
}
|
private static Pair keyValue(final String line) {
final String[] parts = line.split("=", 2);
if (parts.length == 2) {
final String key = parts[0].trim();
final String value = parts[1].trim();
return new Pair(key, value);
}
// ignore invalid lines
return null;
}
|
class class_name[name] begin[{]
method[keyValue, return_type[type[Pair]], modifier[private static], parameter[line]] begin[{]
local_variable[type[String], parts]
if[binary_operation[member[parts.length], ==, literal[2]]] begin[{]
local_variable[type[String], key]
local_variable[type[String], value]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Pair, sub_type=None))]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Pair] identifier[keyValue] operator[SEP] Keyword[final] identifier[String] identifier[line] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[line] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
Keyword[final] identifier[String] identifier[key] operator[=] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[=] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Pair] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
static public String listToJSONString(List<?> list) {
if (list == null || list.size() == 0) {
return "[]";
}
StringBuilder sb = new StringBuilder("[");
for (Object o : list) {
buildAppendString(sb, o).append(',').append(' ');
}
return sb.delete(sb.length() - 2, sb.length()).append(']').toString();
}
|
class class_name[name] begin[{]
method[listToJSONString, return_type[type[String]], modifier[public static], parameter[list]] begin[{]
if[binary_operation[binary_operation[member[.list], ==, literal[null]], ||, binary_operation[call[list.size, parameter[]], ==, literal[0]]]] begin[{]
return[literal["[]"]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildAppendString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[call[sb.delete, parameter[binary_operation[call[sb.length, parameter[]], -, literal[2]], call[sb.length, parameter[]]]]]
end[}]
END[}]
|
Keyword[static] Keyword[public] identifier[String] identifier[listToJSONString] operator[SEP] identifier[List] operator[<] operator[?] operator[>] identifier[list] operator[SEP] {
Keyword[if] operator[SEP] identifier[list] operator[==] Other[null] operator[||] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[list] operator[SEP] {
identifier[buildAppendString] operator[SEP] identifier[sb] , identifier[o] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[delete] operator[SEP] identifier[sb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] , identifier[sb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void executeGrailsBootstraps(GrailsApplication application, WebApplicationContext webContext,
ServletContext servletContext, GrailsPluginManager grailsPluginManager) {
configureServletContextAttributes(
servletContext,
application,
grailsPluginManager,
webContext
);
PersistenceContextInterceptor interceptor = null;
String[] beanNames = webContext.getBeanNamesForType(PersistenceContextInterceptor.class);
if (beanNames.length > 0) {
interceptor = (PersistenceContextInterceptor)webContext.getBean(beanNames[0]);
}
if (interceptor != null) {
interceptor.init();
}
// init the Grails application
try {
GrailsClass[] bootstraps = application.getArtefacts(BootstrapArtefactHandler.TYPE);
for (GrailsClass bootstrap : bootstraps) {
final GrailsBootstrapClass bootstrapClass = (GrailsBootstrapClass) bootstrap;
final Object instance = bootstrapClass.getReferenceInstance();
webContext.getAutowireCapableBeanFactory().autowireBeanProperties(
instance, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
bootstrapClass.callInit(servletContext);
}
if (interceptor != null) {
interceptor.flush();
}
}
finally {
if (interceptor != null) {
interceptor.destroy();
}
}
}
|
class class_name[name] begin[{]
method[executeGrailsBootstraps, return_type[void], modifier[public static], parameter[application, webContext, servletContext, grailsPluginManager]] begin[{]
call[.configureServletContextAttributes, parameter[member[.servletContext], member[.application], member[.grailsPluginManager], member[.webContext]]]
local_variable[type[PersistenceContextInterceptor], interceptor]
local_variable[type[String], beanNames]
if[binary_operation[member[beanNames.length], >, literal[0]]] begin[{]
assign[member[.interceptor], Cast(expression=MethodInvocation(arguments=[MemberReference(member=beanNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=getBean, postfix_operators=[], prefix_operators=[], qualifier=webContext, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=PersistenceContextInterceptor, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.interceptor], !=, literal[null]]] begin[{]
call[interceptor.init, parameter[]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=BootstrapArtefactHandler, selectors=[])], member=getArtefacts, postfix_operators=[], prefix_operators=[], qualifier=application, selectors=[], type_arguments=None), name=bootstraps)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=GrailsClass, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=bootstrap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrailsBootstrapClass, sub_type=None)), name=bootstrapClass)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=GrailsBootstrapClass, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getReferenceInstance, postfix_operators=[], prefix_operators=[], qualifier=bootstrapClass, selectors=[], type_arguments=None), name=instance)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getAutowireCapableBeanFactory, postfix_operators=[], prefix_operators=[], qualifier=webContext, selectors=[MethodInvocation(arguments=[MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=AUTOWIRE_BY_NAME, postfix_operators=[], prefix_operators=[], qualifier=AutowireCapableBeanFactory, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=autowireBeanProperties, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=servletContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callInit, postfix_operators=[], prefix_operators=[], qualifier=bootstrapClass, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=bootstraps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bootstrap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GrailsClass, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interceptor, 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=flush, postfix_operators=[], prefix_operators=[], qualifier=interceptor, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interceptor, 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=destroy, postfix_operators=[], prefix_operators=[], qualifier=interceptor, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[executeGrailsBootstraps] operator[SEP] identifier[GrailsApplication] identifier[application] , identifier[WebApplicationContext] identifier[webContext] , identifier[ServletContext] identifier[servletContext] , identifier[GrailsPluginManager] identifier[grailsPluginManager] operator[SEP] {
identifier[configureServletContextAttributes] operator[SEP] identifier[servletContext] , identifier[application] , identifier[grailsPluginManager] , identifier[webContext] operator[SEP] operator[SEP] identifier[PersistenceContextInterceptor] identifier[interceptor] operator[=] Other[null] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[beanNames] operator[=] identifier[webContext] operator[SEP] identifier[getBeanNamesForType] operator[SEP] identifier[PersistenceContextInterceptor] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[beanNames] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[interceptor] operator[=] operator[SEP] identifier[PersistenceContextInterceptor] operator[SEP] identifier[webContext] operator[SEP] identifier[getBean] operator[SEP] identifier[beanNames] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[interceptor] operator[!=] Other[null] operator[SEP] {
identifier[interceptor] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[GrailsClass] operator[SEP] operator[SEP] identifier[bootstraps] operator[=] identifier[application] operator[SEP] identifier[getArtefacts] operator[SEP] identifier[BootstrapArtefactHandler] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[GrailsClass] identifier[bootstrap] operator[:] identifier[bootstraps] operator[SEP] {
Keyword[final] identifier[GrailsBootstrapClass] identifier[bootstrapClass] operator[=] operator[SEP] identifier[GrailsBootstrapClass] operator[SEP] identifier[bootstrap] operator[SEP] Keyword[final] identifier[Object] identifier[instance] operator[=] identifier[bootstrapClass] operator[SEP] identifier[getReferenceInstance] operator[SEP] operator[SEP] operator[SEP] identifier[webContext] operator[SEP] identifier[getAutowireCapableBeanFactory] operator[SEP] operator[SEP] operator[SEP] identifier[autowireBeanProperties] operator[SEP] identifier[instance] , identifier[AutowireCapableBeanFactory] operator[SEP] identifier[AUTOWIRE_BY_NAME] , literal[boolean] operator[SEP] operator[SEP] identifier[bootstrapClass] operator[SEP] identifier[callInit] operator[SEP] identifier[servletContext] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[interceptor] operator[!=] Other[null] operator[SEP] {
identifier[interceptor] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[interceptor] operator[!=] Other[null] operator[SEP] {
identifier[interceptor] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected InputStream getModelResourceAsStream()
throws IOException {
final ServletContext servletContext = context.getServletContext();
// Don't allow NPE, throw a more detailed exception
if (servletContext == null) {
throw new WroRuntimeException(
"No servletContext is available. Probably you are running this code outside of the request cycle!");
}
final String resourceLocation = "/WEB-INF/" + getDefaultModelFilename();
final InputStream stream = servletContext.getResourceAsStream(resourceLocation);
if (stream == null) {
throw new IOException("Invalid resource requested: " + resourceLocation);
}
return stream;
}
|
class class_name[name] begin[{]
method[getModelResourceAsStream, return_type[type[InputStream]], modifier[protected], parameter[]] begin[{]
local_variable[type[ServletContext], servletContext]
if[binary_operation[member[.servletContext], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No servletContext is available. Probably you are running this code outside of the request cycle!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WroRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], resourceLocation]
local_variable[type[InputStream], stream]
if[binary_operation[member[.stream], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid resource requested: "), operandr=MemberReference(member=resourceLocation, 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=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.stream]]
end[}]
END[}]
|
Keyword[protected] identifier[InputStream] identifier[getModelResourceAsStream] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[ServletContext] identifier[servletContext] operator[=] identifier[context] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[servletContext] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WroRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[resourceLocation] operator[=] literal[String] operator[+] identifier[getDefaultModelFilename] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[InputStream] identifier[stream] operator[=] identifier[servletContext] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[resourceLocation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stream] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[resourceLocation] operator[SEP] operator[SEP]
}
Keyword[return] identifier[stream] operator[SEP]
}
|
public void setTSOffset(Integer newTSOffset) {
Integer oldTSOffset = tsOffset;
tsOffset = newTSOffset;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.FNNRG__TS_OFFSET, oldTSOffset, tsOffset));
}
|
class class_name[name] begin[{]
method[setTSOffset, return_type[void], modifier[public], parameter[newTSOffset]] begin[{]
local_variable[type[Integer], oldTSOffset]
assign[member[.tsOffset], member[.newTSOffset]]
if[call[.eNotificationRequired, parameter[]]] begin[{]
call[.eNotify, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=Notification, selectors=[]), MemberReference(member=FNNRG__TS_OFFSET, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[]), MemberReference(member=oldTSOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tsOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ENotificationImpl, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setTSOffset] operator[SEP] identifier[Integer] identifier[newTSOffset] operator[SEP] {
identifier[Integer] identifier[oldTSOffset] operator[=] identifier[tsOffset] operator[SEP] identifier[tsOffset] operator[=] identifier[newTSOffset] operator[SEP] Keyword[if] operator[SEP] identifier[eNotificationRequired] operator[SEP] operator[SEP] operator[SEP] identifier[eNotify] operator[SEP] Keyword[new] identifier[ENotificationImpl] operator[SEP] Keyword[this] , identifier[Notification] operator[SEP] identifier[SET] , identifier[AfplibPackage] operator[SEP] identifier[FNNRG__TS_OFFSET] , identifier[oldTSOffset] , identifier[tsOffset] operator[SEP] operator[SEP] operator[SEP]
}
|
public void deleteNamespace(String namespaceId) {
DeleteNamespaceRequest deleteNamespaceRequest = new DeleteNamespaceRequest().withId(namespaceId);
getDiscoveryClient().deleteNamespace(deleteNamespaceRequest);
}
|
class class_name[name] begin[{]
method[deleteNamespace, return_type[void], modifier[public], parameter[namespaceId]] begin[{]
local_variable[type[DeleteNamespaceRequest], deleteNamespaceRequest]
call[.getDiscoveryClient, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[deleteNamespace] operator[SEP] identifier[String] identifier[namespaceId] operator[SEP] {
identifier[DeleteNamespaceRequest] identifier[deleteNamespaceRequest] operator[=] Keyword[new] identifier[DeleteNamespaceRequest] operator[SEP] operator[SEP] operator[SEP] identifier[withId] operator[SEP] identifier[namespaceId] operator[SEP] operator[SEP] identifier[getDiscoveryClient] operator[SEP] operator[SEP] operator[SEP] identifier[deleteNamespace] operator[SEP] identifier[deleteNamespaceRequest] operator[SEP] operator[SEP]
}
|
public static String getEncryptCertId() {
if (null == encryptCert) {
String path = SDKConfig.getConfig().getEncryptCertPath();
if (!isEmpty(path)) {
encryptCert = initCert(path);
return encryptCert.getSerialNumber().toString();
} else {
LogUtil.writeErrorLog("acpsdk.encryptCert.path is empty");
return null;
}
} else {
return encryptCert.getSerialNumber().toString();
}
}
|
class class_name[name] begin[{]
method[getEncryptCertId, return_type[type[String]], modifier[public static], parameter[]] begin[{]
if[binary_operation[literal[null], ==, member[.encryptCert]]] begin[{]
local_variable[type[String], path]
if[call[.isEmpty, parameter[member[.path]]]] begin[{]
assign[member[.encryptCert], call[.initCert, parameter[member[.path]]]]
return[call[encryptCert.getSerialNumber, parameter[]]]
else begin[{]
call[LogUtil.writeErrorLog, parameter[literal["acpsdk.encryptCert.path is empty"]]]
return[literal[null]]
end[}]
else begin[{]
return[call[encryptCert.getSerialNumber, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getEncryptCertId] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[encryptCert] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[SDKConfig] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getEncryptCertPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isEmpty] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
identifier[encryptCert] operator[=] identifier[initCert] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[encryptCert] operator[SEP] identifier[getSerialNumber] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LogUtil] operator[SEP] identifier[writeErrorLog] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[encryptCert] operator[SEP] identifier[getSerialNumber] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private String durationToString(Duration duration) {
String retVal = null;
Duration absDuration = duration.abs();
int days = 0;
if (absDuration.getSeconds() != 0) {
days = (int) absDuration.getSeconds() / (24 * 60 * 60);
}
if (days != 0) {
Duration durationMinusDays = absDuration.minusDays(days);
if (durationMinusDays.getSeconds() != 0) {
int hours = (int) durationMinusDays.getSeconds() / (60 * 60);
int minutes = (int) durationMinusDays.minusHours(hours).getSeconds() / 60;
int seconds = (int) durationMinusDays.minusHours(hours).minusMinutes(minutes).getSeconds();
if (hours > 0) {
if (seconds > 0) {
retVal = String.format("P%dDT%dH%dM%dS", days, hours, minutes, seconds);
} else {
retVal = String.format("P%dDT%dH", days, hours);
}
} else if (minutes > 0) {
retVal = String.format("P%dDT%dM", days, minutes);
} else if (seconds > 0) {
retVal = String.format("P%dDT%dS", days, seconds);
}
} else {
retVal = String.format("P%dD", days);
}
} else {
retVal = absDuration.toString();
}
if (duration.isNegative()) {
return "-" + retVal;
} else {
return retVal;
}
}
|
class class_name[name] begin[{]
method[durationToString, return_type[type[String]], modifier[private], parameter[duration]] begin[{]
local_variable[type[String], retVal]
local_variable[type[Duration], absDuration]
local_variable[type[int], days]
if[binary_operation[call[absDuration.getSeconds, parameter[]], !=, literal[0]]] begin[{]
assign[member[.days], binary_operation[Cast(expression=MethodInvocation(arguments=[], member=getSeconds, postfix_operators=[], prefix_operators=[], qualifier=absDuration, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), /, binary_operation[binary_operation[literal[24], *, literal[60]], *, literal[60]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.days], !=, literal[0]]] begin[{]
local_variable[type[Duration], durationMinusDays]
if[binary_operation[call[durationMinusDays.getSeconds, parameter[]], !=, literal[0]]] begin[{]
local_variable[type[int], hours]
local_variable[type[int], minutes]
local_variable[type[int], seconds]
if[binary_operation[member[.hours], >, literal[0]]] begin[{]
if[binary_operation[member[.seconds], >, literal[0]]] begin[{]
assign[member[.retVal], call[String.format, parameter[literal["P%dDT%dH%dM%dS"], member[.days], member[.hours], member[.minutes], member[.seconds]]]]
else begin[{]
assign[member[.retVal], call[String.format, parameter[literal["P%dDT%dH"], member[.days], member[.hours]]]]
end[}]
else begin[{]
if[binary_operation[member[.minutes], >, literal[0]]] begin[{]
assign[member[.retVal], call[String.format, parameter[literal["P%dDT%dM"], member[.days], member[.minutes]]]]
else begin[{]
if[binary_operation[member[.seconds], >, literal[0]]] begin[{]
assign[member[.retVal], call[String.format, parameter[literal["P%dDT%dS"], member[.days], member[.seconds]]]]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
assign[member[.retVal], call[String.format, parameter[literal["P%dD"], member[.days]]]]
end[}]
else begin[{]
assign[member[.retVal], call[absDuration.toString, parameter[]]]
end[}]
if[call[duration.isNegative, parameter[]]] begin[{]
return[binary_operation[literal["-"], +, member[.retVal]]]
else begin[{]
return[member[.retVal]]
end[}]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[durationToString] operator[SEP] identifier[Duration] identifier[duration] operator[SEP] {
identifier[String] identifier[retVal] operator[=] Other[null] operator[SEP] identifier[Duration] identifier[absDuration] operator[=] identifier[duration] operator[SEP] identifier[abs] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[days] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[absDuration] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[days] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[absDuration] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[/] operator[SEP] Other[24] operator[*] Other[60] operator[*] Other[60] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[days] operator[!=] Other[0] operator[SEP] {
identifier[Duration] identifier[durationMinusDays] operator[=] identifier[absDuration] operator[SEP] identifier[minusDays] operator[SEP] identifier[days] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[durationMinusDays] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[int] identifier[hours] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[durationMinusDays] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[/] operator[SEP] Other[60] operator[*] Other[60] operator[SEP] operator[SEP] Keyword[int] identifier[minutes] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[durationMinusDays] operator[SEP] identifier[minusHours] operator[SEP] identifier[hours] operator[SEP] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[/] Other[60] operator[SEP] Keyword[int] identifier[seconds] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[durationMinusDays] operator[SEP] identifier[minusHours] operator[SEP] identifier[hours] operator[SEP] operator[SEP] identifier[minusMinutes] operator[SEP] identifier[minutes] operator[SEP] operator[SEP] identifier[getSeconds] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hours] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[seconds] operator[>] Other[0] operator[SEP] {
identifier[retVal] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[days] , identifier[hours] , identifier[minutes] , identifier[seconds] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[retVal] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[days] , identifier[hours] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[minutes] operator[>] Other[0] operator[SEP] {
identifier[retVal] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[days] , identifier[minutes] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[seconds] operator[>] Other[0] operator[SEP] {
identifier[retVal] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[days] , identifier[seconds] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[retVal] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[days] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[retVal] operator[=] identifier[absDuration] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[duration] operator[SEP] identifier[isNegative] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[retVal] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[retVal] operator[SEP]
}
}
|
public String getInitializationFooter(int numberOfPages, int selectedPage) {
StringBuffer content = new StringBuffer(1024);
content.append("top.dU(document,");
content.append(numberOfPages);
content.append(",");
content.append(selectedPage);
content.append("); \n");
// display eventual error message
if (getSettings().getErrorMessage() != null) {
// display error message as JavaScript alert
content.append("alert(\"");
content.append(CmsStringUtil.escapeJavaScript(getSettings().getErrorMessage().key(getLocale())));
content.append("\");\n");
// delete error message container in settings
getSettings().setErrorMessage(null);
}
// display eventual broadcast message(s)
String message = getBroadcastMessageString();
if (CmsStringUtil.isNotEmpty(message)) {
// display broadcast as JavaScript alert
content.append("alert(decodeURIComponent(\"");
// the user has pending messages, display them all
content.append(CmsEncoder.escapeWBlanks(message, CmsEncoder.ENCODING_UTF_8));
content.append("\"));\n");
}
content.append("}\n");
return content.toString();
}
|
class class_name[name] begin[{]
method[getInitializationFooter, return_type[type[String]], modifier[public], parameter[numberOfPages, selectedPage]] begin[{]
local_variable[type[StringBuffer], content]
call[content.append, parameter[literal["top.dU(document,"]]]
call[content.append, parameter[member[.numberOfPages]]]
call[content.append, parameter[literal[","]]]
call[content.append, parameter[member[.selectedPage]]]
call[content.append, parameter[literal["); \n"]]]
if[binary_operation[call[.getSettings, parameter[]], !=, literal[null]]] begin[{]
call[content.append, parameter[literal["alert(\""]]]
call[content.append, parameter[call[CmsStringUtil.escapeJavaScript, parameter[call[.getSettings, parameter[]]]]]]
call[content.append, parameter[literal["\");\n"]]]
call[.getSettings, parameter[]]
else begin[{]
None
end[}]
local_variable[type[String], message]
if[call[CmsStringUtil.isNotEmpty, parameter[member[.message]]]] begin[{]
call[content.append, parameter[literal["alert(decodeURIComponent(\""]]]
call[content.append, parameter[call[CmsEncoder.escapeWBlanks, parameter[member[.message], member[CmsEncoder.ENCODING_UTF_8]]]]]
call[content.append, parameter[literal["\"));\n"]]]
else begin[{]
None
end[}]
call[content.append, parameter[literal["}\n"]]]
return[call[content.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getInitializationFooter] operator[SEP] Keyword[int] identifier[numberOfPages] , Keyword[int] identifier[selectedPage] operator[SEP] {
identifier[StringBuffer] identifier[content] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[1024] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] identifier[numberOfPages] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] identifier[selectedPage] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getErrorMessage] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[escapeJavaScript] operator[SEP] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getErrorMessage] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[setErrorMessage] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[String] identifier[message] operator[=] identifier[getBroadcastMessageString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[message] operator[SEP] operator[SEP] {
identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] identifier[CmsEncoder] operator[SEP] identifier[escapeWBlanks] operator[SEP] identifier[message] , identifier[CmsEncoder] operator[SEP] identifier[ENCODING_UTF_8] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[content] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[content] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
void asyncUpdate() {
CmsRpcAction<Boolean> action = new CmsRpcAction<Boolean>() {
@Override
public void execute() {
start(200, false);
m_controller.getContainerpageService().checkContainerpageOrElementsChanged(
CmsCoreProvider.get().getStructureId(),
CmsContainerpageController.get().getData().getDetailId(),
CmsContainerpageController.get().getData().getLocale(),
this);
}
@Override
protected void onResponse(Boolean result) {
stop(false);
boolean changed = result.booleanValue();
setChanged(changed);
}
};
action.execute();
}
|
class class_name[name] begin[{]
method[asyncUpdate, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[CmsRpcAction], action]
call[action.execute, parameter[]]
end[}]
END[}]
|
Keyword[void] identifier[asyncUpdate] operator[SEP] operator[SEP] {
identifier[CmsRpcAction] operator[<] identifier[Boolean] operator[>] identifier[action] operator[=] Keyword[new] identifier[CmsRpcAction] operator[<] identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] operator[SEP] {
identifier[start] operator[SEP] Other[200] , literal[boolean] operator[SEP] operator[SEP] identifier[m_controller] operator[SEP] identifier[getContainerpageService] operator[SEP] operator[SEP] operator[SEP] identifier[checkContainerpageOrElementsChanged] operator[SEP] identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getStructureId] operator[SEP] operator[SEP] , identifier[CmsContainerpageController] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[getDetailId] operator[SEP] operator[SEP] , identifier[CmsContainerpageController] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[onResponse] operator[SEP] identifier[Boolean] identifier[result] operator[SEP] {
identifier[stop] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[boolean] identifier[changed] operator[=] identifier[result] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] identifier[setChanged] operator[SEP] identifier[changed] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[action] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
|
protected final void multiply() {
final int step = blockStripeSize, blockSize = blockStripeSize * blockStripeSize;
for (int m = fromM; m < toM; m += step) {
final int aRows = matrixA.layout.getRowsInBlock(m);
for (int k = fromK; k < toK; k += step) {
final int bCols = matrixB.layout.getColumnsInBlock(k);
final double[] cBlock = new double[aRows * bCols];
for (int n = fromN; n < toN; n += step) {
// ensure a and b are in optimal block order before
// multiplication
final double[] aBlock = matrixA.layout.toRowMajorBlock(matrixA, m, n);
final double[] bBlock = matrixB.layout.toColMajorBlock(matrixB, n, k);
if (aBlock != null && bBlock != null) {
if (aBlock.length == blockSize && bBlock.length == blockSize) {
multiplyAxB(aBlock, bBlock, cBlock, step);
} else {
int aCols = aBlock.length / aRows;
int bRows = bBlock.length / bCols;
verifyTrue(aCols == bRows, "aCols!=bRows");
multiplyRowMajorTimesColumnMajorBlocks(aBlock, bBlock, cBlock, aRows,
aCols, bCols);
}
}
}
matrixC.addBlockData(m, k, cBlock);
}
}
}
|
class class_name[name] begin[{]
method[multiply, return_type[void], modifier[final protected], parameter[]] begin[{]
local_variable[type[int], step]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRowsInBlock, postfix_operators=[], prefix_operators=[], qualifier=matrixA.layout, selectors=[], type_arguments=None), name=aRows)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnsInBlock, postfix_operators=[], prefix_operators=[], qualifier=matrixB.layout, selectors=[], type_arguments=None), name=bCols)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=aRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double)), name=cBlock)], modifiers={'final'}, type=BasicType(dimensions=[None], name=double)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=matrixA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toRowMajorBlock, postfix_operators=[], prefix_operators=[], qualifier=matrixA.layout, selectors=[], type_arguments=None), name=aBlock)], modifiers={'final'}, type=BasicType(dimensions=[None], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=matrixB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toColMajorBlock, postfix_operators=[], prefix_operators=[], qualifier=matrixB.layout, selectors=[], type_arguments=None), name=bBlock)], modifiers={'final'}, type=BasicType(dimensions=[None], name=double)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=aBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=bBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=aBlock, selectors=[]), operandr=MemberReference(member=blockSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bBlock, selectors=[]), operandr=MemberReference(member=blockSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=aBlock, selectors=[]), operandr=MemberReference(member=aRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=aCols)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bBlock, selectors=[]), operandr=MemberReference(member=bCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=bRows)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=aCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="aCols!=bRows")], member=verifyTrue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=multiplyRowMajorTimesColumnMajorBlocks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=multiplyAxB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=toN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=fromN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addBlockData, postfix_operators=[], prefix_operators=[], qualifier=matrixC, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=toK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=fromK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=toM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=fromM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=m)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[void] identifier[multiply] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[step] operator[=] identifier[blockStripeSize] , identifier[blockSize] operator[=] identifier[blockStripeSize] operator[*] identifier[blockStripeSize] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[m] operator[=] identifier[fromM] operator[SEP] identifier[m] operator[<] identifier[toM] operator[SEP] identifier[m] operator[+=] identifier[step] operator[SEP] {
Keyword[final] Keyword[int] identifier[aRows] operator[=] identifier[matrixA] operator[SEP] identifier[layout] operator[SEP] identifier[getRowsInBlock] operator[SEP] identifier[m] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] identifier[fromK] operator[SEP] identifier[k] operator[<] identifier[toK] operator[SEP] identifier[k] operator[+=] identifier[step] operator[SEP] {
Keyword[final] Keyword[int] identifier[bCols] operator[=] identifier[matrixB] operator[SEP] identifier[layout] operator[SEP] identifier[getColumnsInBlock] operator[SEP] identifier[k] operator[SEP] operator[SEP] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[cBlock] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[aRows] operator[*] identifier[bCols] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[n] operator[=] identifier[fromN] operator[SEP] identifier[n] operator[<] identifier[toN] operator[SEP] identifier[n] operator[+=] identifier[step] operator[SEP] {
Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[aBlock] operator[=] identifier[matrixA] operator[SEP] identifier[layout] operator[SEP] identifier[toRowMajorBlock] operator[SEP] identifier[matrixA] , identifier[m] , identifier[n] operator[SEP] operator[SEP] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[bBlock] operator[=] identifier[matrixB] operator[SEP] identifier[layout] operator[SEP] identifier[toColMajorBlock] operator[SEP] identifier[matrixB] , identifier[n] , identifier[k] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aBlock] operator[!=] Other[null] operator[&&] identifier[bBlock] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[aBlock] operator[SEP] identifier[length] operator[==] identifier[blockSize] operator[&&] identifier[bBlock] operator[SEP] identifier[length] operator[==] identifier[blockSize] operator[SEP] {
identifier[multiplyAxB] operator[SEP] identifier[aBlock] , identifier[bBlock] , identifier[cBlock] , identifier[step] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[aCols] operator[=] identifier[aBlock] operator[SEP] identifier[length] operator[/] identifier[aRows] operator[SEP] Keyword[int] identifier[bRows] operator[=] identifier[bBlock] operator[SEP] identifier[length] operator[/] identifier[bCols] operator[SEP] identifier[verifyTrue] operator[SEP] identifier[aCols] operator[==] identifier[bRows] , literal[String] operator[SEP] operator[SEP] identifier[multiplyRowMajorTimesColumnMajorBlocks] operator[SEP] identifier[aBlock] , identifier[bBlock] , identifier[cBlock] , identifier[aRows] , identifier[aCols] , identifier[bCols] operator[SEP] operator[SEP]
}
}
}
identifier[matrixC] operator[SEP] identifier[addBlockData] operator[SEP] identifier[m] , identifier[k] , identifier[cBlock] operator[SEP] operator[SEP]
}
}
}
|
public void saveVCard(VCard vcard) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// XEP-54 § 3.2 "A user may publish or update his or her vCard by sending an IQ of type "set" with no 'to' address…"
vcard.setTo((Jid) null);
vcard.setType(IQ.Type.set);
// Also make sure to generate a new stanza id (the given vcard could be a vcard result), in which case we don't
// want to use the same stanza id again (although it wouldn't break if we did)
vcard.setStanzaId(StanzaIdUtil.newStanzaId());
connection().createStanzaCollectorAndSend(vcard).nextResultOrThrow();
}
|
class class_name[name] begin[{]
method[saveVCard, return_type[void], modifier[public], parameter[vcard]] begin[{]
call[vcard.setTo, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=Jid, sub_type=None))]]
call[vcard.setType, parameter[member[IQ.Type.set]]]
call[vcard.setStanzaId, parameter[call[StanzaIdUtil.newStanzaId, parameter[]]]]
call[.connection, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[saveVCard] operator[SEP] identifier[VCard] identifier[vcard] operator[SEP] Keyword[throws] identifier[NoResponseException] , identifier[XMPPErrorException] , identifier[NotConnectedException] , identifier[InterruptedException] {
identifier[vcard] operator[SEP] identifier[setTo] operator[SEP] operator[SEP] identifier[Jid] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[vcard] operator[SEP] identifier[setType] operator[SEP] identifier[IQ] operator[SEP] identifier[Type] operator[SEP] identifier[set] operator[SEP] operator[SEP] identifier[vcard] operator[SEP] identifier[setStanzaId] operator[SEP] identifier[StanzaIdUtil] operator[SEP] identifier[newStanzaId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] operator[SEP] operator[SEP] identifier[createStanzaCollectorAndSend] operator[SEP] identifier[vcard] operator[SEP] operator[SEP] identifier[nextResultOrThrow] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <E> Stream<Stream<E>> group(Stream<E> stream, Predicate<? super E> splitter) {
Objects.requireNonNull(stream);
Objects.requireNonNull(splitter);
return group(stream, splitter, true);
}
|
class class_name[name] begin[{]
method[group, return_type[type[Stream]], modifier[public static], parameter[stream, splitter]] begin[{]
call[Objects.requireNonNull, parameter[member[.stream]]]
call[Objects.requireNonNull, parameter[member[.splitter]]]
return[call[.group, parameter[member[.stream], member[.splitter], literal[true]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[Stream] operator[<] identifier[Stream] operator[<] identifier[E] operator[>] operator[>] identifier[group] operator[SEP] identifier[Stream] operator[<] identifier[E] operator[>] identifier[stream] , identifier[Predicate] operator[<] operator[?] Keyword[super] identifier[E] operator[>] identifier[splitter] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[stream] operator[SEP] operator[SEP] identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[splitter] operator[SEP] operator[SEP] Keyword[return] identifier[group] operator[SEP] identifier[stream] , identifier[splitter] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public int advance(int target) throws IOException {
resetQueue();
Integer newTarget = target;
do {
newTarget = advanceToDoc(newTarget);
} while (newTarget != null);
return docId;
}
|
class class_name[name] begin[{]
method[advance, return_type[type[int]], modifier[public], parameter[target]] begin[{]
call[.resetQueue, parameter[]]
local_variable[type[Integer], newTarget]
do[binary_operation[member[.newTarget], !=, literal[null]]] begin[{]
assign[member[.newTarget], call[.advanceToDoc, parameter[member[.newTarget]]]]
end[}]
return[member[.docId]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[advance] operator[SEP] Keyword[int] identifier[target] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[resetQueue] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[newTarget] operator[=] identifier[target] operator[SEP] Keyword[do] {
identifier[newTarget] operator[=] identifier[advanceToDoc] operator[SEP] identifier[newTarget] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[newTarget] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[docId] operator[SEP]
}
|
public static short sArrayGet(short[] a, int i) {
try {
return a[i];
} catch (Throwable t) {
return a[DefaultGroovyMethodsSupport.normaliseIndex(i,a.length)];
}
}
|
class class_name[name] begin[{]
method[sArrayGet, return_type[type[short]], modifier[public static], parameter[a, i]] begin[{]
TryStatement(block=[ReturnStatement(expression=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[])], member=normaliseIndex, postfix_operators=[], prefix_operators=[], qualifier=DefaultGroovyMethodsSupport, 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[public] Keyword[static] Keyword[short] identifier[sArrayGet] operator[SEP] Keyword[short] operator[SEP] operator[SEP] identifier[a] , Keyword[int] identifier[i] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[a] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[a] operator[SEP] identifier[DefaultGroovyMethodsSupport] operator[SEP] identifier[normaliseIndex] operator[SEP] identifier[i] , identifier[a] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<String> getAnnotations() {
AnnotationBuilder result = new AnnotationBuilder();
result.add(getNotNullAnnotation());
return result.getAnnotations();
}
|
class class_name[name] begin[{]
method[getAnnotations, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[AnnotationBuilder], result]
call[result.add, parameter[call[.getNotNullAnnotation, parameter[]]]]
return[call[result.getAnnotations, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getAnnotations] operator[SEP] operator[SEP] {
identifier[AnnotationBuilder] identifier[result] operator[=] Keyword[new] identifier[AnnotationBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[getNotNullAnnotation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[getAnnotations] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.