code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
return new AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}
@Override
public void onAnimationEnd(final Animation animation) {
clearAnimation();
maximized = show;
if (maximized) {
notifyOnMaximized();
} else {
notifyOnHidden(cancel);
}
}
@Override
public void onAnimationRepeat(final Animation animation) {
}
};
} | class class_name[name] begin[{]
method[createAnimationListener, return_type[type[AnimationListener]], modifier[private], parameter[show, cancel]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onAnimationStart, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=animation, type=ReferenceType(arguments=None, dimensions=[], name=Animation, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearAnimation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maximized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=show, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=MemberReference(member=maximized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cancel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=notifyOnHidden, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=notifyOnMaximized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=onAnimationEnd, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=animation, type=ReferenceType(arguments=None, dimensions=[], name=Animation, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onAnimationRepeat, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=animation, type=ReferenceType(arguments=None, dimensions=[], name=Animation, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AnimationListener, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[AnimationListener] identifier[createAnimationListener] operator[SEP] Keyword[final] Keyword[boolean] identifier[show] , Keyword[final] Keyword[boolean] identifier[cancel] operator[SEP] {
Keyword[return] Keyword[new] identifier[AnimationListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onAnimationStart] operator[SEP] Keyword[final] identifier[Animation] identifier[animation] operator[SEP] {
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onAnimationEnd] operator[SEP] Keyword[final] identifier[Animation] identifier[animation] operator[SEP] {
identifier[clearAnimation] operator[SEP] operator[SEP] operator[SEP] identifier[maximized] operator[=] identifier[show] operator[SEP] Keyword[if] operator[SEP] identifier[maximized] operator[SEP] {
identifier[notifyOnMaximized] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[notifyOnHidden] operator[SEP] identifier[cancel] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onAnimationRepeat] operator[SEP] Keyword[final] identifier[Animation] identifier[animation] operator[SEP] {
}
} operator[SEP]
}
|
@Indexable(type = IndexableType.DELETE)
@Override
public CommerceTierPriceEntry deleteCommerceTierPriceEntry(
CommerceTierPriceEntry commerceTierPriceEntry)
throws PortalException {
return commerceTierPriceEntryPersistence.remove(commerceTierPriceEntry);
} | class class_name[name] begin[{]
method[deleteCommerceTierPriceEntry, return_type[type[CommerceTierPriceEntry]], modifier[public], parameter[commerceTierPriceEntry]] begin[{]
return[call[commerceTierPriceEntryPersistence.remove, parameter[member[.commerceTierPriceEntry]]]]
end[}]
END[}] | annotation[@] identifier[Indexable] operator[SEP] identifier[type] operator[=] identifier[IndexableType] operator[SEP] identifier[DELETE] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[CommerceTierPriceEntry] identifier[deleteCommerceTierPriceEntry] operator[SEP] identifier[CommerceTierPriceEntry] identifier[commerceTierPriceEntry] operator[SEP] Keyword[throws] identifier[PortalException] {
Keyword[return] identifier[commerceTierPriceEntryPersistence] operator[SEP] identifier[remove] operator[SEP] identifier[commerceTierPriceEntry] operator[SEP] operator[SEP]
}
|
public String getUserKeyFile() {
String location;
location = System.getProperty("X509_USER_KEY");
if (location != null) {
return location;
}
location = getProperty("userkey");
if (location != null) {
return location;
}
return ConfigUtil.discoverUserKeyLocation();
} | class class_name[name] begin[{]
method[getUserKeyFile, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], location]
assign[member[.location], call[System.getProperty, parameter[literal["X509_USER_KEY"]]]]
if[binary_operation[member[.location], !=, literal[null]]] begin[{]
return[member[.location]]
else begin[{]
None
end[}]
assign[member[.location], call[.getProperty, parameter[literal["userkey"]]]]
if[binary_operation[member[.location], !=, literal[null]]] begin[{]
return[member[.location]]
else begin[{]
None
end[}]
return[call[ConfigUtil.discoverUserKeyLocation, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getUserKeyFile] operator[SEP] operator[SEP] {
identifier[String] identifier[location] operator[SEP] identifier[location] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[location] operator[SEP]
}
identifier[location] operator[=] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[location] operator[SEP]
}
Keyword[return] identifier[ConfigUtil] operator[SEP] identifier[discoverUserKeyLocation] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T extends Comparable<? super T>> Comparator<T> naturalOrder()
{
return new Comparator<T>()
{
@Override
public int compare(T o1, T o2)
{
return o1.compareTo(Parameters.checkNotNull(o2));
}
};
} | class class_name[name] begin[{]
method[naturalOrder, return_type[type[Comparator]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=Parameters, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[T] operator[>] operator[>] identifier[Comparator] operator[<] identifier[T] operator[>] identifier[naturalOrder] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Comparator] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[T] identifier[o1] , identifier[T] identifier[o2] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[compareTo] operator[SEP] identifier[Parameters] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[o2] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
private void handleClusterEvent(ClusterMembershipEvent event) {
PrimaryTerm term = this.term;
if (term != null && event.type() == ClusterMembershipEvent.Type.MEMBER_REMOVED && event.subject().id().equals(term.primary().memberId())) {
threadContext.execute(() -> {
state = PrimitiveState.SUSPENDED;
stateChangeListeners.forEach(l -> l.accept(state));
});
}
} | class class_name[name] begin[{]
method[handleClusterEvent, return_type[void], modifier[private], parameter[event]] begin[{]
local_variable[type[PrimaryTerm], term]
if[binary_operation[binary_operation[binary_operation[member[.term], !=, literal[null]], &&, binary_operation[call[event.type, parameter[]], ==, member[ClusterMembershipEvent.Type.MEMBER_REMOVED]]], &&, call[event.subject, parameter[]]]] begin[{]
call[threadContext.execute, parameter[LambdaExpression(body=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=SUSPENDED, postfix_operators=[], prefix_operators=[], qualifier=PrimitiveState, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), parameters=[MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=forEach, postfix_operators=[], prefix_operators=[], qualifier=stateChangeListeners, selectors=[], type_arguments=None), label=None)], parameters=[])]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleClusterEvent] operator[SEP] identifier[ClusterMembershipEvent] identifier[event] operator[SEP] {
identifier[PrimaryTerm] identifier[term] operator[=] Keyword[this] operator[SEP] identifier[term] operator[SEP] Keyword[if] operator[SEP] identifier[term] operator[!=] Other[null] operator[&&] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[==] identifier[ClusterMembershipEvent] operator[SEP] identifier[Type] operator[SEP] identifier[MEMBER_REMOVED] operator[&&] identifier[event] operator[SEP] identifier[subject] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[term] operator[SEP] identifier[primary] operator[SEP] operator[SEP] operator[SEP] identifier[memberId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[threadContext] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] operator[->] {
identifier[state] operator[=] identifier[PrimitiveState] operator[SEP] identifier[SUSPENDED] operator[SEP] identifier[stateChangeListeners] operator[SEP] identifier[forEach] operator[SEP] identifier[l] operator[->] identifier[l] operator[SEP] identifier[accept] operator[SEP] identifier[state] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
}
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> onExceptionResumeNext(final MaybeSource<? extends T> next) {
ObjectHelper.requireNonNull(next, "next is null");
return RxJavaPlugins.onAssembly(new MaybeOnErrorNext<T>(this, Functions.justFunction(next), false));
} | class class_name[name] begin[{]
method[onExceptionResumeNext, return_type[type[Maybe]], modifier[final public], parameter[next]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.next], literal["next is null"]]]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=justFunction, postfix_operators=[], prefix_operators=[], qualifier=Functions, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], 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=T, sub_type=None))], dimensions=None, name=MaybeOnErrorNext, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] identifier[Maybe] operator[<] identifier[T] operator[>] identifier[onExceptionResumeNext] operator[SEP] Keyword[final] identifier[MaybeSource] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[next] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[next] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[MaybeOnErrorNext] operator[<] identifier[T] operator[>] operator[SEP] Keyword[this] , identifier[Functions] operator[SEP] identifier[justFunction] operator[SEP] identifier[next] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
public static byte isValid(String reportVersion) {
if (isOlderUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_OLDER;
} else if (isNewerUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_NEWER;
} else {
return REPORT_VALID;
}
} | class class_name[name] begin[{]
method[isValid, return_type[type[byte]], modifier[public static], parameter[reportVersion]] begin[{]
if[call[.isOlderUnsupportedVersion, parameter[member[.reportVersion]]]] begin[{]
return[member[.REPORT_INVALID_OLDER]]
else begin[{]
if[call[.isNewerUnsupportedVersion, parameter[member[.reportVersion]]]] begin[{]
return[member[.REPORT_INVALID_NEWER]]
else begin[{]
return[member[.REPORT_VALID]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] identifier[isValid] operator[SEP] identifier[String] identifier[reportVersion] operator[SEP] {
Keyword[if] operator[SEP] identifier[isOlderUnsupportedVersion] operator[SEP] identifier[reportVersion] operator[SEP] operator[SEP] {
Keyword[return] identifier[REPORT_INVALID_OLDER] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNewerUnsupportedVersion] operator[SEP] identifier[reportVersion] operator[SEP] operator[SEP] {
Keyword[return] identifier[REPORT_INVALID_NEWER] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[REPORT_VALID] operator[SEP]
}
}
|
public static int checkPreconditionsI(
final int value,
final ContractIntConditionType... conditions)
throws PreconditionViolationException
{
final Violations violations = innerCheckAllInt(value, conditions);
if (violations != null) {
throw new PreconditionViolationException(
failedMessage(Integer.valueOf(value), violations), null, violations.count());
}
return value;
} | class class_name[name] begin[{]
method[checkPreconditionsI, return_type[type[int]], modifier[public static], parameter[value, conditions]] begin[{]
local_variable[type[Violations], violations]
if[binary_operation[member[.violations], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MemberReference(member=violations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=failedMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=count, postfix_operators=[], prefix_operators=[], qualifier=violations, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PreconditionViolationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[checkPreconditionsI] operator[SEP] Keyword[final] Keyword[int] identifier[value] , Keyword[final] identifier[ContractIntConditionType] operator[...] identifier[conditions] operator[SEP] Keyword[throws] identifier[PreconditionViolationException] {
Keyword[final] identifier[Violations] identifier[violations] operator[=] identifier[innerCheckAllInt] operator[SEP] identifier[value] , identifier[conditions] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[violations] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PreconditionViolationException] operator[SEP] identifier[failedMessage] operator[SEP] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] , identifier[violations] operator[SEP] , Other[null] , identifier[violations] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
|
Rule Stem() {
return FirstOf(
Note(),
Sequence(String("["),
Note(),
//some bogus file have [CE][A]
//for one MultiNote C-E and one
//note A.
ZeroOrMoreS(Note()),
String("]"),
OptionalS(NoteLength()),
OptionalS(Tie())).label(_MultiNote)
).label(Stem);
} | class class_name[name] begin[{]
method[Stem, return_type[type[Rule]], modifier[default], parameter[]] begin[{]
return[call[.FirstOf, parameter[call[.Note, parameter[]], call[.Sequence, parameter[call[.String, parameter[literal["["]]], call[.Note, parameter[]], call[.ZeroOrMoreS, parameter[call[.Note, parameter[]]]], call[.String, parameter[literal["]"]]], call[.OptionalS, parameter[call[.NoteLength, parameter[]]]], call[.OptionalS, parameter[call[.Tie, parameter[]]]]]]]]]
end[}]
END[}] | identifier[Rule] identifier[Stem] operator[SEP] operator[SEP] {
Keyword[return] identifier[FirstOf] operator[SEP] identifier[Note] operator[SEP] operator[SEP] , identifier[Sequence] operator[SEP] identifier[String] operator[SEP] literal[String] operator[SEP] , identifier[Note] operator[SEP] operator[SEP] , identifier[ZeroOrMoreS] operator[SEP] identifier[Note] operator[SEP] operator[SEP] operator[SEP] , identifier[String] operator[SEP] literal[String] operator[SEP] , identifier[OptionalS] operator[SEP] identifier[NoteLength] operator[SEP] operator[SEP] operator[SEP] , identifier[OptionalS] operator[SEP] identifier[Tie] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[_MultiNote] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[Stem] operator[SEP] operator[SEP]
}
|
private static final boolean isDestinationPrefixValid(String destinationPrefix)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isDestinationPrefixValid", destinationPrefix);
boolean isValid = true; // Assume the prefix is valid until we know otherwise.
// null indicates that no destination prefix is being used.
if (null != destinationPrefix)
{
// Check for the length first.
int len = destinationPrefix.length();
if (len > 24)
{
isValid = false;
}
else
{
// Cycle through each character in the prefix until we find an invalid character,
// or until we come to the end of the string.
int along = 0;
while ((along < len) && isValid)
{
char c = destinationPrefix.charAt(along);
if (!(('A' <= c) && ('Z' >= c)))
{
if (!(('a' <= c) && ('z' >= c)))
{
if (!(('0' <= c) && ('9' >= c)))
{
if ('.' != c && '/' != c && '%' != c)
{
// This character isn't a valid one...
isValid = false;
}
}
}
}
// Move along to the next character in the string.
along += 1;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isDestinationPrefixValid", Boolean.valueOf(isValid));
return isValid;
} | class class_name[name] begin[{]
method[isDestinationPrefixValid, return_type[type[boolean]], modifier[final private static], parameter[destinationPrefix]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["isDestinationPrefixValid"], member[.destinationPrefix]]]
else begin[{]
None
end[}]
local_variable[type[boolean], isValid]
if[binary_operation[literal[null], !=, member[.destinationPrefix]]] begin[{]
local_variable[type[int], len]
if[binary_operation[member[.len], >, literal[24]]] begin[{]
assign[member[.isValid], literal[false]]
else begin[{]
local_variable[type[int], along]
while[binary_operation[binary_operation[member[.along], <, member[.len]], &&, member[.isValid]]] begin[{]
local_variable[type[char], c]
if[binary_operation[binary_operation[literal['A'], <=, member[.c]], &&, binary_operation[literal['Z'], >=, member[.c]]]] begin[{]
if[binary_operation[binary_operation[literal['a'], <=, member[.c]], &&, binary_operation[literal['z'], >=, member[.c]]]] begin[{]
if[binary_operation[binary_operation[literal['0'], <=, member[.c]], &&, binary_operation[literal['9'], >=, member[.c]]]] begin[{]
if[binary_operation[binary_operation[binary_operation[literal['.'], !=, member[.c]], &&, binary_operation[literal['/'], !=, member[.c]]], &&, binary_operation[literal['%'], !=, member[.c]]]] begin[{]
assign[member[.isValid], literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.along], literal[1]]
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["isDestinationPrefixValid"], call[Boolean.valueOf, parameter[member[.isValid]]]]]
else begin[{]
None
end[}]
return[member[.isValid]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] Keyword[boolean] identifier[isDestinationPrefixValid] operator[SEP] identifier[String] identifier[destinationPrefix] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[destinationPrefix] operator[SEP] operator[SEP] Keyword[boolean] identifier[isValid] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[destinationPrefix] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[destinationPrefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[>] Other[24] operator[SEP] {
identifier[isValid] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[along] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[along] operator[<] identifier[len] operator[SEP] operator[&&] identifier[isValid] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[destinationPrefix] operator[SEP] identifier[charAt] operator[SEP] identifier[along] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] operator[SEP] literal[String] operator[<=] identifier[c] operator[SEP] operator[&&] operator[SEP] literal[String] operator[>=] identifier[c] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] operator[SEP] literal[String] operator[<=] identifier[c] operator[SEP] operator[&&] operator[SEP] literal[String] operator[>=] identifier[c] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] operator[SEP] literal[String] operator[<=] identifier[c] operator[SEP] operator[&&] operator[SEP] literal[String] operator[>=] identifier[c] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[!=] identifier[c] operator[&&] literal[String] operator[!=] identifier[c] operator[&&] literal[String] operator[!=] identifier[c] operator[SEP] {
identifier[isValid] operator[=] literal[boolean] operator[SEP]
}
}
}
}
identifier[along] operator[+=] Other[1] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[isValid] operator[SEP]
}
|
public static boolean isModelCopyGroup(CmsObject cms, CmsResource resource) {
boolean result = false;
if (isModelGroup(resource)) {
try {
CmsProperty tempElementsProp = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
if (!tempElementsProp.isNullProperty()
&& CmsContainerElement.USE_AS_COPY_MODEL.equals(tempElementsProp.getValue())) {
result = true;
}
} catch (CmsException e) {
LOG.warn(e.getMessage(), e);
}
}
return result;
} | class class_name[name] begin[{]
method[isModelCopyGroup, return_type[type[boolean]], modifier[public static], parameter[cms, resource]] begin[{]
local_variable[type[boolean], result]
if[call[.isModelGroup, parameter[member[.resource]]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PROPERTY_TEMPLATE_ELEMENTS, postfix_operators=[], prefix_operators=[], qualifier=CmsPropertyDefinition, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=readPropertyObject, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None), name=tempElementsProp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsProperty, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isNullProperty, postfix_operators=[], prefix_operators=['!'], qualifier=tempElementsProp, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=tempElementsProp, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=CmsContainerElement.USE_AS_COPY_MODEL, selectors=[], type_arguments=None), 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=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=['CmsException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isModelCopyGroup] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[CmsResource] identifier[resource] operator[SEP] {
Keyword[boolean] identifier[result] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[isModelGroup] operator[SEP] identifier[resource] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[CmsProperty] identifier[tempElementsProp] operator[=] identifier[cms] operator[SEP] identifier[readPropertyObject] operator[SEP] identifier[resource] , identifier[CmsPropertyDefinition] operator[SEP] identifier[PROPERTY_TEMPLATE_ELEMENTS] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[tempElementsProp] operator[SEP] identifier[isNullProperty] operator[SEP] operator[SEP] operator[&&] identifier[CmsContainerElement] operator[SEP] identifier[USE_AS_COPY_MODEL] operator[SEP] identifier[equals] operator[SEP] identifier[tempElementsProp] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static boolean write(OutputStream os, Metadata data)
{
XmpDirectory dir = data.getFirstDirectoryOfType(XmpDirectory.class);
if (dir == null)
return false;
XMPMeta meta = dir.getXMPMeta();
try
{
SerializeOptions so = new SerializeOptions().setOmitPacketWrapper(true);
XMPMetaFactory.serialize(meta, os, so);
}
catch (XMPException e)
{
e.printStackTrace();
return false;
}
return true;
} | class class_name[name] begin[{]
method[write, return_type[type[boolean]], modifier[public static], parameter[os, data]] begin[{]
local_variable[type[XmpDirectory], dir]
if[binary_operation[member[.dir], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[XMPMeta], meta]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setOmitPacketWrapper, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SerializeOptions, sub_type=None)), name=so)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SerializeOptions, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=meta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=os, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=so, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=XMPMetaFactory, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['XMPException']))], finally_block=None, label=None, resources=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[write] operator[SEP] identifier[OutputStream] identifier[os] , identifier[Metadata] identifier[data] operator[SEP] {
identifier[XmpDirectory] identifier[dir] operator[=] identifier[data] operator[SEP] identifier[getFirstDirectoryOfType] operator[SEP] identifier[XmpDirectory] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dir] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[XMPMeta] identifier[meta] operator[=] identifier[dir] operator[SEP] identifier[getXMPMeta] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SerializeOptions] identifier[so] operator[=] Keyword[new] identifier[SerializeOptions] operator[SEP] operator[SEP] operator[SEP] identifier[setOmitPacketWrapper] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[XMPMetaFactory] operator[SEP] identifier[serialize] operator[SEP] identifier[meta] , identifier[os] , identifier[so] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[XMPException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static JSONArray getArray(JsonObject object, String key)
throws IOException {
// Get the existing one
if (object.containsKey(key)) {
Object existing = object.get(key);
if (!(existing instanceof JSONArray)) {
throw new IOException("Invalid field structure, '" + key +
"' expected to be an array, but incompatible "
+ "data type already present.");
}
return (JSONArray) existing;
// Or add a new one
} else {
JSONArray newObject = new JSONArray();
object.put(key, newObject);
return newObject;
}
} | class class_name[name] begin[{]
method[getArray, return_type[type[JSONArray]], modifier[private static], parameter[object, key]] begin[{]
if[call[object.containsKey, parameter[member[.key]]]] begin[{]
local_variable[type[Object], existing]
if[binary_operation[member[.existing], instanceof, type[JSONArray]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid field structure, '"), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' expected to be an array, but incompatible "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="data type already present."), 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[Cast(expression=MemberReference(member=existing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None))]
else begin[{]
local_variable[type[JSONArray], newObject]
call[object.put, parameter[member[.key], member[.newObject]]]
return[member[.newObject]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[JSONArray] identifier[getArray] operator[SEP] identifier[JsonObject] identifier[object] , identifier[String] identifier[key] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[object] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[Object] identifier[existing] operator[=] identifier[object] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[existing] Keyword[instanceof] identifier[JSONArray] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[JSONArray] operator[SEP] identifier[existing] operator[SEP]
}
Keyword[else] {
identifier[JSONArray] identifier[newObject] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[newObject] operator[SEP] operator[SEP] Keyword[return] identifier[newObject] operator[SEP]
}
}
|
public void parse(IVdmSourceUnit file)
{
ParseResult result;
try
{
LexLocation.resetLocations();
result = startParse(file, FileUtility.makeString(FileUtility.getContent(file.getFile())), file.getFile().getCharset());
setFileMarkers(file.getFile(), result);
if (result != null && result.getAst() != null)
{
file.reconcile(result.getAst(), result.hasParseErrors());
}
} catch (CoreException e)
{
if (VdmCore.DEBUG)
{
VdmCore.log("AbstractParserParticipant:parse IVdmSourceUnit", e);
}
}
} | class class_name[name] begin[{]
method[parse, return_type[void], modifier[public], parameter[file]] begin[{]
local_variable[type[ParseResult], result]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=resetLocations, postfix_operators=[], prefix_operators=[], qualifier=LexLocation, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=FileUtility, selectors=[], type_arguments=None)], member=makeString, postfix_operators=[], prefix_operators=[], qualifier=FileUtility, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=getCharset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=startParse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFileMarkers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAst, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAst, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=hasParseErrors, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=reconcile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=MemberReference(member=DEBUG, postfix_operators=[], prefix_operators=[], qualifier=VdmCore, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AbstractParserParticipant:parse IVdmSourceUnit"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=VdmCore, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CoreException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[parse] operator[SEP] identifier[IVdmSourceUnit] identifier[file] operator[SEP] {
identifier[ParseResult] identifier[result] operator[SEP] Keyword[try] {
identifier[LexLocation] operator[SEP] identifier[resetLocations] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[startParse] operator[SEP] identifier[file] , identifier[FileUtility] operator[SEP] identifier[makeString] operator[SEP] identifier[FileUtility] operator[SEP] identifier[getContent] operator[SEP] identifier[file] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , identifier[file] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[getCharset] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setFileMarkers] operator[SEP] identifier[file] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] , identifier[result] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[&&] identifier[result] operator[SEP] identifier[getAst] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[file] operator[SEP] identifier[reconcile] operator[SEP] identifier[result] operator[SEP] identifier[getAst] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[hasParseErrors] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[CoreException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[VdmCore] operator[SEP] identifier[DEBUG] operator[SEP] {
identifier[VdmCore] operator[SEP] identifier[log] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public void onMouseUp(MouseUpEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) {
Coordinate coordinate = getWorldPosition(event);
if (distanceLine.getOriginalLocation() == null) {
distanceLine.setGeometry(getFactory().createLineString(new Coordinate[] { coordinate }));
mapWidget.registerWorldPaintable(distanceLine);
mapWidget.registerWorldPaintable(lineSegment);
dispatchState(State.START);
} else {
Geometry geometry = (Geometry) distanceLine.getOriginalLocation();
InsertCoordinateOperation op = new InsertCoordinateOperation(geometry.getNumPoints(), coordinate);
geometry = op.execute(geometry);
distanceLine.setGeometry(geometry);
tempLength = (float) geometry.getLength();
updateMeasure(event, true);
dispatchState(State.CLICK);
}
mapWidget.render(mapWidget.getMapModel(), RenderGroup.VECTOR, RenderStatus.UPDATE);
}
} | class class_name[name] begin[{]
method[onMouseUp, return_type[void], modifier[public], parameter[event]] begin[{]
if[binary_operation[call[event.getNativeButton, parameter[]], !=, member[NativeEvent.BUTTON_RIGHT]]] begin[{]
local_variable[type[Coordinate], coordinate]
if[binary_operation[call[distanceLine.getOriginalLocation, parameter[]], ==, literal[null]]] begin[{]
call[distanceLine.setGeometry, parameter[call[.getFactory, parameter[]]]]
call[mapWidget.registerWorldPaintable, parameter[member[.distanceLine]]]
call[mapWidget.registerWorldPaintable, parameter[member[.lineSegment]]]
call[.dispatchState, parameter[member[State.START]]]
else begin[{]
local_variable[type[Geometry], geometry]
local_variable[type[InsertCoordinateOperation], op]
assign[member[.geometry], call[op.execute, parameter[member[.geometry]]]]
call[distanceLine.setGeometry, parameter[member[.geometry]]]
assign[member[.tempLength], Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=geometry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
call[.updateMeasure, parameter[member[.event], literal[true]]]
call[.dispatchState, parameter[member[State.CLICK]]]
end[}]
call[mapWidget.render, parameter[call[mapWidget.getMapModel, parameter[]], member[RenderGroup.VECTOR], member[RenderStatus.UPDATE]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[onMouseUp] operator[SEP] identifier[MouseUpEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[getNativeButton] operator[SEP] operator[SEP] operator[!=] identifier[NativeEvent] operator[SEP] identifier[BUTTON_RIGHT] operator[SEP] {
identifier[Coordinate] identifier[coordinate] operator[=] identifier[getWorldPosition] operator[SEP] identifier[event] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[distanceLine] operator[SEP] identifier[getOriginalLocation] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[distanceLine] operator[SEP] identifier[setGeometry] operator[SEP] identifier[getFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createLineString] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] operator[SEP] {
identifier[coordinate]
} operator[SEP] operator[SEP] operator[SEP] identifier[mapWidget] operator[SEP] identifier[registerWorldPaintable] operator[SEP] identifier[distanceLine] operator[SEP] operator[SEP] identifier[mapWidget] operator[SEP] identifier[registerWorldPaintable] operator[SEP] identifier[lineSegment] operator[SEP] operator[SEP] identifier[dispatchState] operator[SEP] identifier[State] operator[SEP] identifier[START] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Geometry] identifier[geometry] operator[=] operator[SEP] identifier[Geometry] operator[SEP] identifier[distanceLine] operator[SEP] identifier[getOriginalLocation] operator[SEP] operator[SEP] operator[SEP] identifier[InsertCoordinateOperation] identifier[op] operator[=] Keyword[new] identifier[InsertCoordinateOperation] operator[SEP] identifier[geometry] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] , identifier[coordinate] operator[SEP] operator[SEP] identifier[geometry] operator[=] identifier[op] operator[SEP] identifier[execute] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] identifier[distanceLine] operator[SEP] identifier[setGeometry] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] identifier[tempLength] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[geometry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] identifier[updateMeasure] operator[SEP] identifier[event] , literal[boolean] operator[SEP] operator[SEP] identifier[dispatchState] operator[SEP] identifier[State] operator[SEP] identifier[CLICK] operator[SEP] operator[SEP]
}
identifier[mapWidget] operator[SEP] identifier[render] operator[SEP] identifier[mapWidget] operator[SEP] identifier[getMapModel] operator[SEP] operator[SEP] , identifier[RenderGroup] operator[SEP] identifier[VECTOR] , identifier[RenderStatus] operator[SEP] identifier[UPDATE] operator[SEP] operator[SEP]
}
}
|
private int getIndex(PdfName key) {
for (int i = 0; i < VIEWER_PREFERENCES.length; i++) {
if (VIEWER_PREFERENCES[i].equals(key))
return i;
}
return -1;
} | class class_name[name] begin[{]
method[getIndex, return_type[type[int]], modifier[private], parameter[key]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=VIEWER_PREFERENCES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=VIEWER_PREFERENCES, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[1]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[getIndex] operator[SEP] identifier[PdfName] identifier[key] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[VIEWER_PREFERENCES] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[VIEWER_PREFERENCES] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
private String fatJarLibraryPath(String linkage, String flavor) {
String sep = "/"; //System.getProperty("file.separator");
String os_name = getUnifiedOSName();
String os_arch = System.getProperty("os.arch");
String path = sep + "lib" + sep + linkage + sep + os_name + sep + os_arch + sep;
if (null != flavor)
path += flavor + sep;
return path;
} | class class_name[name] begin[{]
method[fatJarLibraryPath, return_type[type[String]], modifier[private], parameter[linkage, flavor]] begin[{]
local_variable[type[String], sep]
local_variable[type[String], os_name]
local_variable[type[String], os_arch]
local_variable[type[String], path]
if[binary_operation[literal[null], !=, member[.flavor]]] begin[{]
assign[member[.path], binary_operation[member[.flavor], +, member[.sep]]]
else begin[{]
None
end[}]
return[member[.path]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[fatJarLibraryPath] operator[SEP] identifier[String] identifier[linkage] , identifier[String] identifier[flavor] operator[SEP] {
identifier[String] identifier[sep] operator[=] literal[String] operator[SEP] identifier[String] identifier[os_name] operator[=] identifier[getUnifiedOSName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[os_arch] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[sep] operator[+] literal[String] operator[+] identifier[sep] operator[+] identifier[linkage] operator[+] identifier[sep] operator[+] identifier[os_name] operator[+] identifier[sep] operator[+] identifier[os_arch] operator[+] identifier[sep] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[flavor] operator[SEP] identifier[path] operator[+=] identifier[flavor] operator[+] identifier[sep] operator[SEP] Keyword[return] identifier[path] operator[SEP]
}
|
public Attributes put(String key, String value) {
int i = indexOfKey(key);
if (i != NotFound)
vals[i] = value;
else
add(key, value);
return this;
} | class class_name[name] begin[{]
method[put, return_type[type[Attributes]], modifier[public], parameter[key, value]] begin[{]
local_variable[type[int], i]
if[binary_operation[member[.i], !=, member[.NotFound]]] begin[{]
assign[member[.vals], member[.value]]
else begin[{]
call[.add, parameter[member[.key], member[.value]]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Attributes] identifier[put] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOfKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[!=] identifier[NotFound] operator[SEP] identifier[vals] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[value] operator[SEP] Keyword[else] identifier[add] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void setNamespaceURI(String prefix, String namespaceURI) {
if (prefix == null)
throw new IllegalArgumentException("Cannot bind null prefix");
if (namespaceURI == null)
throw new IllegalArgumentException("Cannot set prefix to null namespace URI");
// no need to store
if (XMLConstants.XML_NS_PREFIX.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
return;
bindings.put(prefix, namespaceURI);
} | class class_name[name] begin[{]
method[setNamespaceURI, return_type[void], modifier[public], parameter[prefix, namespaceURI]] begin[{]
if[binary_operation[member[.prefix], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot bind null prefix")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.namespaceURI], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set prefix to null namespace URI")], 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[call[XMLConstants.XML_NS_PREFIX.equals, parameter[member[.prefix]]], ||, call[XMLConstants.XMLNS_ATTRIBUTE.equals, parameter[member[.prefix]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[bindings.put, parameter[member[.prefix], member[.namespaceURI]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setNamespaceURI] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[namespaceURI] operator[SEP] {
Keyword[if] operator[SEP] identifier[prefix] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[namespaceURI] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[XMLConstants] operator[SEP] identifier[XML_NS_PREFIX] operator[SEP] identifier[equals] operator[SEP] identifier[prefix] operator[SEP] operator[||] identifier[XMLConstants] operator[SEP] identifier[XMLNS_ATTRIBUTE] operator[SEP] identifier[equals] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[bindings] operator[SEP] identifier[put] operator[SEP] identifier[prefix] , identifier[namespaceURI] operator[SEP] operator[SEP]
}
|
public static void writeCompletely(WritableByteChannel channel, ByteBuffer src) throws IOException {
while (src.hasRemaining()) {
channel.write(src);
}
} | class class_name[name] begin[{]
method[writeCompletely, return_type[void], modifier[public static], parameter[channel, src]] begin[{]
while[call[src.hasRemaining, parameter[]]] begin[{]
call[channel.write, parameter[member[.src]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeCompletely] operator[SEP] identifier[WritableByteChannel] identifier[channel] , identifier[ByteBuffer] identifier[src] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[while] operator[SEP] identifier[src] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP] {
identifier[channel] operator[SEP] identifier[write] operator[SEP] identifier[src] operator[SEP] operator[SEP]
}
}
|
public void setSql(String sql) {
if (StringUtils.isNotEmpty(sql)) {
this.sql = sql.trim();
this.comment = parseComment(sql);
this.digest = MessageDigestUtils.MD5(sql);
String sqlStatement = this.sql.toLowerCase();
if (sqlStatement != null) {
this.select = sqlStatement.startsWith("select");
this.procedure = sqlStatement.startsWith("call");
}
}
} | class class_name[name] begin[{]
method[setSql, return_type[void], modifier[public], parameter[sql]] begin[{]
if[call[StringUtils.isNotEmpty, parameter[member[.sql]]]] begin[{]
assign[THIS[member[None.sql]], call[sql.trim, parameter[]]]
assign[THIS[member[None.comment]], call[.parseComment, parameter[member[.sql]]]]
assign[THIS[member[None.digest]], call[MessageDigestUtils.MD5, parameter[member[.sql]]]]
local_variable[type[String], sqlStatement]
if[binary_operation[member[.sqlStatement], !=, literal[null]]] begin[{]
assign[THIS[member[None.select]], call[sqlStatement.startsWith, parameter[literal["select"]]]]
assign[THIS[member[None.procedure]], call[sqlStatement.startsWith, parameter[literal["call"]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setSql] operator[SEP] identifier[String] identifier[sql] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[sql] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[sql] operator[=] identifier[sql] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[comment] operator[=] identifier[parseComment] operator[SEP] identifier[sql] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[digest] operator[=] identifier[MessageDigestUtils] operator[SEP] identifier[MD5] operator[SEP] identifier[sql] operator[SEP] operator[SEP] identifier[String] identifier[sqlStatement] operator[=] Keyword[this] operator[SEP] identifier[sql] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sqlStatement] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[select] operator[=] identifier[sqlStatement] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[procedure] operator[=] identifier[sqlStatement] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public static CPOptionValue findByC_ERC(long companyId,
String externalReferenceCode)
throws com.liferay.commerce.product.exception.NoSuchCPOptionValueException {
return getPersistence().findByC_ERC(companyId, externalReferenceCode);
} | class class_name[name] begin[{]
method[findByC_ERC, return_type[type[CPOptionValue]], modifier[public static], parameter[companyId, externalReferenceCode]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CPOptionValue] identifier[findByC_ERC] operator[SEP] Keyword[long] identifier[companyId] , identifier[String] identifier[externalReferenceCode] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchCPOptionValueException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByC_ERC] operator[SEP] identifier[companyId] , identifier[externalReferenceCode] operator[SEP] operator[SEP]
}
|
public static List<Group> getGroups(Atom[] rAtoms) {
List<Group> groups = new ArrayList<Group>(rAtoms.length);
for (Atom a : rAtoms) {
Group g = a.getGroup();
if (g != null)
groups.add(g);
else
logger.info("Group not found for representative Atom {}", a);
}
return groups;
} | class class_name[name] begin[{]
method[getGroups, return_type[type[List]], modifier[public static], parameter[rAtoms]] begin[{]
local_variable[type[List], groups]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getGroup, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=g)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Group not found for representative Atom {}"), MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=groups, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=rAtoms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Atom, sub_type=None))), label=None)
return[member[.groups]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Group] operator[>] identifier[getGroups] operator[SEP] identifier[Atom] operator[SEP] operator[SEP] identifier[rAtoms] operator[SEP] {
identifier[List] operator[<] identifier[Group] operator[>] identifier[groups] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Group] operator[>] operator[SEP] identifier[rAtoms] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Atom] identifier[a] operator[:] identifier[rAtoms] operator[SEP] {
identifier[Group] identifier[g] operator[=] identifier[a] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[g] operator[!=] Other[null] operator[SEP] identifier[groups] operator[SEP] identifier[add] operator[SEP] identifier[g] operator[SEP] operator[SEP] Keyword[else] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[a] operator[SEP] operator[SEP]
}
Keyword[return] identifier[groups] operator[SEP]
}
|
public <D extends Dialog> void setTypeface(D dialog, @StringRes int strResId) {
setTypeface(dialog, mApplication.getString(strResId));
} | class class_name[name] begin[{]
method[setTypeface, return_type[void], modifier[public], parameter[dialog, strResId]] begin[{]
call[.setTypeface, parameter[member[.dialog], call[mApplication.getString, parameter[member[.strResId]]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[D] Keyword[extends] identifier[Dialog] operator[>] Keyword[void] identifier[setTypeface] operator[SEP] identifier[D] identifier[dialog] , annotation[@] identifier[StringRes] Keyword[int] identifier[strResId] operator[SEP] {
identifier[setTypeface] operator[SEP] identifier[dialog] , identifier[mApplication] operator[SEP] identifier[getString] operator[SEP] identifier[strResId] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public ChargeInfo getChargeInfo(String CorpNum) throws PopbillException {
return httpget("/Cashbill/ChargeInfo", CorpNum, null, ChargeInfo.class);
} | class class_name[name] begin[{]
method[getChargeInfo, return_type[type[ChargeInfo]], modifier[public], parameter[CorpNum]] begin[{]
return[call[.httpget, parameter[literal["/Cashbill/ChargeInfo"], member[.CorpNum], literal[null], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChargeInfo, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ChargeInfo] identifier[getChargeInfo] operator[SEP] identifier[String] identifier[CorpNum] operator[SEP] Keyword[throws] identifier[PopbillException] {
Keyword[return] identifier[httpget] operator[SEP] literal[String] , identifier[CorpNum] , Other[null] , identifier[ChargeInfo] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static Set<Pair<Integer, Integer>> getTopicIdsFromContentSpec(final ContentSpec contentSpec) {
// Add the topics at this level to the database
final Set<Pair<Integer, Integer>> topicIds = new HashSet<Pair<Integer, Integer>>();
final List<SpecTopic> specTopics = contentSpec.getSpecTopics();
for (final SpecTopic specTopic : specTopics) {
if (specTopic.getDBId() != 0) {
topicIds.add(new Pair<Integer, Integer>(specTopic.getDBId(), specTopic.getRevision()));
}
}
return topicIds;
} | class class_name[name] begin[{]
method[getTopicIdsFromContentSpec, return_type[type[Set]], modifier[public static], parameter[contentSpec]] begin[{]
local_variable[type[Set], topicIds]
local_variable[type[List], specTopics]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDBId, postfix_operators=[], prefix_operators=[], qualifier=specTopic, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getDBId, postfix_operators=[], prefix_operators=[], qualifier=specTopic, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getRevision, postfix_operators=[], prefix_operators=[], qualifier=specTopic, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Pair, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=topicIds, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=specTopics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=specTopic)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=SpecTopic, sub_type=None))), label=None)
return[member[.topicIds]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] identifier[getTopicIdsFromContentSpec] operator[SEP] Keyword[final] identifier[ContentSpec] identifier[contentSpec] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] identifier[topicIds] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[SpecTopic] operator[>] identifier[specTopics] operator[=] identifier[contentSpec] operator[SEP] identifier[getSpecTopics] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[SpecTopic] identifier[specTopic] operator[:] identifier[specTopics] operator[SEP] {
Keyword[if] operator[SEP] identifier[specTopic] operator[SEP] identifier[getDBId] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[topicIds] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[SEP] identifier[specTopic] operator[SEP] identifier[getDBId] operator[SEP] operator[SEP] , identifier[specTopic] operator[SEP] identifier[getRevision] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[topicIds] operator[SEP]
}
|
public boolean useIdentityColumnField()
{
if(useIdentityColumn == 0)
{
useIdentityColumn = -1;
FieldDescriptor[] pkFields = getPkFields();
for (int i = 0; i < pkFields.length; i++)
{
// to find the identity column we search for a autoincrement
// read-only field
if (pkFields[i].isAutoIncrement() && pkFields[i].isAccessReadOnly())
{
useIdentityColumn = 1;
break;
}
}
}
return useIdentityColumn == 1;
} | class class_name[name] begin[{]
method[useIdentityColumnField, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.useIdentityColumn], ==, literal[0]]] begin[{]
assign[member[.useIdentityColumn], literal[1]]
local_variable[type[FieldDescriptor], pkFields]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pkFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=isAutoIncrement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MemberReference(member=pkFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=isAccessReadOnly, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=useIdentityColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pkFields, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[binary_operation[member[.useIdentityColumn], ==, literal[1]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[useIdentityColumnField] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[useIdentityColumn] operator[==] Other[0] operator[SEP] {
identifier[useIdentityColumn] operator[=] operator[-] Other[1] operator[SEP] identifier[FieldDescriptor] operator[SEP] operator[SEP] identifier[pkFields] operator[=] identifier[getPkFields] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pkFields] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[pkFields] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isAutoIncrement] operator[SEP] operator[SEP] operator[&&] identifier[pkFields] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isAccessReadOnly] operator[SEP] operator[SEP] operator[SEP] {
identifier[useIdentityColumn] operator[=] Other[1] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[return] identifier[useIdentityColumn] operator[==] Other[1] operator[SEP]
}
|
protected void proxyReadHandshake() {
// setup the read buffer - use JIT on the first read attempt. If it
// works, then any subsequent reads will use that same buffer.
connLink.getReadInterface().setJITAllocateSize(1024);
// reader.setBuffer(WsByteBufferPoolManagerImpl.getRef().allocate(1024));
if (connLink.isAsyncConnect()) {
// handshake - read the proxy response
this.proxyReadCB = new ProxyReadCallback();
readProxyResponse(connLink.getVirtualConnection());
} else {
int rc = STATUS_NOT_DONE;
while (rc == STATUS_NOT_DONE) {
readProxyResponse(connLink.getVirtualConnection());
rc = checkResponse(connLink.getReadInterface());
}
if (rc == STATUS_ERROR) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "could not complete proxy handshake, read request failed");
}
releaseProxyReadBuffer();
// if (null == this.syncError) {
if (connLink.isSyncError() == false) {
// create a new connect exception
connLink.connectFailed(new IOException("Invalid Proxy Server Response "));
}
}
}
} | class class_name[name] begin[{]
method[proxyReadHandshake, return_type[void], modifier[protected], parameter[]] begin[{]
call[connLink.getReadInterface, parameter[]]
if[call[connLink.isAsyncConnect, parameter[]]] begin[{]
assign[THIS[member[None.proxyReadCB]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProxyReadCallback, sub_type=None))]
call[.readProxyResponse, parameter[call[connLink.getVirtualConnection, parameter[]]]]
else begin[{]
local_variable[type[int], rc]
while[binary_operation[member[.rc], ==, member[.STATUS_NOT_DONE]]] begin[{]
call[.readProxyResponse, parameter[call[connLink.getVirtualConnection, parameter[]]]]
assign[member[.rc], call[.checkResponse, parameter[call[connLink.getReadInterface, parameter[]]]]]
end[}]
if[binary_operation[member[.rc], ==, member[.STATUS_ERROR]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["could not complete proxy handshake, read request failed"]]]
else begin[{]
None
end[}]
call[.releaseProxyReadBuffer, parameter[]]
if[binary_operation[call[connLink.isSyncError, parameter[]], ==, literal[false]]] begin[{]
call[connLink.connectFailed, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid Proxy Server Response ")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[proxyReadHandshake] operator[SEP] operator[SEP] {
identifier[connLink] operator[SEP] identifier[getReadInterface] operator[SEP] operator[SEP] operator[SEP] identifier[setJITAllocateSize] operator[SEP] Other[1024] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connLink] operator[SEP] identifier[isAsyncConnect] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[proxyReadCB] operator[=] Keyword[new] identifier[ProxyReadCallback] operator[SEP] operator[SEP] operator[SEP] identifier[readProxyResponse] operator[SEP] identifier[connLink] operator[SEP] identifier[getVirtualConnection] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[rc] operator[=] identifier[STATUS_NOT_DONE] operator[SEP] Keyword[while] operator[SEP] identifier[rc] operator[==] identifier[STATUS_NOT_DONE] operator[SEP] {
identifier[readProxyResponse] operator[SEP] identifier[connLink] operator[SEP] identifier[getVirtualConnection] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rc] operator[=] identifier[checkResponse] operator[SEP] identifier[connLink] operator[SEP] identifier[getReadInterface] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rc] operator[==] identifier[STATUS_ERROR] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
identifier[releaseProxyReadBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connLink] operator[SEP] identifier[isSyncError] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] {
identifier[connLink] operator[SEP] identifier[connectFailed] operator[SEP] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public void printMessage(Diagnostic.Kind kind, CharSequence msg) {
printMessage(kind, msg, null, null, null);
} | class class_name[name] begin[{]
method[printMessage, return_type[void], modifier[public], parameter[kind, msg]] begin[{]
call[.printMessage, parameter[member[.kind], member[.msg], literal[null], literal[null], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printMessage] operator[SEP] identifier[Diagnostic] operator[SEP] identifier[Kind] identifier[kind] , identifier[CharSequence] identifier[msg] operator[SEP] {
identifier[printMessage] operator[SEP] identifier[kind] , identifier[msg] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
private void setVersion(final Future<Void> aFuture) {
final StringBuilder specNote = new StringBuilder();
final String ptVersion = LOGGER.getMessage(MessageCodes.PT_011, PT_VERSION_NUM);
final String urlString = LOGGER.getMessage(MessageCodes.PT_012);
specNote.append(ptVersion).append(System.lineSeparator()).append(urlString);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageCodes.PT_DEBUG_005, myPath);
}
myFileSystem.writeFile(getVersionFilePath(), Buffer.buffer(specNote.toString()), result -> {
if (result.succeeded()) {
if (hasPrefix()) {
setPrefix(aFuture);
} else {
aFuture.complete();
}
} else {
aFuture.fail(result.cause());
}
});
} | class class_name[name] begin[{]
method[setVersion, return_type[void], modifier[private], parameter[aFuture]] begin[{]
local_variable[type[StringBuilder], specNote]
local_variable[type[String], ptVersion]
local_variable[type[String], urlString]
call[specNote.append, parameter[member[.ptVersion]]]
if[call[LOGGER.isDebugEnabled, parameter[]]] begin[{]
call[LOGGER.debug, parameter[member[MessageCodes.PT_DEBUG_005], member[.myPath]]]
else begin[{]
None
end[}]
call[myFileSystem.writeFile, parameter[call[.getVersionFilePath, parameter[]], call[Buffer.buffer, parameter[call[specNote.toString, parameter[]]]], LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=succeeded, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=fail, postfix_operators=[], prefix_operators=[], qualifier=aFuture, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasPrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=complete, postfix_operators=[], prefix_operators=[], qualifier=aFuture, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))], parameters=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setVersion] operator[SEP] Keyword[final] identifier[Future] operator[<] identifier[Void] operator[>] identifier[aFuture] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[specNote] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[ptVersion] operator[=] identifier[LOGGER] operator[SEP] identifier[getMessage] operator[SEP] identifier[MessageCodes] operator[SEP] identifier[PT_011] , identifier[PT_VERSION_NUM] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[urlString] operator[=] identifier[LOGGER] operator[SEP] identifier[getMessage] operator[SEP] identifier[MessageCodes] operator[SEP] identifier[PT_012] operator[SEP] operator[SEP] identifier[specNote] operator[SEP] identifier[append] operator[SEP] identifier[ptVersion] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[System] operator[SEP] identifier[lineSeparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[urlString] 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] identifier[MessageCodes] operator[SEP] identifier[PT_DEBUG_005] , identifier[myPath] operator[SEP] operator[SEP]
}
identifier[myFileSystem] operator[SEP] identifier[writeFile] operator[SEP] identifier[getVersionFilePath] operator[SEP] operator[SEP] , identifier[Buffer] operator[SEP] identifier[buffer] operator[SEP] identifier[specNote] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] , identifier[result] operator[->] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[succeeded] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasPrefix] operator[SEP] operator[SEP] operator[SEP] {
identifier[setPrefix] operator[SEP] identifier[aFuture] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[aFuture] operator[SEP] identifier[complete] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[aFuture] operator[SEP] identifier[fail] operator[SEP] identifier[result] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public void marshall(StopApplicationRequest stopApplicationRequest, ProtocolMarshaller protocolMarshaller) {
if (stopApplicationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopApplicationRequest.getApplicationName(), APPLICATIONNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[stopApplicationRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.stopApplicationRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getApplicationName, postfix_operators=[], prefix_operators=[], qualifier=stopApplicationRequest, selectors=[], type_arguments=None), MemberReference(member=APPLICATIONNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[StopApplicationRequest] identifier[stopApplicationRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[stopApplicationRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[stopApplicationRequest] operator[SEP] identifier[getApplicationName] operator[SEP] operator[SEP] , identifier[APPLICATIONNAME_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public ApiResponse<List<CorporationContactsLabelsResponse>> getCorporationsCorporationIdContactsLabelsWithHttpInfo(
Integer corporationId, String datasource, String ifNoneMatch, String token) throws ApiException {
com.squareup.okhttp.Call call = getCorporationsCorporationIdContactsLabelsValidateBeforeCall(corporationId,
datasource, ifNoneMatch, token, null);
Type localVarReturnType = new TypeToken<List<CorporationContactsLabelsResponse>>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[getCorporationsCorporationIdContactsLabelsWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[corporationId, datasource, ifNoneMatch, token]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[List] operator[<] identifier[CorporationContactsLabelsResponse] operator[>] operator[>] identifier[getCorporationsCorporationIdContactsLabelsWithHttpInfo] operator[SEP] identifier[Integer] identifier[corporationId] , identifier[String] identifier[datasource] , identifier[String] identifier[ifNoneMatch] , identifier[String] identifier[token] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[getCorporationsCorporationIdContactsLabelsValidateBeforeCall] operator[SEP] identifier[corporationId] , identifier[datasource] , identifier[ifNoneMatch] , identifier[token] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[List] operator[<] identifier[CorporationContactsLabelsResponse] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public void setDirectEditProvider(I_CmsDirectEditProvider clazz) {
m_directEditProvider = clazz;
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_DIRECT_EDIT_PROVIDER_1,
m_directEditProvider.getClass().getName()));
}
} | class class_name[name] begin[{]
method[setDirectEditProvider, return_type[void], modifier[public], parameter[clazz]] begin[{]
assign[member[.m_directEditProvider], member[.clazz]]
if[call[CmsLog.INIT.isInfoEnabled, parameter[]]] begin[{]
call[CmsLog.INIT.info, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setDirectEditProvider] operator[SEP] identifier[I_CmsDirectEditProvider] identifier[clazz] operator[SEP] {
identifier[m_directEditProvider] operator[=] identifier[clazz] operator[SEP] Keyword[if] operator[SEP] identifier[CmsLog] operator[SEP] identifier[INIT] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsLog] operator[SEP] identifier[INIT] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[INIT_DIRECT_EDIT_PROVIDER_1] , identifier[m_directEditProvider] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void marshall(DescribeImportTasksRequest describeImportTasksRequest, ProtocolMarshaller protocolMarshaller) {
if (describeImportTasksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeImportTasksRequest.getFilters(), FILTERS_BINDING);
protocolMarshaller.marshall(describeImportTasksRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeImportTasksRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[describeImportTasksRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeImportTasksRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFilters, postfix_operators=[], prefix_operators=[], qualifier=describeImportTasksRequest, selectors=[], type_arguments=None), MemberReference(member=FILTERS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMaxResults, postfix_operators=[], prefix_operators=[], qualifier=describeImportTasksRequest, selectors=[], type_arguments=None), MemberReference(member=MAXRESULTS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=describeImportTasksRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DescribeImportTasksRequest] identifier[describeImportTasksRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeImportTasksRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeImportTasksRequest] operator[SEP] identifier[getFilters] operator[SEP] operator[SEP] , identifier[FILTERS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeImportTasksRequest] operator[SEP] identifier[getMaxResults] operator[SEP] operator[SEP] , identifier[MAXRESULTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeImportTasksRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
static public void logError(String msg) {
AnalysisContext currentAnalysisContext2 = currentAnalysisContext();
if (currentAnalysisContext2 == null) {
return;
}
currentAnalysisContext2.logAnError(msg);
} | class class_name[name] begin[{]
method[logError, return_type[void], modifier[public static], parameter[msg]] begin[{]
local_variable[type[AnalysisContext], currentAnalysisContext2]
if[binary_operation[member[.currentAnalysisContext2], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[currentAnalysisContext2.logAnError, parameter[member[.msg]]]
end[}]
END[}] | Keyword[static] Keyword[public] Keyword[void] identifier[logError] operator[SEP] identifier[String] identifier[msg] operator[SEP] {
identifier[AnalysisContext] identifier[currentAnalysisContext2] operator[=] identifier[currentAnalysisContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentAnalysisContext2] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[currentAnalysisContext2] operator[SEP] identifier[logAnError] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
|
public Observable<Page<JobResponseInner>> listJobsAsync(final String resourceGroupName, final String resourceName) {
return listJobsWithServiceResponseAsync(resourceGroupName, resourceName)
.map(new Func1<ServiceResponse<Page<JobResponseInner>>, Page<JobResponseInner>>() {
@Override
public Page<JobResponseInner> call(ServiceResponse<Page<JobResponseInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listJobsAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, resourceName]] begin[{]
return[call[.listJobsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.resourceName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[JobResponseInner] operator[>] operator[>] identifier[listJobsAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[resourceName] operator[SEP] {
Keyword[return] identifier[listJobsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[resourceName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[JobResponseInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[JobResponseInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[JobResponseInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[JobResponseInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
@CheckForNull
public Language get(String languageKey) {
org.sonar.api.resources.Language language = languages.get(languageKey);
return language != null ? new Language(language.getKey(), language.getName(), language.getFileSuffixes()) : null;
} | class class_name[name] begin[{]
method[get, return_type[type[Language]], modifier[public], parameter[languageKey]] begin[{]
local_variable[type[org], language]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=language, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=language, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFileSuffixes, postfix_operators=[], prefix_operators=[], qualifier=language, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Language, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[CheckForNull] Keyword[public] identifier[Language] identifier[get] operator[SEP] identifier[String] identifier[languageKey] operator[SEP] {
identifier[org] operator[SEP] identifier[sonar] operator[SEP] identifier[api] operator[SEP] identifier[resources] operator[SEP] identifier[Language] identifier[language] operator[=] identifier[languages] operator[SEP] identifier[get] operator[SEP] identifier[languageKey] operator[SEP] operator[SEP] Keyword[return] identifier[language] operator[!=] Other[null] operator[?] Keyword[new] identifier[Language] operator[SEP] identifier[language] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[language] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[language] operator[SEP] identifier[getFileSuffixes] operator[SEP] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
protected void toggleSelection(CmsTreeItem item, boolean changeState) {
boolean select = item.getCheckBox().isChecked();
select = changeState ? !select : select;
if (m_isSingleSelection) {
m_selectedCategories.clear();
uncheckAll(m_scrollList);
}
if (select) {
if (m_isSingleSelection) {
m_singleResult = item.getId();
}
CmsTreeItem currentItem = item;
do {
currentItem.getCheckBox().setChecked(true);
String id = currentItem.getId();
if (!m_selectedCategories.contains(id)) {
m_selectedCategories.add(id);
}
currentItem = currentItem.getParentItem();
} while (currentItem != null);
} else {
if (m_isSingleSelection) {
m_singleResult = "";
}
deselectChildren(item);
CmsTreeItem currentItem = item;
do {
currentItem.getCheckBox().setChecked(false);
String id = currentItem.getId();
if (m_selectedCategories.contains(id)) {
m_selectedCategories.remove(id);
}
currentItem = currentItem.getParentItem();
} while ((currentItem != null) && !hasSelectedChildren(currentItem));
}
fireValueChange();
} | class class_name[name] begin[{]
method[toggleSelection, return_type[void], modifier[protected], parameter[item, changeState]] begin[{]
local_variable[type[boolean], select]
assign[member[.select], TernaryExpression(condition=MemberReference(member=changeState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=select, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=select, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]))]
if[member[.m_isSingleSelection]] begin[{]
call[m_selectedCategories.clear, parameter[]]
call[.uncheckAll, parameter[member[.m_scrollList]]]
else begin[{]
None
end[}]
if[member[.select]] begin[{]
if[member[.m_isSingleSelection]] begin[{]
assign[member[.m_singleResult], call[item.getId, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[CmsTreeItem], currentItem]
do[binary_operation[member[.currentItem], !=, literal[null]]] begin[{]
call[currentItem.getCheckBox, parameter[]]
local_variable[type[String], id]
if[call[m_selectedCategories.contains, parameter[member[.id]]]] begin[{]
call[m_selectedCategories.add, parameter[member[.id]]]
else begin[{]
None
end[}]
assign[member[.currentItem], call[currentItem.getParentItem, parameter[]]]
end[}]
else begin[{]
if[member[.m_isSingleSelection]] begin[{]
assign[member[.m_singleResult], literal[""]]
else begin[{]
None
end[}]
call[.deselectChildren, parameter[member[.item]]]
local_variable[type[CmsTreeItem], currentItem]
do[binary_operation[binary_operation[member[.currentItem], !=, literal[null]], &&, call[.hasSelectedChildren, parameter[member[.currentItem]]]]] begin[{]
call[currentItem.getCheckBox, parameter[]]
local_variable[type[String], id]
if[call[m_selectedCategories.contains, parameter[member[.id]]]] begin[{]
call[m_selectedCategories.remove, parameter[member[.id]]]
else begin[{]
None
end[}]
assign[member[.currentItem], call[currentItem.getParentItem, parameter[]]]
end[}]
end[}]
call[.fireValueChange, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[toggleSelection] operator[SEP] identifier[CmsTreeItem] identifier[item] , Keyword[boolean] identifier[changeState] operator[SEP] {
Keyword[boolean] identifier[select] operator[=] identifier[item] operator[SEP] identifier[getCheckBox] operator[SEP] operator[SEP] operator[SEP] identifier[isChecked] operator[SEP] operator[SEP] operator[SEP] identifier[select] operator[=] identifier[changeState] operator[?] operator[!] identifier[select] operator[:] identifier[select] operator[SEP] Keyword[if] operator[SEP] identifier[m_isSingleSelection] operator[SEP] {
identifier[m_selectedCategories] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[uncheckAll] operator[SEP] identifier[m_scrollList] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[select] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_isSingleSelection] operator[SEP] {
identifier[m_singleResult] operator[=] identifier[item] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[CmsTreeItem] identifier[currentItem] operator[=] identifier[item] operator[SEP] Keyword[do] {
identifier[currentItem] operator[SEP] identifier[getCheckBox] operator[SEP] operator[SEP] operator[SEP] identifier[setChecked] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] identifier[currentItem] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_selectedCategories] operator[SEP] identifier[contains] operator[SEP] identifier[id] operator[SEP] operator[SEP] {
identifier[m_selectedCategories] operator[SEP] identifier[add] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
identifier[currentItem] operator[=] identifier[currentItem] operator[SEP] identifier[getParentItem] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[currentItem] operator[!=] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[m_isSingleSelection] operator[SEP] {
identifier[m_singleResult] operator[=] literal[String] operator[SEP]
}
identifier[deselectChildren] operator[SEP] identifier[item] operator[SEP] operator[SEP] identifier[CmsTreeItem] identifier[currentItem] operator[=] identifier[item] operator[SEP] Keyword[do] {
identifier[currentItem] operator[SEP] identifier[getCheckBox] operator[SEP] operator[SEP] operator[SEP] identifier[setChecked] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] identifier[currentItem] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_selectedCategories] operator[SEP] identifier[contains] operator[SEP] identifier[id] operator[SEP] operator[SEP] {
identifier[m_selectedCategories] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
identifier[currentItem] operator[=] identifier[currentItem] operator[SEP] identifier[getParentItem] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[SEP] identifier[currentItem] operator[!=] Other[null] operator[SEP] operator[&&] operator[!] identifier[hasSelectedChildren] operator[SEP] identifier[currentItem] operator[SEP] operator[SEP] operator[SEP]
}
identifier[fireValueChange] operator[SEP] operator[SEP] operator[SEP]
}
|
private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
if (isLongClick) {
if (adapterView.getOnItemLongClickListener() != null)
adapterView.getOnItemLongClickListener().onItemLongClick(adapterView, this, position, id);
} else {
if (adapterView.getOnItemClickListener() != null)
adapterView.getOnItemClickListener().onItemClick(adapterView, this, position, id);
}
}
} | class class_name[name] begin[{]
method[sendClickEvent, return_type[void], modifier[private], parameter[isLongClick]] begin[{]
if[binary_operation[call[.getParent, parameter[]], instanceof, type[AdapterView]]] begin[{]
local_variable[type[AdapterView], adapterView]
local_variable[type[int], position]
local_variable[type[long], id]
if[member[.isLongClick]] begin[{]
if[binary_operation[call[adapterView.getOnItemLongClickListener, parameter[]], !=, literal[null]]] begin[{]
call[adapterView.getOnItemLongClickListener, parameter[]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[call[adapterView.getOnItemClickListener, parameter[]], !=, literal[null]]] begin[{]
call[adapterView.getOnItemClickListener, parameter[]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[sendClickEvent] operator[SEP] Keyword[final] identifier[Boolean] identifier[isLongClick] operator[SEP] {
Keyword[if] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] Keyword[instanceof] identifier[AdapterView] operator[SEP] {
Keyword[final] identifier[AdapterView] identifier[adapterView] operator[=] operator[SEP] identifier[AdapterView] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[position] operator[=] identifier[adapterView] operator[SEP] identifier[getPositionForView] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[id] operator[=] identifier[adapterView] operator[SEP] identifier[getItemIdAtPosition] operator[SEP] identifier[position] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isLongClick] operator[SEP] {
Keyword[if] operator[SEP] identifier[adapterView] operator[SEP] identifier[getOnItemLongClickListener] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[adapterView] operator[SEP] identifier[getOnItemLongClickListener] operator[SEP] operator[SEP] operator[SEP] identifier[onItemLongClick] operator[SEP] identifier[adapterView] , Keyword[this] , identifier[position] , identifier[id] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[adapterView] operator[SEP] identifier[getOnItemClickListener] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[adapterView] operator[SEP] identifier[getOnItemClickListener] operator[SEP] operator[SEP] operator[SEP] identifier[onItemClick] operator[SEP] identifier[adapterView] , Keyword[this] , identifier[position] , identifier[id] operator[SEP] operator[SEP]
}
}
}
|
public static FieldScope allowingFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return FieldScopeImpl.createAllowingFieldDescriptors(asList(firstFieldDescriptor, rest));
} | class class_name[name] begin[{]
method[allowingFieldDescriptors, return_type[type[FieldScope]], modifier[public static], parameter[firstFieldDescriptor, rest]] begin[{]
return[call[FieldScopeImpl.createAllowingFieldDescriptors, parameter[call[.asList, parameter[member[.firstFieldDescriptor], member[.rest]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FieldScope] identifier[allowingFieldDescriptors] operator[SEP] identifier[FieldDescriptor] identifier[firstFieldDescriptor] , identifier[FieldDescriptor] operator[...] identifier[rest] operator[SEP] {
Keyword[return] identifier[FieldScopeImpl] operator[SEP] identifier[createAllowingFieldDescriptors] operator[SEP] identifier[asList] operator[SEP] identifier[firstFieldDescriptor] , identifier[rest] operator[SEP] operator[SEP] operator[SEP]
}
|
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {
for (RejectAttributeChecker checker : checks) {
rejectedAttributes.checkAttribute(checker, name, attributeValue);
}
} | class class_name[name] begin[{]
method[rejectAttributes, return_type[void], modifier[default], parameter[rejectedAttributes, attributeValue]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=checker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attributeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkAttribute, postfix_operators=[], prefix_operators=[], qualifier=rejectedAttributes, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=checks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=checker)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RejectAttributeChecker, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[rejectAttributes] operator[SEP] identifier[RejectedAttributesLogContext] identifier[rejectedAttributes] , identifier[ModelNode] identifier[attributeValue] operator[SEP] {
Keyword[for] operator[SEP] identifier[RejectAttributeChecker] identifier[checker] operator[:] identifier[checks] operator[SEP] {
identifier[rejectedAttributes] operator[SEP] identifier[checkAttribute] operator[SEP] identifier[checker] , identifier[name] , identifier[attributeValue] operator[SEP] operator[SEP]
}
}
|
public List<Type> union(List<Type> cl1, List<Type> cl2, BiPredicate<Type, Type> shouldSkip) {
if (cl1.isEmpty()) {
return cl2;
} else if (cl2.isEmpty()) {
return cl1;
} else if (shouldSkip.test(cl1.head, cl2.head)) {
return union(cl1.tail, cl2.tail, shouldSkip).prepend(cl1.head);
} else if (cl1.head.tsym.precedes(cl2.head.tsym, this)) {
return union(cl1.tail, cl2, shouldSkip).prepend(cl1.head);
} else if (cl2.head.tsym.precedes(cl1.head.tsym, this)) {
return union(cl1, cl2.tail, shouldSkip).prepend(cl2.head);
} else {
// unrelated types
return union(cl1.tail, cl2, shouldSkip).prepend(cl1.head);
}
} | class class_name[name] begin[{]
method[union, return_type[type[List]], modifier[public], parameter[cl1, cl2, shouldSkip]] begin[{]
if[call[cl1.isEmpty, parameter[]]] begin[{]
return[member[.cl2]]
else begin[{]
if[call[cl2.isEmpty, parameter[]]] begin[{]
return[member[.cl1]]
else begin[{]
if[call[shouldSkip.test, parameter[member[cl1.head], member[cl2.head]]]] begin[{]
return[call[.union, parameter[member[cl1.tail], member[cl2.tail], member[.shouldSkip]]]]
else begin[{]
if[call[cl1.head.tsym.precedes, parameter[member[cl2.head.tsym], THIS[]]]] begin[{]
return[call[.union, parameter[member[cl1.tail], member[.cl2], member[.shouldSkip]]]]
else begin[{]
if[call[cl2.head.tsym.precedes, parameter[member[cl1.head.tsym], THIS[]]]] begin[{]
return[call[.union, parameter[member[.cl1], member[cl2.tail], member[.shouldSkip]]]]
else begin[{]
return[call[.union, parameter[member[cl1.tail], member[.cl2], member[.shouldSkip]]]]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Type] operator[>] identifier[union] operator[SEP] identifier[List] operator[<] identifier[Type] operator[>] identifier[cl1] , identifier[List] operator[<] identifier[Type] operator[>] identifier[cl2] , identifier[BiPredicate] operator[<] identifier[Type] , identifier[Type] operator[>] identifier[shouldSkip] operator[SEP] {
Keyword[if] operator[SEP] identifier[cl1] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[cl2] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cl2] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[cl1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[shouldSkip] operator[SEP] identifier[test] operator[SEP] identifier[cl1] operator[SEP] identifier[head] , identifier[cl2] operator[SEP] identifier[head] operator[SEP] operator[SEP] {
Keyword[return] identifier[union] operator[SEP] identifier[cl1] operator[SEP] identifier[tail] , identifier[cl2] operator[SEP] identifier[tail] , identifier[shouldSkip] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[cl1] operator[SEP] identifier[head] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cl1] operator[SEP] identifier[head] operator[SEP] identifier[tsym] operator[SEP] identifier[precedes] operator[SEP] identifier[cl2] operator[SEP] identifier[head] operator[SEP] identifier[tsym] , Keyword[this] operator[SEP] operator[SEP] {
Keyword[return] identifier[union] operator[SEP] identifier[cl1] operator[SEP] identifier[tail] , identifier[cl2] , identifier[shouldSkip] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[cl1] operator[SEP] identifier[head] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cl2] operator[SEP] identifier[head] operator[SEP] identifier[tsym] operator[SEP] identifier[precedes] operator[SEP] identifier[cl1] operator[SEP] identifier[head] operator[SEP] identifier[tsym] , Keyword[this] operator[SEP] operator[SEP] {
Keyword[return] identifier[union] operator[SEP] identifier[cl1] , identifier[cl2] operator[SEP] identifier[tail] , identifier[shouldSkip] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[cl2] operator[SEP] identifier[head] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[union] operator[SEP] identifier[cl1] operator[SEP] identifier[tail] , identifier[cl2] , identifier[shouldSkip] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[cl1] operator[SEP] identifier[head] operator[SEP] operator[SEP]
}
}
|
public static <T> T assertNotNull(T value, String message) {
if (value == null)
throw new IllegalStateException(message);
return value;
} | class class_name[name] begin[{]
method[assertNotNull, return_type[type[T]], modifier[public static], parameter[value, message]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, 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=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[assertNotNull] operator[SEP] identifier[T] identifier[value] , identifier[String] identifier[message] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public String formatMessage(String key, Object[] args) {
assert _resourceProvider != null : "Received a null resource provider";
return _resourceProvider.formatMessage(key, args);
} | class class_name[name] begin[{]
method[formatMessage, return_type[type[String]], modifier[public], parameter[key, args]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=_resourceProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received a null resource provider"))
return[call[_resourceProvider.formatMessage, parameter[member[.key], member[.args]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[formatMessage] operator[SEP] identifier[String] identifier[key] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[assert] identifier[_resourceProvider] operator[!=] Other[null] operator[:] literal[String] operator[SEP] Keyword[return] identifier[_resourceProvider] operator[SEP] identifier[formatMessage] operator[SEP] identifier[key] , identifier[args] operator[SEP] operator[SEP]
}
|
protected void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException {
// TODO: Max size configuration, to avoid DOS attacks? OutOfMemory
// Size parameters
int width = ServletUtil.getIntParameter(pRequest, sizeWidthParam, -1);
int height = ServletUtil.getIntParameter(pRequest, sizeHeightParam, -1);
if (width > 0 || height > 0) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE, new Dimension(width, height));
}
// Size uniform/percent
boolean uniform = ServletUtil.getBooleanParameter(pRequest, sizeUniformParam, true);
if (!uniform) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_UNIFORM, Boolean.FALSE);
}
boolean percent = ServletUtil.getBooleanParameter(pRequest, sizePercentParam, false);
if (percent) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_PERCENT, Boolean.TRUE);
}
// Area of interest parameters
int x = ServletUtil.getIntParameter(pRequest, regionLeftParam, -1); // Default is center
int y = ServletUtil.getIntParameter(pRequest, regionTopParam, -1); // Default is center
width = ServletUtil.getIntParameter(pRequest, regionWidthParam, -1);
height = ServletUtil.getIntParameter(pRequest, regionHeightParam, -1);
if (width > 0 || height > 0) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_AOI, new Rectangle(x, y, width, height));
}
// AOI uniform/percent
uniform = ServletUtil.getBooleanParameter(pRequest, regionUniformParam, false);
if (uniform) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_UNIFORM, Boolean.TRUE);
}
percent = ServletUtil.getBooleanParameter(pRequest, regionPercentParam, false);
if (percent) {
pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_PERCENT, Boolean.TRUE);
}
super.doFilterImpl(pRequest, pResponse, pChain);
} | class class_name[name] begin[{]
method[doFilterImpl, return_type[void], modifier[protected], parameter[pRequest, pResponse, pChain]] begin[{]
local_variable[type[int], width]
local_variable[type[int], height]
if[binary_operation[binary_operation[member[.width], >, literal[0]], ||, binary_operation[member[.height], >, literal[0]]]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_SIZE], ClassCreator(arguments=[MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, 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=Dimension, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[boolean], uniform]
if[member[.uniform]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_SIZE_UNIFORM], member[Boolean.FALSE]]]
else begin[{]
None
end[}]
local_variable[type[boolean], percent]
if[member[.percent]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_SIZE_PERCENT], member[Boolean.TRUE]]]
else begin[{]
None
end[}]
local_variable[type[int], x]
local_variable[type[int], y]
assign[member[.width], call[ServletUtil.getIntParameter, parameter[member[.pRequest], member[.regionWidthParam], literal[1]]]]
assign[member[.height], call[ServletUtil.getIntParameter, parameter[member[.pRequest], member[.regionHeightParam], literal[1]]]]
if[binary_operation[binary_operation[member[.width], >, literal[0]], ||, binary_operation[member[.height], >, literal[0]]]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_AOI], ClassCreator(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, 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=Rectangle, sub_type=None))]]
else begin[{]
None
end[}]
assign[member[.uniform], call[ServletUtil.getBooleanParameter, parameter[member[.pRequest], member[.regionUniformParam], literal[false]]]]
if[member[.uniform]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_SIZE_UNIFORM], member[Boolean.TRUE]]]
else begin[{]
None
end[}]
assign[member[.percent], call[ServletUtil.getBooleanParameter, parameter[member[.pRequest], member[.regionPercentParam], literal[false]]]]
if[member[.percent]] begin[{]
call[pRequest.setAttribute, parameter[member[ImageServletResponse.ATTRIB_SIZE_PERCENT], member[Boolean.TRUE]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=pRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pChain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doFilterImpl, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[doFilterImpl] operator[SEP] identifier[ServletRequest] identifier[pRequest] , identifier[ServletResponse] identifier[pResponse] , identifier[FilterChain] identifier[pChain] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ServletException] {
Keyword[int] identifier[width] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[sizeWidthParam] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[sizeHeightParam] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[width] operator[>] Other[0] operator[||] identifier[height] operator[>] Other[0] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_SIZE] , Keyword[new] identifier[Dimension] operator[SEP] identifier[width] , identifier[height] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[uniform] operator[=] identifier[ServletUtil] operator[SEP] identifier[getBooleanParameter] operator[SEP] identifier[pRequest] , identifier[sizeUniformParam] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[uniform] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_SIZE_UNIFORM] , identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[percent] operator[=] identifier[ServletUtil] operator[SEP] identifier[getBooleanParameter] operator[SEP] identifier[pRequest] , identifier[sizePercentParam] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[percent] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_SIZE_PERCENT] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP]
}
Keyword[int] identifier[x] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[regionLeftParam] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[y] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[regionTopParam] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[width] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[regionWidthParam] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[height] operator[=] identifier[ServletUtil] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[pRequest] , identifier[regionHeightParam] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[width] operator[>] Other[0] operator[||] identifier[height] operator[>] Other[0] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_AOI] , Keyword[new] identifier[Rectangle] operator[SEP] identifier[x] , identifier[y] , identifier[width] , identifier[height] operator[SEP] operator[SEP] operator[SEP]
}
identifier[uniform] operator[=] identifier[ServletUtil] operator[SEP] identifier[getBooleanParameter] operator[SEP] identifier[pRequest] , identifier[regionUniformParam] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uniform] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_SIZE_UNIFORM] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP]
}
identifier[percent] operator[=] identifier[ServletUtil] operator[SEP] identifier[getBooleanParameter] operator[SEP] identifier[pRequest] , identifier[regionPercentParam] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[percent] operator[SEP] {
identifier[pRequest] operator[SEP] identifier[setAttribute] operator[SEP] identifier[ImageServletResponse] operator[SEP] identifier[ATTRIB_SIZE_PERCENT] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[doFilterImpl] operator[SEP] identifier[pRequest] , identifier[pResponse] , identifier[pChain] operator[SEP] operator[SEP]
}
|
public List<CmsRole> getRolesForResource(CmsRequestContext context, CmsUser user, CmsResource resource)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
List<CmsRole> result = null;
try {
result = m_driverManager.getRolesForResource(dbc, user, resource);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_GET_ROLES_FOR_RESOURCE_2,
user.getName(),
context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} | class class_name[name] begin[{]
method[getRolesForResource, return_type[type[List]], modifier[public], parameter[context, user, resource]] begin[{]
local_variable[type[CmsDbContext], dbc]
local_variable[type[List], result]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRolesForResource, postfix_operators=[], prefix_operators=[], qualifier=m_driverManager, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_GET_ROLES_FOR_RESOURCE_2, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSitePath, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None)], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=report, postfix_operators=[], prefix_operators=[], qualifier=dbc, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=dbc, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[CmsRole] operator[>] identifier[getRolesForResource] operator[SEP] identifier[CmsRequestContext] identifier[context] , identifier[CmsUser] identifier[user] , identifier[CmsResource] identifier[resource] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[CmsDbContext] identifier[dbc] operator[=] identifier[m_dbContextFactory] operator[SEP] identifier[getDbContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CmsRole] operator[>] identifier[result] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[result] operator[=] identifier[m_driverManager] operator[SEP] identifier[getRolesForResource] operator[SEP] identifier[dbc] , identifier[user] , identifier[resource] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[dbc] operator[SEP] identifier[report] operator[SEP] Other[null] , identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_GET_ROLES_FOR_RESOURCE_2] , identifier[user] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[context] operator[SEP] identifier[getSitePath] operator[SEP] identifier[resource] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[dbc] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public BigramCollocation[] find(Corpus corpus, int k) {
BigramCollocation[] bigrams = new BigramCollocation[k];
HeapSelect<BigramCollocation> heap = new HeapSelect<>(bigrams);
Iterator<Bigram> iterator = corpus.getBigrams();
while (iterator.hasNext()) {
Bigram bigram = iterator.next();
int c12 = corpus.getBigramFrequency(bigram);
if (c12 > minFreq) {
int c1 = corpus.getTermFrequency(bigram.w1);
int c2 = corpus.getTermFrequency(bigram.w2);
double score = likelihoodRatio(c1, c2, c12, corpus.size());
heap.add(new BigramCollocation(bigram.w1, bigram.w2, c12, -score));
}
}
heap.sort();
BigramCollocation[] collocations = new BigramCollocation[k];
for (int i = 0; i < k; i++) {
BigramCollocation bigram = bigrams[k-i-1];
collocations[i] = new BigramCollocation(bigram.w1(), bigram.w2(), bigram.frequency(), -bigram.score());
}
return collocations;
} | class class_name[name] begin[{]
method[find, return_type[type[BigramCollocation]], modifier[public], parameter[corpus, k]] begin[{]
local_variable[type[BigramCollocation], bigrams]
local_variable[type[HeapSelect], heap]
local_variable[type[Iterator], iterator]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[Bigram], bigram]
local_variable[type[int], c12]
if[binary_operation[member[.c12], >, member[.minFreq]]] begin[{]
local_variable[type[int], c1]
local_variable[type[int], c2]
local_variable[type[double], score]
call[heap.add, parameter[ClassCreator(arguments=[MemberReference(member=w1, postfix_operators=[], prefix_operators=[], qualifier=bigram, selectors=[]), MemberReference(member=w2, postfix_operators=[], prefix_operators=[], qualifier=bigram, selectors=[]), MemberReference(member=c12, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=score, 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=BigramCollocation, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
call[heap.sort, parameter[]]
local_variable[type[BigramCollocation], collocations]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=bigrams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=k, 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=-))]), name=bigram)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigramCollocation, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=collocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=w1, postfix_operators=[], prefix_operators=[], qualifier=bigram, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=w2, postfix_operators=[], prefix_operators=[], qualifier=bigram, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=frequency, postfix_operators=[], prefix_operators=[], qualifier=bigram, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=score, postfix_operators=[], prefix_operators=['-'], qualifier=bigram, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigramCollocation, sub_type=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[.collocations]]
end[}]
END[}] | Keyword[public] identifier[BigramCollocation] operator[SEP] operator[SEP] identifier[find] operator[SEP] identifier[Corpus] identifier[corpus] , Keyword[int] identifier[k] operator[SEP] {
identifier[BigramCollocation] operator[SEP] operator[SEP] identifier[bigrams] operator[=] Keyword[new] identifier[BigramCollocation] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[HeapSelect] operator[<] identifier[BigramCollocation] operator[>] identifier[heap] operator[=] Keyword[new] identifier[HeapSelect] operator[<] operator[>] operator[SEP] identifier[bigrams] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Bigram] operator[>] identifier[iterator] operator[=] identifier[corpus] operator[SEP] identifier[getBigrams] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Bigram] identifier[bigram] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[c12] operator[=] identifier[corpus] operator[SEP] identifier[getBigramFrequency] operator[SEP] identifier[bigram] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c12] operator[>] identifier[minFreq] operator[SEP] {
Keyword[int] identifier[c1] operator[=] identifier[corpus] operator[SEP] identifier[getTermFrequency] operator[SEP] identifier[bigram] operator[SEP] identifier[w1] operator[SEP] operator[SEP] Keyword[int] identifier[c2] operator[=] identifier[corpus] operator[SEP] identifier[getTermFrequency] operator[SEP] identifier[bigram] operator[SEP] identifier[w2] operator[SEP] operator[SEP] Keyword[double] identifier[score] operator[=] identifier[likelihoodRatio] operator[SEP] identifier[c1] , identifier[c2] , identifier[c12] , identifier[corpus] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[heap] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BigramCollocation] operator[SEP] identifier[bigram] operator[SEP] identifier[w1] , identifier[bigram] operator[SEP] identifier[w2] , identifier[c12] , operator[-] identifier[score] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[heap] operator[SEP] identifier[sort] operator[SEP] operator[SEP] operator[SEP] identifier[BigramCollocation] operator[SEP] operator[SEP] identifier[collocations] operator[=] Keyword[new] identifier[BigramCollocation] operator[SEP] identifier[k] 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[BigramCollocation] identifier[bigram] operator[=] identifier[bigrams] operator[SEP] identifier[k] operator[-] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] identifier[collocations] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[BigramCollocation] operator[SEP] identifier[bigram] operator[SEP] identifier[w1] operator[SEP] operator[SEP] , identifier[bigram] operator[SEP] identifier[w2] operator[SEP] operator[SEP] , identifier[bigram] operator[SEP] identifier[frequency] operator[SEP] operator[SEP] , operator[-] identifier[bigram] operator[SEP] identifier[score] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[collocations] operator[SEP]
}
|
public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
} | class class_name[name] begin[{]
method[setComment, return_type[void], modifier[public], parameter[comment, type]] begin[{]
if[call[.allow, parameter[binary_operation[member[.type], &, member[.ID3V1]]]]] begin[{]
call[id3v1.setComment, parameter[member[.comment]]]
else begin[{]
None
end[}]
if[call[.allow, parameter[binary_operation[member[.type], &, member[.ID3V2]]]]] begin[{]
call[id3v2.setCommentFrame, parameter[literal[""], member[.comment]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setComment] operator[SEP] identifier[String] identifier[comment] , Keyword[int] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[allow] operator[SEP] identifier[type] operator[&] identifier[ID3V1] operator[SEP] operator[SEP] {
identifier[id3v1] operator[SEP] identifier[setComment] operator[SEP] identifier[comment] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[allow] operator[SEP] identifier[type] operator[&] identifier[ID3V2] operator[SEP] operator[SEP] {
identifier[id3v2] operator[SEP] identifier[setCommentFrame] operator[SEP] literal[String] , identifier[comment] operator[SEP] operator[SEP]
}
}
|
void initializePatterns(QrCode qr) {
int where[] = QrCode.VERSION_INFO[qr.version].alignment;
qr.alignment.reset();
lookup.reset();
for (int row = 0; row < where.length; row++ ) {
for (int col = 0; col < where.length; col++) {
boolean skip = false;
if( row == 0 && col == 0 )
skip = true;
else if( row == 0 && col == where.length-1 )
skip = true;
else if( row == where.length-1 && col == 0)
skip = true;
if( skip ) {
lookup.add(null);
} else {
QrCode.Alignment a = qr.alignment.grow();
a.moduleX = where[col];
a.moduleY = where[row];
lookup.add(a);
}
}
}
} | class class_name[name] begin[{]
method[initializePatterns, return_type[void], modifier[default], parameter[qr]] begin[{]
local_variable[type[int], where]
call[qr.alignment.reset, parameter[]]
call[lookup.reset, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=skip)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operandr=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operandr=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=where, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator===), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=where, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator===), operandr=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), IfStatement(condition=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=grow, postfix_operators=[], prefix_operators=[], qualifier=qr.alignment, selectors=[], type_arguments=None), name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QrCode, sub_type=ReferenceType(arguments=None, dimensions=None, name=Alignment, sub_type=None))), StatementExpression(expression=Assignment(expressionl=MemberReference(member=moduleX, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), type==, value=MemberReference(member=where, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=moduleY, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), type==, value=MemberReference(member=where, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=lookup, 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=null)], member=add, postfix_operators=[], prefix_operators=[], qualifier=lookup, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=where, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=col)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=where, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=row)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=row, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[void] identifier[initializePatterns] operator[SEP] identifier[QrCode] identifier[qr] operator[SEP] {
Keyword[int] identifier[where] operator[SEP] operator[SEP] operator[=] identifier[QrCode] operator[SEP] identifier[VERSION_INFO] operator[SEP] identifier[qr] operator[SEP] identifier[version] operator[SEP] operator[SEP] identifier[alignment] operator[SEP] identifier[qr] operator[SEP] identifier[alignment] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[lookup] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[row] operator[=] Other[0] operator[SEP] identifier[row] operator[<] identifier[where] operator[SEP] identifier[length] operator[SEP] identifier[row] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[col] operator[=] Other[0] operator[SEP] identifier[col] operator[<] identifier[where] operator[SEP] identifier[length] operator[SEP] identifier[col] operator[++] operator[SEP] {
Keyword[boolean] identifier[skip] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[row] operator[==] Other[0] operator[&&] identifier[col] operator[==] Other[0] operator[SEP] identifier[skip] operator[=] literal[boolean] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[row] operator[==] Other[0] operator[&&] identifier[col] operator[==] identifier[where] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] identifier[skip] operator[=] literal[boolean] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[row] operator[==] identifier[where] operator[SEP] identifier[length] operator[-] Other[1] operator[&&] identifier[col] operator[==] Other[0] operator[SEP] identifier[skip] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[skip] operator[SEP] {
identifier[lookup] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[QrCode] operator[SEP] identifier[Alignment] identifier[a] operator[=] identifier[qr] operator[SEP] identifier[alignment] operator[SEP] identifier[grow] operator[SEP] operator[SEP] operator[SEP] identifier[a] operator[SEP] identifier[moduleX] operator[=] identifier[where] operator[SEP] identifier[col] operator[SEP] operator[SEP] identifier[a] operator[SEP] identifier[moduleY] operator[=] identifier[where] operator[SEP] identifier[row] operator[SEP] operator[SEP] identifier[lookup] operator[SEP] identifier[add] operator[SEP] identifier[a] operator[SEP] operator[SEP]
}
}
}
}
|
public static Connection getConnectionAuto(DataSource ds) throws SQLException {
if (get() == null)
return ds.getConnection();
else
return get().getConnection(ds);
} | class class_name[name] begin[{]
method[getConnectionAuto, return_type[type[Connection]], modifier[public static], parameter[ds]] begin[{]
if[binary_operation[call[.get, parameter[]], ==, literal[null]]] begin[{]
return[call[ds.getConnection, parameter[]]]
else begin[{]
return[call[.get, parameter[]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Connection] identifier[getConnectionAuto] operator[SEP] identifier[DataSource] identifier[ds] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[return] identifier[ds] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getConnection] operator[SEP] identifier[ds] operator[SEP] operator[SEP]
}
|
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.activityHandle = new NullActivityHandleImpl(in.readUTF());
} | class class_name[name] begin[{]
method[readExternal, return_type[void], modifier[public], parameter[in]] begin[{]
assign[THIS[member[None.activityHandle]], ClassCreator(arguments=[MethodInvocation(arguments=[], member=readUTF, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullActivityHandleImpl, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[readExternal] operator[SEP] identifier[ObjectInput] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
Keyword[this] operator[SEP] identifier[activityHandle] operator[=] Keyword[new] identifier[NullActivityHandleImpl] operator[SEP] identifier[in] operator[SEP] identifier[readUTF] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void fillDensities(KNNQuery<O> knnq, DBIDs ids, WritableDoubleDataStore dens) {
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Densities", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
final KNNList neighbors = knnq.getKNNForDBID(iter, k);
dens.putDouble(iter, neighbors.getKNNDistance());
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
} | class class_name[name] begin[{]
method[fillDensities, return_type[void], modifier[private], parameter[knnq, ids, dens]] begin[{]
local_variable[type[FiniteProgress], prog]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=iter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getKNNForDBID, postfix_operators=[], prefix_operators=[], qualifier=knnq, selectors=[], type_arguments=None), name=neighbors)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=KNNList, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=iter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKNNDistance, postfix_operators=[], prefix_operators=[], qualifier=neighbors, selectors=[], type_arguments=None)], member=putDouble, postfix_operators=[], prefix_operators=[], qualifier=dens, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=prog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incrementProcessed, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=valid, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iter, postfix_operators=[], prefix_operators=[], qualifier=ids, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DBIDIter, sub_type=None)), update=[MethodInvocation(arguments=[], member=advance, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None)]), label=None)
call[LOG.ensureCompleted, parameter[member[.prog]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[fillDensities] operator[SEP] identifier[KNNQuery] operator[<] identifier[O] operator[>] identifier[knnq] , identifier[DBIDs] identifier[ids] , identifier[WritableDoubleDataStore] identifier[dens] operator[SEP] {
identifier[FiniteProgress] identifier[prog] operator[=] identifier[LOG] operator[SEP] identifier[isVerbose] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[FiniteProgress] operator[SEP] literal[String] , identifier[ids] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[LOG] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[DBIDIter] identifier[iter] operator[=] identifier[ids] operator[SEP] identifier[iter] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[valid] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[advance] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[KNNList] identifier[neighbors] operator[=] identifier[knnq] operator[SEP] identifier[getKNNForDBID] operator[SEP] identifier[iter] , identifier[k] operator[SEP] operator[SEP] identifier[dens] operator[SEP] identifier[putDouble] operator[SEP] identifier[iter] , identifier[neighbors] operator[SEP] identifier[getKNNDistance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[incrementProcessed] operator[SEP] identifier[prog] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[ensureCompleted] operator[SEP] identifier[prog] operator[SEP] operator[SEP]
}
|
public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException {
return callMethod(obj, KeyImpl.getInstance(methodName), args);
} | class class_name[name] begin[{]
method[callMethod, return_type[type[Object]], modifier[public static], parameter[obj, methodName, args]] begin[{]
return[call[.callMethod, parameter[member[.obj], call[KeyImpl.getInstance, parameter[member[.methodName]]], member[.args]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[callMethod] operator[SEP] identifier[Object] identifier[obj] , identifier[String] identifier[methodName] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[PageException] {
Keyword[return] identifier[callMethod] operator[SEP] identifier[obj] , identifier[KeyImpl] operator[SEP] identifier[getInstance] operator[SEP] identifier[methodName] operator[SEP] , identifier[args] operator[SEP] operator[SEP]
}
|
public VoltTable[] run(short station, long ttl_seconds) throws VoltAbortException {
voltQueueSQL(getLastDeparts, station);
// For each station, calculate the wait time between departures
final StationStats stats = getStationStats(station, voltExecuteSQL());
voltQueueSQL(updateWaitTime,
stats.station,
stats.lastDepartTime,
stats.totalTime,
stats.totalEntries);
// Prune old data
voltQueueSQL(deleteOldData, -ttl_seconds);
return voltExecuteSQL(true);
} | class class_name[name] begin[{]
method[run, return_type[type[VoltTable]], modifier[public], parameter[station, ttl_seconds]] begin[{]
call[.voltQueueSQL, parameter[member[.getLastDeparts], member[.station]]]
local_variable[type[StationStats], stats]
call[.voltQueueSQL, parameter[member[.updateWaitTime], member[stats.station], member[stats.lastDepartTime], member[stats.totalTime], member[stats.totalEntries]]]
call[.voltQueueSQL, parameter[member[.deleteOldData], member[.ttl_seconds]]]
return[call[.voltExecuteSQL, parameter[literal[true]]]]
end[}]
END[}] | Keyword[public] identifier[VoltTable] operator[SEP] operator[SEP] identifier[run] operator[SEP] Keyword[short] identifier[station] , Keyword[long] identifier[ttl_seconds] operator[SEP] Keyword[throws] identifier[VoltAbortException] {
identifier[voltQueueSQL] operator[SEP] identifier[getLastDeparts] , identifier[station] operator[SEP] operator[SEP] Keyword[final] identifier[StationStats] identifier[stats] operator[=] identifier[getStationStats] operator[SEP] identifier[station] , identifier[voltExecuteSQL] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[voltQueueSQL] operator[SEP] identifier[updateWaitTime] , identifier[stats] operator[SEP] identifier[station] , identifier[stats] operator[SEP] identifier[lastDepartTime] , identifier[stats] operator[SEP] identifier[totalTime] , identifier[stats] operator[SEP] identifier[totalEntries] operator[SEP] operator[SEP] identifier[voltQueueSQL] operator[SEP] identifier[deleteOldData] , operator[-] identifier[ttl_seconds] operator[SEP] operator[SEP] Keyword[return] identifier[voltExecuteSQL] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public HostDiskPartitionInfo computeDiskPartitionInfoForResize(HostScsiDiskPartition partition, HostDiskPartitionBlockRange blockRange) throws NotFound, HostConfigFault, RuntimeFault, RemoteException {
return computeDiskPartitionInfoForResize(partition, blockRange, null);
} | class class_name[name] begin[{]
method[computeDiskPartitionInfoForResize, return_type[type[HostDiskPartitionInfo]], modifier[public], parameter[partition, blockRange]] begin[{]
return[call[.computeDiskPartitionInfoForResize, parameter[member[.partition], member[.blockRange], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[HostDiskPartitionInfo] identifier[computeDiskPartitionInfoForResize] operator[SEP] identifier[HostScsiDiskPartition] identifier[partition] , identifier[HostDiskPartitionBlockRange] identifier[blockRange] operator[SEP] Keyword[throws] identifier[NotFound] , identifier[HostConfigFault] , identifier[RuntimeFault] , identifier[RemoteException] {
Keyword[return] identifier[computeDiskPartitionInfoForResize] operator[SEP] identifier[partition] , identifier[blockRange] , Other[null] operator[SEP] operator[SEP]
}
|
public static SObject of(String key, InputStream is) {
try {
return new InputStreamSObject(key, $.requireNotNull(is));
} catch (Exception e) {
return getInvalidObject(key, e);
}
} | class class_name[name] begin[{]
method[of, return_type[type[SObject]], modifier[public static], parameter[key, is]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requireNotNull, 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=InputStreamSObject, sub_type=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInvalidObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SObject] identifier[of] operator[SEP] identifier[String] identifier[key] , identifier[InputStream] identifier[is] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[InputStreamSObject] operator[SEP] identifier[key] , identifier[$] operator[SEP] identifier[requireNotNull] operator[SEP] identifier[is] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] identifier[getInvalidObject] operator[SEP] identifier[key] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public <T extends Comparable<? super T>> List<T> sort (Iterator<T> iter)
{
ArrayList<T> list = new ArrayList<T>();
CollectionUtil.addAll(list, iter);
return sort(list);
} | class class_name[name] begin[{]
method[sort, return_type[type[List]], modifier[public], parameter[iter]] begin[{]
local_variable[type[ArrayList], list]
call[CollectionUtil.addAll, parameter[member[.list], member[.iter]]]
return[call[.sort, parameter[member[.list]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[T] operator[>] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[sort] operator[SEP] identifier[Iterator] operator[<] identifier[T] operator[>] identifier[iter] operator[SEP] {
identifier[ArrayList] operator[<] identifier[T] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[CollectionUtil] operator[SEP] identifier[addAll] operator[SEP] identifier[list] , identifier[iter] operator[SEP] operator[SEP] Keyword[return] identifier[sort] operator[SEP] identifier[list] operator[SEP] operator[SEP]
}
|
public List<Coordinate> getInterpolated() {
List<Coordinate> p = new ArrayList<Coordinate>();
if (pts.size() >= 2) {
double[] xs = new double[pts.size()];
double[] ys = new double[pts.size()];
for( int i = 0; i < xs.length; i++ ) {
Coordinate coordinate = pts.get(i);
xs[i] = coordinate.x;
ys[i] = coordinate.y;
}
Cubic[] X = calcNaturalCubic(pts.size() - 1, xs);
Cubic[] Y = calcNaturalCubic(pts.size() - 1, ys);
/* very crude technique - just break each segment up into steps lines */
p.add(new Coordinate(X[0].eval(0), Y[0].eval(0)));
for( int i = 0; i < X.length; i++ ) {
for( int j = 1; j <= STEPS; j++ ) {
double u = j / (double) STEPS;
p.add(new Coordinate(X[i].eval(u), Y[i].eval(u)));
}
}
}
return p;
} | class class_name[name] begin[{]
method[getInterpolated, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], p]
if[binary_operation[call[pts.size, parameter[]], >=, literal[2]]] begin[{]
local_variable[type[double], xs]
local_variable[type[double], ys]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=pts, selectors=[], type_arguments=None), name=coordinate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Coordinate, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=xs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=coordinate, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=coordinate, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=xs, 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)
local_variable[type[Cubic], X]
local_variable[type[Cubic], Y]
call[p.add, parameter[ClassCreator(arguments=[MemberReference(member=X, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=eval, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=Y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=eval, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Coordinate, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Cast(expression=MemberReference(member=STEPS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double)), operator=/), name=u)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=X, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=u, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eval, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=Y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=u, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eval, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Coordinate, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=STEPS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=X, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[member[.p]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Coordinate] operator[>] identifier[getInterpolated] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Coordinate] operator[>] identifier[p] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Coordinate] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[2] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[xs] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[ys] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[xs] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Coordinate] identifier[coordinate] operator[=] identifier[pts] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xs] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[coordinate] operator[SEP] identifier[x] operator[SEP] identifier[ys] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[coordinate] operator[SEP] identifier[y] operator[SEP]
}
identifier[Cubic] operator[SEP] operator[SEP] identifier[X] operator[=] identifier[calcNaturalCubic] operator[SEP] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] , identifier[xs] operator[SEP] operator[SEP] identifier[Cubic] operator[SEP] operator[SEP] identifier[Y] operator[=] identifier[calcNaturalCubic] operator[SEP] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] , identifier[ys] operator[SEP] operator[SEP] identifier[p] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] identifier[X] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[eval] operator[SEP] Other[0] operator[SEP] , identifier[Y] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[eval] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[X] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[1] operator[SEP] identifier[j] operator[<=] identifier[STEPS] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[double] identifier[u] operator[=] identifier[j] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[STEPS] operator[SEP] identifier[p] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] identifier[X] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[eval] operator[SEP] identifier[u] operator[SEP] , identifier[Y] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[eval] operator[SEP] identifier[u] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[p] operator[SEP]
}
|
private String removeEscapeChar(final String str, final char escapeChar) {
if(str == null || str.isEmpty()) {
return str;
}
final String escapeStr = String.valueOf(escapeChar);
StringBuilder sb = new StringBuilder();
final LinkedList<String> stack = new LinkedList<>();
final int length = str.length();
for(int i=0; i < length; i++) {
final char c = str.charAt(i);
if(StackUtils.equalsTopElement(stack, escapeStr)) {
// スタックの一番上がエスケープ文字の場合
StackUtils.popup(stack);
sb.append(c);
} else if(c == escapeChar) {
// スタックに積む
stack.push(String.valueOf(c));
} else {
sb.append(c);
}
}
if(!stack.isEmpty()) {
sb.append(StackUtils.popupAndConcat(stack));
}
return sb.toString();
} | class class_name[name] begin[{]
method[removeEscapeChar, return_type[type[String]], modifier[private], parameter[str, escapeChar]] begin[{]
if[binary_operation[binary_operation[member[.str], ==, literal[null]], ||, call[str.isEmpty, parameter[]]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
local_variable[type[String], escapeStr]
local_variable[type[StringBuilder], sb]
local_variable[type[LinkedList], stack]
local_variable[type[int], length]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), name=c)], modifiers={'final'}, type=BasicType(dimensions=[], name=char)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=stack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=escapeStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsTopElement, postfix_operators=[], prefix_operators=[], qualifier=StackUtils, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=escapeChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=push, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=popup, postfix_operators=[], prefix_operators=[], qualifier=StackUtils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[stack.isEmpty, parameter[]]] begin[{]
call[sb.append, parameter[call[StackUtils.popupAndConcat, parameter[member[.stack]]]]]
else begin[{]
None
end[}]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[removeEscapeChar] operator[SEP] Keyword[final] identifier[String] identifier[str] , Keyword[final] Keyword[char] identifier[escapeChar] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[||] identifier[str] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
Keyword[final] identifier[String] identifier[escapeStr] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[escapeChar] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[LinkedList] operator[<] identifier[String] operator[>] identifier[stack] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[length] operator[=] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] Keyword[char] identifier[c] operator[=] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StackUtils] operator[SEP] identifier[equalsTopElement] operator[SEP] identifier[stack] , identifier[escapeStr] operator[SEP] operator[SEP] {
identifier[StackUtils] operator[SEP] identifier[popup] operator[SEP] identifier[stack] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[escapeChar] operator[SEP] {
identifier[stack] operator[SEP] identifier[push] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[stack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[StackUtils] operator[SEP] identifier[popupAndConcat] operator[SEP] identifier[stack] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public String forecastJsonString(ForecastRequest request) throws ForecastException {
notNull("The ForecastRequest cannot be null.", request);
return new String(forecastJsonBytes(request));
} | class class_name[name] begin[{]
method[forecastJsonString, return_type[type[String]], modifier[public], parameter[request]] begin[{]
call[.notNull, parameter[literal["The ForecastRequest cannot be null."], member[.request]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forecastJsonBytes, 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=String, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[forecastJsonString] operator[SEP] identifier[ForecastRequest] identifier[request] operator[SEP] Keyword[throws] identifier[ForecastException] {
identifier[notNull] operator[SEP] literal[String] , identifier[request] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[forecastJsonBytes] operator[SEP] identifier[request] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setOwnerIds(java.util.Collection<String> ownerIds) {
if (ownerIds == null) {
this.ownerIds = null;
return;
}
this.ownerIds = new com.amazonaws.internal.SdkInternalList<String>(ownerIds);
} | class class_name[name] begin[{]
method[setOwnerIds, return_type[void], modifier[public], parameter[ownerIds]] begin[{]
if[binary_operation[member[.ownerIds], ==, literal[null]]] begin[{]
assign[THIS[member[None.ownerIds]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.ownerIds]], ClassCreator(arguments=[MemberReference(member=ownerIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setOwnerIds] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[ownerIds] operator[SEP] {
Keyword[if] operator[SEP] identifier[ownerIds] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[ownerIds] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[ownerIds] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[ownerIds] operator[SEP] operator[SEP]
}
|
public void initKeyAreas(FieldTable table) throws DBException
{
if (m_VKeyList == null)
{
m_VKeyList = new Vector<PKeyArea>();
// Now, copy the keys
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea <= table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA - 1; iKeyArea++)
{
this.makePKeyArea(table);
}
}
} | class class_name[name] begin[{]
method[initKeyAreas, return_type[void], modifier[public], parameter[table]] begin[{]
if[binary_operation[member[.m_VKeyList], ==, literal[null]]] begin[{]
assign[member[.m_VKeyList], 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=PKeyArea, sub_type=None))], dimensions=None, name=Vector, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makePKeyArea, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=iKeyArea, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getRecord, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[MethodInvocation(arguments=[], member=getKeyAreaCount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=MAIN_KEY_AREA, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=MAIN_KEY_AREA, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), name=iKeyArea)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=iKeyArea, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[initKeyAreas] operator[SEP] identifier[FieldTable] identifier[table] operator[SEP] Keyword[throws] identifier[DBException] {
Keyword[if] operator[SEP] identifier[m_VKeyList] operator[==] Other[null] operator[SEP] {
identifier[m_VKeyList] operator[=] Keyword[new] identifier[Vector] operator[<] identifier[PKeyArea] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[iKeyArea] operator[=] identifier[Constants] operator[SEP] identifier[MAIN_KEY_AREA] operator[SEP] identifier[iKeyArea] operator[<=] identifier[table] operator[SEP] identifier[getRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getKeyAreaCount] operator[SEP] operator[SEP] operator[+] identifier[Constants] operator[SEP] identifier[MAIN_KEY_AREA] operator[-] Other[1] operator[SEP] identifier[iKeyArea] operator[++] operator[SEP] {
Keyword[this] operator[SEP] identifier[makePKeyArea] operator[SEP] identifier[table] operator[SEP] operator[SEP]
}
}
}
|
public String getAName(BioPAXElement ele)
{
String name = null;
if (ele instanceof Named)
{
Named n = (Named) ele;
if (n.getDisplayName() != null && n.getDisplayName().length() > 0)
name = n.getDisplayName();
else if (n.getStandardName() != null && n.getStandardName().length() > 0)
name = n.getStandardName();
else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0)
name = n.getName().iterator().next();
}
if (name == null ) name = ele.getUri();
return name + " (" + ele.getModelInterface().getName().substring(
ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")";
} | class class_name[name] begin[{]
method[getAName, return_type[type[String]], modifier[public], parameter[ele]] begin[{]
local_variable[type[String], name]
if[binary_operation[member[.ele], instanceof, type[Named]]] begin[{]
local_variable[type[Named], n]
if[binary_operation[binary_operation[call[n.getDisplayName, parameter[]], !=, literal[null]], &&, binary_operation[call[n.getDisplayName, parameter[]], >, literal[0]]]] begin[{]
assign[member[.name], call[n.getDisplayName, parameter[]]]
else begin[{]
if[binary_operation[binary_operation[call[n.getStandardName, parameter[]], !=, literal[null]], &&, binary_operation[call[n.getStandardName, parameter[]], >, literal[0]]]] begin[{]
assign[member[.name], call[n.getStandardName, parameter[]]]
else begin[{]
if[binary_operation[call[n.getName, parameter[]], &&, binary_operation[call[n.getName, parameter[]], >, literal[0]]]] begin[{]
assign[member[.name], call[n.getName, parameter[]]]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
assign[member[.name], call[ele.getUri, parameter[]]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[binary_operation[member[.name], +, literal[" ("]], +, call[ele.getModelInterface, parameter[]]], +, literal[")"]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getAName] operator[SEP] identifier[BioPAXElement] identifier[ele] operator[SEP] {
identifier[String] identifier[name] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[ele] Keyword[instanceof] identifier[Named] operator[SEP] {
identifier[Named] identifier[n] operator[=] operator[SEP] identifier[Named] operator[SEP] identifier[ele] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[n] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[name] operator[=] identifier[n] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[n] operator[SEP] identifier[getStandardName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[n] operator[SEP] identifier[getStandardName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[name] operator[=] identifier[n] operator[SEP] identifier[getStandardName] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[n] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[n] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[name] operator[=] identifier[n] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] identifier[name] operator[=] identifier[ele] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[name] operator[+] literal[String] operator[+] identifier[ele] operator[SEP] identifier[getModelInterface] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[ele] operator[SEP] identifier[getModelInterface] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[+] literal[String] operator[SEP]
}
|
public float[][] projToLatLon(float[][] from, float[][] to) {
float[] fromX = from[INDEX_X];
float[] fromY = from[INDEX_Y];
to[INDEX_LAT] = fromY;
to[INDEX_LON] = fromX;
return to;
} | class class_name[name] begin[{]
method[projToLatLon, return_type[type[float]], modifier[public], parameter[from, to]] begin[{]
local_variable[type[float], fromX]
local_variable[type[float], fromY]
assign[member[.to], member[.fromY]]
assign[member[.to], member[.fromX]]
return[member[.to]]
end[}]
END[}] | Keyword[public] Keyword[float] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[projToLatLon] operator[SEP] Keyword[float] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[from] , Keyword[float] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[to] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[fromX] operator[=] identifier[from] operator[SEP] identifier[INDEX_X] operator[SEP] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[fromY] operator[=] identifier[from] operator[SEP] identifier[INDEX_Y] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[INDEX_LAT] operator[SEP] operator[=] identifier[fromY] operator[SEP] identifier[to] operator[SEP] identifier[INDEX_LON] operator[SEP] operator[=] identifier[fromX] operator[SEP] Keyword[return] identifier[to] operator[SEP]
}
|
private void checkDrain() {
if (full && !paused && messages.size() < maxQueueSize / 2) {
full = false;
log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
if (drainHandler != null) {
drainHandler.handle((Void) null);
}
}
} | class class_name[name] begin[{]
method[checkDrain, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.full], &&, member[.paused]], &&, binary_operation[call[messages.size, parameter[]], <, binary_operation[member[.maxQueueSize], /, literal[2]]]]] begin[{]
assign[member[.full], literal[false]]
call[log.debug, parameter[call[String.format, parameter[literal["%s - Connection to %s is drained"], THIS[], call[context.target, parameter[]]]]]]
if[binary_operation[member[.drainHandler], !=, literal[null]]] begin[{]
call[drainHandler.handle, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkDrain] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[full] operator[&&] operator[!] identifier[paused] operator[&&] identifier[messages] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[maxQueueSize] operator[/] Other[2] operator[SEP] {
identifier[full] operator[=] literal[boolean] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , Keyword[this] , identifier[context] operator[SEP] identifier[target] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[drainHandler] operator[!=] Other[null] operator[SEP] {
identifier[drainHandler] operator[SEP] identifier[handle] operator[SEP] operator[SEP] identifier[Void] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
}
|
@Override
public ScanResult scan(ScanRequest request) {
request = beforeClientExecution(request);
return executeScan(request);
} | class class_name[name] begin[{]
method[scan, return_type[type[ScanResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeScan, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ScanResult] identifier[scan] operator[SEP] identifier[ScanRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeScan] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("fallthrough")
public static int parsePattern(String rule, int pos, int limit,
String pattern, int[] parsedInts) {
// TODO Update this to handle surrogates
int[] p = new int[1];
int intCount = 0; // number of integers parsed
for (int i=0; i<pattern.length(); ++i) {
char cpat = pattern.charAt(i);
char c;
switch (cpat) {
case ' ':
if (pos >= limit) {
return -1;
}
c = rule.charAt(pos++);
if (!PatternProps.isWhiteSpace(c)) {
return -1;
}
// FALL THROUGH to skipWhitespace
case '~':
pos = PatternProps.skipWhiteSpace(rule, pos);
break;
case '#':
p[0] = pos;
parsedInts[intCount++] = parseInteger(rule, p, limit);
if (p[0] == pos) {
// Syntax error; failed to parse integer
return -1;
}
pos = p[0];
break;
default:
if (pos >= limit) {
return -1;
}
c = (char) UCharacter.toLowerCase(rule.charAt(pos++));
if (c != cpat) {
return -1;
}
break;
}
}
return pos;
} | class class_name[name] begin[{]
method[parsePattern, return_type[type[int]], modifier[public static], parameter[rule, pos, limit, pattern, parsedInts]] begin[{]
local_variable[type[int], p]
local_variable[type[int], intCount]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), name=cpat)], modifiers=set(), type=BasicType(dimensions=[], name=char)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=pos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isWhiteSpace, postfix_operators=[], prefix_operators=['!'], qualifier=PatternProps, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)]))]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='~')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=skipWhiteSpace, postfix_operators=[], prefix_operators=[], qualifier=PatternProps, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='#')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type==, value=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=parsedInts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=intCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInteger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=pos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=UCharacter, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=char))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cpat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=cpat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.pos]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[int] identifier[parsePattern] operator[SEP] identifier[String] identifier[rule] , Keyword[int] identifier[pos] , Keyword[int] identifier[limit] , identifier[String] identifier[pattern] , Keyword[int] operator[SEP] operator[SEP] identifier[parsedInts] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[p] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[intCount] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[char] identifier[cpat] operator[=] identifier[pattern] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[char] identifier[c] operator[SEP] Keyword[switch] operator[SEP] identifier[cpat] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[pos] operator[>=] identifier[limit] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
identifier[c] operator[=] identifier[rule] operator[SEP] identifier[charAt] operator[SEP] identifier[pos] operator[++] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[PatternProps] operator[SEP] identifier[isWhiteSpace] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[case] literal[String] operator[:] identifier[pos] operator[=] identifier[PatternProps] operator[SEP] identifier[skipWhiteSpace] operator[SEP] identifier[rule] , identifier[pos] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[p] operator[SEP] Other[0] operator[SEP] operator[=] identifier[pos] operator[SEP] identifier[parsedInts] operator[SEP] identifier[intCount] operator[++] operator[SEP] operator[=] identifier[parseInteger] operator[SEP] identifier[rule] , identifier[p] , identifier[limit] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[SEP] Other[0] operator[SEP] operator[==] identifier[pos] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
identifier[pos] operator[=] identifier[p] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[pos] operator[>=] identifier[limit] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
identifier[c] operator[=] operator[SEP] Keyword[char] operator[SEP] identifier[UCharacter] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[rule] operator[SEP] identifier[charAt] operator[SEP] identifier[pos] operator[++] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[!=] identifier[cpat] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[pos] operator[SEP]
}
|
public static PactDslJsonRootValue stringMatcher(String regex, String value) {
if (!value.matches(regex)) {
throw new InvalidMatcherException(EXAMPLE + value + "\" does not match regular expression \"" +
regex + "\"");
}
PactDslJsonRootValue rootValue = new PactDslJsonRootValue();
rootValue.setValue(value);
rootValue.setMatcher(new RegexMatcher(regex, value));
return rootValue;
} | class class_name[name] begin[{]
method[stringMatcher, return_type[type[PactDslJsonRootValue]], modifier[public static], parameter[regex, value]] begin[{]
if[call[value.matches, parameter[member[.regex]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=EXAMPLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" does not match regular expression \""), operator=+), operandr=MemberReference(member=regex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidMatcherException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[PactDslJsonRootValue], rootValue]
call[rootValue.setValue, parameter[member[.value]]]
call[rootValue.setMatcher, parameter[ClassCreator(arguments=[MemberReference(member=regex, 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=RegexMatcher, sub_type=None))]]
return[member[.rootValue]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PactDslJsonRootValue] identifier[stringMatcher] operator[SEP] identifier[String] identifier[regex] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[value] operator[SEP] identifier[matches] operator[SEP] identifier[regex] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidMatcherException] operator[SEP] identifier[EXAMPLE] operator[+] identifier[value] operator[+] literal[String] operator[+] identifier[regex] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[PactDslJsonRootValue] identifier[rootValue] operator[=] Keyword[new] identifier[PactDslJsonRootValue] operator[SEP] operator[SEP] operator[SEP] identifier[rootValue] operator[SEP] identifier[setValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[rootValue] operator[SEP] identifier[setMatcher] operator[SEP] Keyword[new] identifier[RegexMatcher] operator[SEP] identifier[regex] , identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[rootValue] operator[SEP]
}
|
public int deleteByTableName(String tableName) throws SQLException {
DeleteBuilder<DataColumns, TableColumnKey> db = deleteBuilder();
db.where().eq(DataColumns.COLUMN_TABLE_NAME, tableName);
PreparedDelete<DataColumns> deleteQuery = db.prepare();
int deleted = delete(deleteQuery);
return deleted;
} | class class_name[name] begin[{]
method[deleteByTableName, return_type[type[int]], modifier[public], parameter[tableName]] begin[{]
local_variable[type[DeleteBuilder], db]
call[db.where, parameter[]]
local_variable[type[PreparedDelete], deleteQuery]
local_variable[type[int], deleted]
return[member[.deleted]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[deleteByTableName] operator[SEP] identifier[String] identifier[tableName] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[DeleteBuilder] operator[<] identifier[DataColumns] , identifier[TableColumnKey] operator[>] identifier[db] operator[=] identifier[deleteBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[where] operator[SEP] operator[SEP] operator[SEP] identifier[eq] operator[SEP] identifier[DataColumns] operator[SEP] identifier[COLUMN_TABLE_NAME] , identifier[tableName] operator[SEP] operator[SEP] identifier[PreparedDelete] operator[<] identifier[DataColumns] operator[>] identifier[deleteQuery] operator[=] identifier[db] operator[SEP] identifier[prepare] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[deleted] operator[=] identifier[delete] operator[SEP] identifier[deleteQuery] operator[SEP] operator[SEP] Keyword[return] identifier[deleted] operator[SEP]
}
|
@Override
final protected long getLastModified(HttpServletRequest req) {
lastModifiedCount.incrementAndGet();
try {
return reportingGetLastModified(req);
} catch (ThreadDeath err) {
throw err;
} catch (RuntimeException err) {
getLogger().log(Level.SEVERE, null, err);
throw err;
} catch (IOException | SQLException err) {
getLogger().log(Level.SEVERE, null, err);
throw new RuntimeException(err);
}
} | class class_name[name] begin[{]
method[getLastModified, return_type[type[long]], modifier[final protected], parameter[req]] begin[{]
call[lastModifiedCount.incrementAndGet, parameter[]]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportingGetLastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=err, types=['ThreadDeath'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=err, types=['RuntimeException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=err, 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=err, types=['IOException', 'SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[final] Keyword[protected] Keyword[long] identifier[getLastModified] operator[SEP] identifier[HttpServletRequest] identifier[req] operator[SEP] {
identifier[lastModifiedCount] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[reportingGetLastModified] operator[SEP] identifier[req] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ThreadDeath] identifier[err] operator[SEP] {
Keyword[throw] identifier[err] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[err] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , Other[null] , identifier[err] operator[SEP] operator[SEP] Keyword[throw] identifier[err] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[SQLException] identifier[err] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , Other[null] , identifier[err] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[err] operator[SEP] operator[SEP]
}
}
|
public String convertMFCMedCollToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} | class class_name[name] begin[{]
method[convertMFCMedCollToString, 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[convertMFCMedCollToString] 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]
}
|
protected void fireTreeStructureChanged(Object source, Object[] path,
int[] childIndices, Object[] children)
{
for (TreeModelListener listener : treeModelListeners)
{
listener.treeStructureChanged(
new TreeModelEvent(source, path, childIndices, children));
}
} | class class_name[name] begin[{]
method[fireTreeStructureChanged, return_type[void], modifier[protected], parameter[source, path, childIndices, children]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=childIndices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=children, 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=TreeModelEvent, sub_type=None))], member=treeStructureChanged, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=treeModelListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeModelListener, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[fireTreeStructureChanged] operator[SEP] identifier[Object] identifier[source] , identifier[Object] operator[SEP] operator[SEP] identifier[path] , Keyword[int] operator[SEP] operator[SEP] identifier[childIndices] , identifier[Object] operator[SEP] operator[SEP] identifier[children] operator[SEP] {
Keyword[for] operator[SEP] identifier[TreeModelListener] identifier[listener] operator[:] identifier[treeModelListeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[treeStructureChanged] operator[SEP] Keyword[new] identifier[TreeModelEvent] operator[SEP] identifier[source] , identifier[path] , identifier[childIndices] , identifier[children] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String getURL(Class<? extends WebPage> clazz, Object param) throws IOException, SQLException {
WebPage page=WebPage.getWebPage(sourcePage.getServletContext(), clazz, param);
return getURL(page, param);
} | class class_name[name] begin[{]
method[getURL, return_type[type[String]], modifier[public], parameter[clazz, param]] begin[{]
local_variable[type[WebPage], page]
return[call[.getURL, parameter[member[.page], member[.param]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getURL] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[WebPage] operator[>] identifier[clazz] , identifier[Object] identifier[param] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[WebPage] identifier[page] operator[=] identifier[WebPage] operator[SEP] identifier[getWebPage] operator[SEP] identifier[sourcePage] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] , identifier[clazz] , identifier[param] operator[SEP] operator[SEP] Keyword[return] identifier[getURL] operator[SEP] identifier[page] , identifier[param] operator[SEP] operator[SEP]
}
|
public boolean isDone() {
return status == Status.cancelled || status == Status.error
|| status == Status.complete || status == Status.refused;
} | class class_name[name] begin[{]
method[isDone, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.status], ==, member[Status.cancelled]], ||, binary_operation[member[.status], ==, member[Status.error]]], ||, binary_operation[member[.status], ==, member[Status.complete]]], ||, binary_operation[member[.status], ==, member[Status.refused]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isDone] operator[SEP] operator[SEP] {
Keyword[return] identifier[status] operator[==] identifier[Status] operator[SEP] identifier[cancelled] operator[||] identifier[status] operator[==] identifier[Status] operator[SEP] identifier[error] operator[||] identifier[status] operator[==] identifier[Status] operator[SEP] identifier[complete] operator[||] identifier[status] operator[==] identifier[Status] operator[SEP] identifier[refused] operator[SEP]
}
|
private void onFinishLoading() {
// save the current hash
String hashOnStart = this.plugin.getStartRoute(isUsingHash());
// check if the url contains a hash.
// in case it has a hash, use this to route otherwise
// use the startRoute from the annotation
if (hashOnStart != null &&
hashOnStart.trim()
.length() > 0) {
ClientLogger.get()
.logDetailed("AbstractApplication: handle history (hash at start: >>" + hashOnStart + "<<",
1);
RouteResult routeResult;
try {
routeResult = this.router.parse(hashOnStart);
} catch (RouterException e) {
return;
}
this.router.route(routeResult.getRoute(),
routeResult.getParameterValues()
.toArray(new String[0]));
} else {
ClientLogger.get()
.logDetailed("AbstractApplication: no history found -> use startRoute: >>" + this.startRoute + "<<",
1);
this.router.route(this.startRoute);
}
ClientLogger.get()
.logSimple("AbstractApplication: application started",
0);
} | class class_name[name] begin[{]
method[onFinishLoading, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[String], hashOnStart]
if[binary_operation[binary_operation[member[.hashOnStart], !=, literal[null]], &&, binary_operation[call[hashOnStart.trim, parameter[]], >, literal[0]]]] begin[{]
call[ClientLogger.get, parameter[]]
local_variable[type[RouteResult], routeResult]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=routeResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=router, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=hashOnStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RouterException']))], finally_block=None, label=None, resources=None)
THIS[member[None.router]call[None.route, parameter[call[routeResult.getRoute, parameter[]], call[routeResult.getParameterValues, parameter[]]]]]
else begin[{]
call[ClientLogger.get, parameter[]]
THIS[member[None.router]call[None.route, parameter[THIS[member[None.startRoute]]]]]
end[}]
call[ClientLogger.get, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[onFinishLoading] operator[SEP] operator[SEP] {
identifier[String] identifier[hashOnStart] operator[=] Keyword[this] operator[SEP] identifier[plugin] operator[SEP] identifier[getStartRoute] operator[SEP] identifier[isUsingHash] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hashOnStart] operator[!=] Other[null] operator[&&] identifier[hashOnStart] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[ClientLogger] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[logDetailed] operator[SEP] literal[String] operator[+] identifier[hashOnStart] operator[+] literal[String] , Other[1] operator[SEP] operator[SEP] identifier[RouteResult] identifier[routeResult] operator[SEP] Keyword[try] {
identifier[routeResult] operator[=] Keyword[this] operator[SEP] identifier[router] operator[SEP] identifier[parse] operator[SEP] identifier[hashOnStart] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RouterException] identifier[e] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[router] operator[SEP] identifier[route] operator[SEP] identifier[routeResult] operator[SEP] identifier[getRoute] operator[SEP] operator[SEP] , identifier[routeResult] operator[SEP] identifier[getParameterValues] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ClientLogger] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[logDetailed] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[startRoute] operator[+] literal[String] , Other[1] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[router] operator[SEP] identifier[route] operator[SEP] Keyword[this] operator[SEP] identifier[startRoute] operator[SEP] operator[SEP]
}
identifier[ClientLogger] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[logSimple] operator[SEP] literal[String] , Other[0] operator[SEP] operator[SEP]
}
|
void getBroadcast() {
CmsCoreProvider.getService().getBroadcast(new AsyncCallback<List<CmsBroadcastMessage>>() {
public void onFailure(Throwable caught) {
// in case of a status code exception abort, indicates the session is no longer valid
if ((caught instanceof StatusCodeException) && (((StatusCodeException)caught).getStatusCode() == 500)) {
CmsBroadcastTimer.abort();
}
}
public void onSuccess(List<CmsBroadcastMessage> result) {
if (result != null) {
for (CmsBroadcastMessage message : result) {
CmsNotification.get().sendAlert(Type.WARNING, createMessageHtml(message));
}
}
}
});
} | class class_name[name] begin[{]
method[getBroadcast, return_type[void], modifier[default], parameter[]] begin[{]
call[CmsCoreProvider.getService, parameter[]]
end[}]
END[}] | Keyword[void] identifier[getBroadcast] operator[SEP] operator[SEP] {
identifier[CmsCoreProvider] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[getBroadcast] operator[SEP] Keyword[new] identifier[AsyncCallback] operator[<] identifier[List] operator[<] identifier[CmsBroadcastMessage] operator[>] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[onFailure] operator[SEP] identifier[Throwable] identifier[caught] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[caught] Keyword[instanceof] identifier[StatusCodeException] operator[SEP] operator[&&] operator[SEP] operator[SEP] operator[SEP] identifier[StatusCodeException] operator[SEP] identifier[caught] operator[SEP] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[==] Other[500] operator[SEP] operator[SEP] {
identifier[CmsBroadcastTimer] operator[SEP] identifier[abort] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[public] Keyword[void] identifier[onSuccess] operator[SEP] identifier[List] operator[<] identifier[CmsBroadcastMessage] operator[>] identifier[result] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[CmsBroadcastMessage] identifier[message] operator[:] identifier[result] operator[SEP] {
identifier[CmsNotification] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[sendAlert] operator[SEP] identifier[Type] operator[SEP] identifier[WARNING] , identifier[createMessageHtml] operator[SEP] identifier[message] operator[SEP] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP]
}
|
public static float[] vLerp(float[] verts, int v1, int v2, float t) {
float[] dest = new float[3];
dest[0] = verts[v1 + 0] + (verts[v2 + 0] - verts[v1 + 0]) * t;
dest[1] = verts[v1 + 1] + (verts[v2 + 1] - verts[v1 + 1]) * t;
dest[2] = verts[v1 + 2] + (verts[v2 + 2] - verts[v1 + 2]) * t;
return dest;
} | class class_name[name] begin[{]
method[vLerp, return_type[type[float]], modifier[public static], parameter[verts, v1, v2, t]] begin[{]
local_variable[type[float], dest]
assign[member[.dest], binary_operation[member[.verts], +, binary_operation[binary_operation[member[.verts], -, member[.verts]], *, member[.t]]]]
assign[member[.dest], binary_operation[member[.verts], +, binary_operation[binary_operation[member[.verts], -, member[.verts]], *, member[.t]]]]
assign[member[.dest], binary_operation[member[.verts], +, binary_operation[binary_operation[member[.verts], -, member[.verts]], *, member[.t]]]]
return[member[.dest]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] operator[SEP] operator[SEP] identifier[vLerp] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[verts] , Keyword[int] identifier[v1] , Keyword[int] identifier[v2] , Keyword[float] identifier[t] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[dest] operator[=] Keyword[new] Keyword[float] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[dest] operator[SEP] Other[0] operator[SEP] operator[=] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[0] operator[SEP] operator[+] operator[SEP] identifier[verts] operator[SEP] identifier[v2] operator[+] Other[0] operator[SEP] operator[-] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[0] operator[SEP] operator[SEP] operator[*] identifier[t] operator[SEP] identifier[dest] operator[SEP] Other[1] operator[SEP] operator[=] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[1] operator[SEP] operator[+] operator[SEP] identifier[verts] operator[SEP] identifier[v2] operator[+] Other[1] operator[SEP] operator[-] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[1] operator[SEP] operator[SEP] operator[*] identifier[t] operator[SEP] identifier[dest] operator[SEP] Other[2] operator[SEP] operator[=] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[2] operator[SEP] operator[+] operator[SEP] identifier[verts] operator[SEP] identifier[v2] operator[+] Other[2] operator[SEP] operator[-] identifier[verts] operator[SEP] identifier[v1] operator[+] Other[2] operator[SEP] operator[SEP] operator[*] identifier[t] operator[SEP] Keyword[return] identifier[dest] operator[SEP]
}
|
public static List<Descriptor<RepositoryBrowser<?>>> filter(Class<? extends RepositoryBrowser> t) {
List<Descriptor<RepositoryBrowser<?>>> r = new ArrayList<>();
for (Descriptor<RepositoryBrowser<?>> d : RepositoryBrowser.all())
if(d.isSubTypeOf(t))
r.add(d);
return r;
} | class class_name[name] begin[{]
method[filter, return_type[type[List]], modifier[public static], parameter[t]] begin[{]
local_variable[type[List], r]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSubTypeOf, postfix_operators=[], prefix_operators=[], qualifier=d, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None)), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=RepositoryBrowser, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=d)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=RepositoryBrowser, sub_type=None))], dimensions=[], name=Descriptor, sub_type=None))), label=None)
return[member[.r]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Descriptor] operator[<] identifier[RepositoryBrowser] operator[<] operator[?] operator[>] operator[>] operator[>] identifier[filter] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[RepositoryBrowser] operator[>] identifier[t] operator[SEP] {
identifier[List] operator[<] identifier[Descriptor] operator[<] identifier[RepositoryBrowser] operator[<] operator[?] operator[>] operator[>] operator[>] identifier[r] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Descriptor] operator[<] identifier[RepositoryBrowser] operator[<] operator[?] operator[>] operator[>] identifier[d] operator[:] identifier[RepositoryBrowser] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[SEP] identifier[isSubTypeOf] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[add] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
|
public Class<?> resolveStatic(String name) {
String className = staticNameMap.get(name);
if (className != null) {
Class<?> c = resolveClassFor(className);
if (c != null) {
return c;
}
}
return null;
} | class class_name[name] begin[{]
method[resolveStatic, return_type[type[Class]], modifier[public], parameter[name]] begin[{]
local_variable[type[String], className]
if[binary_operation[member[.className], !=, literal[null]]] begin[{]
local_variable[type[Class], c]
if[binary_operation[member[.c], !=, literal[null]]] begin[{]
return[member[.c]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[Class] operator[<] operator[?] operator[>] identifier[resolveStatic] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[String] identifier[className] operator[=] identifier[staticNameMap] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[className] operator[!=] Other[null] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[c] operator[=] identifier[resolveClassFor] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[c] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
String getAttributeName(Method getter) {
synchronized (attributeNameCache) {
if ( !attributeNameCache.containsKey(getter) ) {
// First check for a hash key annotation
DynamoDBHashKey hashKeyAnnotation = getter.getAnnotation(DynamoDBHashKey.class);
if ( hashKeyAnnotation != null && hashKeyAnnotation.attributeName() != null
&& hashKeyAnnotation.attributeName().length() > 0 )
return hashKeyAnnotation.attributeName();
// Then a range key
DynamoDBRangeKey rangeKey = getter.getAnnotation(DynamoDBRangeKey.class);
if ( rangeKey != null && rangeKey.attributeName() != null && rangeKey.attributeName().length() > 0 )
return rangeKey.attributeName();
// Then an attribute
DynamoDBAttribute attribute = getter.getAnnotation(DynamoDBAttribute.class);
if ( attribute != null && attribute.attributeName() != null && attribute.attributeName().length() > 0 )
return attribute.attributeName();
// Finally a version attribute
DynamoDBVersionAttribute version = getter.getAnnotation(DynamoDBVersionAttribute.class);
if ( version != null && version.attributeName() != null && version.attributeName().length() > 0 )
return version.attributeName();
// Default to method name
String attributeName = null;
if ( getter.getName().startsWith("get") ) {
attributeName = getter.getName().substring("get".length());
} else if ( getter.getName().startsWith("is") ) {
attributeName = getter.getName().substring("is".length());
} else {
throw new DynamoDBMappingException("Getter must begin with 'get' or 'is'");
}
// Lowercase the first letter of the name
attributeName = attributeName.substring(0, 1).toLowerCase() + attributeName.substring(1);
attributeNameCache.put(getter, attributeName);
}
}
return attributeNameCache.get(getter);
} | class class_name[name] begin[{]
method[getAttributeName, return_type[type[String]], modifier[default], parameter[getter]] begin[{]
SYNCHRONIZED[member[.attributeNameCache]] BEGIN[{]
if[call[attributeNameCache.containsKey, parameter[member[.getter]]]] begin[{]
local_variable[type[DynamoDBHashKey], hashKeyAnnotation]
if[binary_operation[binary_operation[binary_operation[member[.hashKeyAnnotation], !=, literal[null]], &&, binary_operation[call[hashKeyAnnotation.attributeName, parameter[]], !=, literal[null]]], &&, binary_operation[call[hashKeyAnnotation.attributeName, parameter[]], >, literal[0]]]] begin[{]
return[call[hashKeyAnnotation.attributeName, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[DynamoDBRangeKey], rangeKey]
if[binary_operation[binary_operation[binary_operation[member[.rangeKey], !=, literal[null]], &&, binary_operation[call[rangeKey.attributeName, parameter[]], !=, literal[null]]], &&, binary_operation[call[rangeKey.attributeName, parameter[]], >, literal[0]]]] begin[{]
return[call[rangeKey.attributeName, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[DynamoDBAttribute], attribute]
if[binary_operation[binary_operation[binary_operation[member[.attribute], !=, literal[null]], &&, binary_operation[call[attribute.attributeName, parameter[]], !=, literal[null]]], &&, binary_operation[call[attribute.attributeName, parameter[]], >, literal[0]]]] begin[{]
return[call[attribute.attributeName, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[DynamoDBVersionAttribute], version]
if[binary_operation[binary_operation[binary_operation[member[.version], !=, literal[null]], &&, binary_operation[call[version.attributeName, parameter[]], !=, literal[null]]], &&, binary_operation[call[version.attributeName, parameter[]], >, literal[0]]]] begin[{]
return[call[version.attributeName, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[String], attributeName]
if[call[getter.getName, parameter[]]] begin[{]
assign[member[.attributeName], call[getter.getName, parameter[]]]
else begin[{]
if[call[getter.getName, parameter[]]] begin[{]
assign[member[.attributeName], call[getter.getName, parameter[]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Getter must begin with 'get' or 'is'")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DynamoDBMappingException, sub_type=None)), label=None)
end[}]
end[}]
assign[member[.attributeName], binary_operation[call[attributeName.substring, parameter[literal[0], literal[1]]], +, call[attributeName.substring, parameter[literal[1]]]]]
call[attributeNameCache.put, parameter[member[.getter], member[.attributeName]]]
else begin[{]
None
end[}]
END[}]
return[call[attributeNameCache.get, parameter[member[.getter]]]]
end[}]
END[}] | identifier[String] identifier[getAttributeName] operator[SEP] identifier[Method] identifier[getter] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[attributeNameCache] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[attributeNameCache] operator[SEP] identifier[containsKey] operator[SEP] identifier[getter] operator[SEP] operator[SEP] {
identifier[DynamoDBHashKey] identifier[hashKeyAnnotation] operator[=] identifier[getter] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[DynamoDBHashKey] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hashKeyAnnotation] operator[!=] Other[null] operator[&&] identifier[hashKeyAnnotation] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[hashKeyAnnotation] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[hashKeyAnnotation] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[DynamoDBRangeKey] identifier[rangeKey] operator[=] identifier[getter] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[DynamoDBRangeKey] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rangeKey] operator[!=] Other[null] operator[&&] identifier[rangeKey] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[rangeKey] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[rangeKey] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[DynamoDBAttribute] identifier[attribute] operator[=] identifier[getter] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[DynamoDBAttribute] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attribute] operator[!=] Other[null] operator[&&] identifier[attribute] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[attribute] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[attribute] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[DynamoDBVersionAttribute] identifier[version] operator[=] identifier[getter] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[DynamoDBVersionAttribute] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[version] operator[!=] Other[null] operator[&&] identifier[version] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[version] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[version] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[attributeName] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[getter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[attributeName] operator[=] identifier[getter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[getter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[attributeName] operator[=] identifier[getter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[DynamoDBMappingException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[attributeName] operator[=] identifier[attributeName] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[1] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[+] identifier[attributeName] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[attributeNameCache] operator[SEP] identifier[put] operator[SEP] identifier[getter] , identifier[attributeName] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[attributeNameCache] operator[SEP] identifier[get] operator[SEP] identifier[getter] operator[SEP] operator[SEP]
}
|
public void setMaxDepth(int maxDepth) {
this.maxDepth = maxDepth > UNLIMITED_DEPTH ? maxDepth : UNLIMITED_DEPTH;
getConfig().setProperty(SPIDER_MAX_DEPTH, Integer.toString(this.maxDepth));
} | class class_name[name] begin[{]
method[setMaxDepth, return_type[void], modifier[public], parameter[maxDepth]] begin[{]
assign[THIS[member[None.maxDepth]], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=UNLIMITED_DEPTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=UNLIMITED_DEPTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=maxDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
call[.getConfig, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setMaxDepth] operator[SEP] Keyword[int] identifier[maxDepth] operator[SEP] {
Keyword[this] operator[SEP] identifier[maxDepth] operator[=] identifier[maxDepth] operator[>] identifier[UNLIMITED_DEPTH] operator[?] identifier[maxDepth] operator[:] identifier[UNLIMITED_DEPTH] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[setProperty] operator[SEP] identifier[SPIDER_MAX_DEPTH] , identifier[Integer] operator[SEP] identifier[toString] operator[SEP] Keyword[this] operator[SEP] identifier[maxDepth] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean isIPAdressValid(final String ip){
// InetAddress.getByName() validates 'null' as a valid IP (localhost).
// we do not want that
if (hasValue(ip)) {
return IP_ADDR_PATTERN.matcher(ip).matches();
}
return false;
} | class class_name[name] begin[{]
method[isIPAdressValid, return_type[type[boolean]], modifier[private static], parameter[ip]] begin[{]
if[call[.hasValue, parameter[member[.ip]]]] begin[{]
return[call[IP_ADDR_PATTERN.matcher, parameter[member[.ip]]]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isIPAdressValid] operator[SEP] Keyword[final] identifier[String] identifier[ip] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasValue] operator[SEP] identifier[ip] operator[SEP] operator[SEP] {
Keyword[return] identifier[IP_ADDR_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[ip] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void saveRequestedLoginRedirectInfo() {
final String redirectPath = requestManager.getRequestPathAndQuery();
final LoginRedirectBean redirectBean = createLoginRedirectBean(redirectPath);
// not use instance type because it might be extended
// (basically not use it when the object might be extended)
sessionManager.setAttribute(generateLoginRedirectBeanKey(), redirectBean);
} | class class_name[name] begin[{]
method[saveRequestedLoginRedirectInfo, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[String], redirectPath]
local_variable[type[LoginRedirectBean], redirectBean]
call[sessionManager.setAttribute, parameter[call[.generateLoginRedirectBeanKey, parameter[]], member[.redirectBean]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[saveRequestedLoginRedirectInfo] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[redirectPath] operator[=] identifier[requestManager] operator[SEP] identifier[getRequestPathAndQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[LoginRedirectBean] identifier[redirectBean] operator[=] identifier[createLoginRedirectBean] operator[SEP] identifier[redirectPath] operator[SEP] operator[SEP] identifier[sessionManager] operator[SEP] identifier[setAttribute] operator[SEP] identifier[generateLoginRedirectBeanKey] operator[SEP] operator[SEP] , identifier[redirectBean] operator[SEP] operator[SEP]
}
|
public final void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(DefaultKeyword.GROUP)) {
return;
}
lexerEngine.accept(DefaultKeyword.BY);
while (true) {
addGroupByItem(basicExpressionParser.parse(selectStatement), selectStatement);
if (!lexerEngine.equalAny(Symbol.COMMA)) {
break;
}
lexerEngine.nextToken();
}
lexerEngine.skipAll(getSkippedKeywordAfterGroupBy());
selectStatement.setGroupByLastIndex(lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length() - 1);
} | class class_name[name] begin[{]
method[parse, return_type[void], modifier[final public], parameter[selectStatement]] begin[{]
if[call[lexerEngine.skipIfEqual, parameter[member[DefaultKeyword.GROUP]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[lexerEngine.accept, parameter[member[DefaultKeyword.BY]]]
while[literal[true]] begin[{]
call[.addGroupByItem, parameter[call[basicExpressionParser.parse, parameter[member[.selectStatement]]], member[.selectStatement]]]
if[call[lexerEngine.equalAny, parameter[member[Symbol.COMMA]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[lexerEngine.nextToken, parameter[]]
end[}]
call[lexerEngine.skipAll, parameter[call[.getSkippedKeywordAfterGroupBy, parameter[]]]]
call[selectStatement.setGroupByLastIndex, parameter[binary_operation[binary_operation[call[lexerEngine.getCurrentToken, parameter[]], -, call[lexerEngine.getCurrentToken, parameter[]]], -, literal[1]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[parse] operator[SEP] Keyword[final] identifier[SelectStatement] identifier[selectStatement] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[lexerEngine] operator[SEP] identifier[skipIfEqual] operator[SEP] identifier[DefaultKeyword] operator[SEP] identifier[GROUP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[lexerEngine] operator[SEP] identifier[accept] operator[SEP] identifier[DefaultKeyword] operator[SEP] identifier[BY] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[addGroupByItem] operator[SEP] identifier[basicExpressionParser] operator[SEP] identifier[parse] operator[SEP] identifier[selectStatement] operator[SEP] , identifier[selectStatement] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[lexerEngine] operator[SEP] identifier[equalAny] operator[SEP] identifier[Symbol] operator[SEP] identifier[COMMA] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[lexerEngine] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP]
}
identifier[lexerEngine] operator[SEP] identifier[skipAll] operator[SEP] identifier[getSkippedKeywordAfterGroupBy] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[selectStatement] operator[SEP] identifier[setGroupByLastIndex] operator[SEP] identifier[lexerEngine] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[SEP] identifier[getEndPosition] operator[SEP] operator[SEP] operator[-] identifier[lexerEngine] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[SEP] identifier[getLiterals] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public static boolean isMaximum(InetAddress address) {
byte[] addr = address.getAddress();
for (int i = 0; i < addr.length; i++) {
if (addr[i] != (byte) 0xff) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[isMaximum, return_type[type[boolean]], modifier[public static], parameter[address]] begin[{]
local_variable[type[byte], addr]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=addr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), type=BasicType(dimensions=[], name=byte)), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=addr, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isMaximum] operator[SEP] identifier[InetAddress] identifier[address] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[addr] operator[=] identifier[address] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[addr] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[addr] operator[SEP] identifier[i] operator[SEP] operator[!=] operator[SEP] Keyword[byte] operator[SEP] literal[Integer] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void convert(String labelmapBase64, int realWidth, int realHeight, String outPath) {
try {
byte[] bytes = Base64Util.decode(labelmapBase64);
InputStream is = new ByteArrayInputStream(bytes);
BufferedImage image = ImageIO.read(is);
BufferedImage newImage = resize(image, realWidth, realHeight);
BufferedImage grayImage = new BufferedImage(realWidth, realHeight, BufferedImage.TYPE_BYTE_GRAY);
for (int i = 0 ; i < realWidth ; i++) {
for (int j = 0 ; j < realHeight; j++) {
int rgb = newImage.getRGB(i, j);
grayImage.setRGB(i, j, rgb * 255); // 将像素存入缓冲区
}
}
File newFile = new File(outPath);
ImageIO.write(grayImage, "jpg", newFile);
} catch (IOException e) {
e.printStackTrace();
}
} | class class_name[name] begin[{]
method[convert, return_type[void], modifier[public static], parameter[labelmapBase64, realWidth, realHeight, outPath]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=labelmapBase64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=Base64Util, selectors=[], type_arguments=None), name=bytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=bytes, 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=ByteArrayInputStream, sub_type=None)), name=is)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=ImageIO, selectors=[], type_arguments=None), name=image)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedImage, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=image, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=realWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=realHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=newImage)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedImage, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=realWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=realHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=TYPE_BYTE_GRAY, postfix_operators=[], prefix_operators=[], qualifier=BufferedImage, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedImage, sub_type=None)), name=grayImage)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedImage, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRGB, postfix_operators=[], prefix_operators=[], qualifier=newImage, selectors=[], type_arguments=None), name=rgb)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=rgb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=*)], member=setRGB, postfix_operators=[], prefix_operators=[], qualifier=grayImage, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=realHeight, 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=realWidth, 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), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=outPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=newFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=grayImage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jpg"), MemberReference(member=newFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=ImageIO, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[convert] operator[SEP] identifier[String] identifier[labelmapBase64] , Keyword[int] identifier[realWidth] , Keyword[int] identifier[realHeight] , identifier[String] identifier[outPath] operator[SEP] {
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[Base64Util] operator[SEP] identifier[decode] operator[SEP] identifier[labelmapBase64] operator[SEP] operator[SEP] identifier[InputStream] identifier[is] operator[=] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[image] operator[=] identifier[ImageIO] operator[SEP] identifier[read] operator[SEP] identifier[is] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[newImage] operator[=] identifier[resize] operator[SEP] identifier[image] , identifier[realWidth] , identifier[realHeight] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[grayImage] operator[=] Keyword[new] identifier[BufferedImage] operator[SEP] identifier[realWidth] , identifier[realHeight] , identifier[BufferedImage] operator[SEP] identifier[TYPE_BYTE_GRAY] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[realWidth] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[realHeight] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[int] identifier[rgb] operator[=] identifier[newImage] operator[SEP] identifier[getRGB] operator[SEP] identifier[i] , identifier[j] operator[SEP] operator[SEP] identifier[grayImage] operator[SEP] identifier[setRGB] operator[SEP] identifier[i] , identifier[j] , identifier[rgb] operator[*] Other[255] operator[SEP] operator[SEP]
}
}
identifier[File] identifier[newFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[outPath] operator[SEP] operator[SEP] identifier[ImageIO] operator[SEP] identifier[write] operator[SEP] identifier[grayImage] , literal[String] , identifier[newFile] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void forwardMessage(AbstractMessage aMessage,
SIBUuid8 targetMEUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forwardMessage",
new Object[]{aMessage, targetMEUuid});
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled() && !aMessage.isControlMessage())
{
JsMessage jsMsg = (JsMessage) aMessage;
JsDestinationAddress routingDestination = jsMsg.getRoutingDestination();
if(routingDestination != null)
{
String destId = routingDestination.getDestinationName();
boolean temporary = false;
if(destId.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
temporary = true;
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
destId,
temporary);
}
else
{
DestinationHandler dest =
_destinationManager.getDestinationInternal(aMessage.getGuaranteedTargetDestinationDefinitionUUID(), false);
if (dest != null)
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
dest.getName(),
dest.isTemporary());
else
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
jsMsg.getGuaranteedTargetDestinationDefinitionUUID().toString(),
false);
}
}
// Send this to MPIO
_mpio.sendToMe( targetMEUuid,
aMessage.getPriority().intValue(),
aMessage );
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forwardMessage");
} | class class_name[name] begin[{]
method[forwardMessage, return_type[void], modifier[private], parameter[aMessage, targetMEUuid]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["forwardMessage"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=aMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetMEUuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[UserTrace.tc_mt.isDebugEnabled, parameter[]]], &&, call[aMessage.isControlMessage, parameter[]]]] begin[{]
local_variable[type[JsMessage], jsMsg]
local_variable[type[JsDestinationAddress], routingDestination]
if[binary_operation[member[.routingDestination], !=, literal[null]]] begin[{]
local_variable[type[String], destId]
local_variable[type[boolean], temporary]
if[call[destId.startsWith, parameter[member[SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX]]]] begin[{]
assign[member[.temporary], literal[true]]
else begin[{]
None
end[}]
call[UserTrace.forwardJSMessage, parameter[member[.jsMsg], member[.targetMEUuid], member[.destId], member[.temporary]]]
else begin[{]
local_variable[type[DestinationHandler], dest]
if[binary_operation[member[.dest], !=, literal[null]]] begin[{]
call[UserTrace.forwardJSMessage, parameter[member[.jsMsg], member[.targetMEUuid], call[dest.getName, parameter[]], call[dest.isTemporary, parameter[]]]]
else begin[{]
call[UserTrace.forwardJSMessage, parameter[member[.jsMsg], member[.targetMEUuid], call[jsMsg.getGuaranteedTargetDestinationDefinitionUUID, parameter[]], literal[false]]]
end[}]
end[}]
else begin[{]
None
end[}]
call[_mpio.sendToMe, parameter[member[.targetMEUuid], call[aMessage.getPriority, parameter[]], member[.aMessage]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["forwardMessage"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[forwardMessage] operator[SEP] identifier[AbstractMessage] identifier[aMessage] , identifier[SIBUuid8] identifier[targetMEUuid] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[aMessage] , identifier[targetMEUuid]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[UserTrace] operator[SEP] identifier[tc_mt] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[aMessage] operator[SEP] identifier[isControlMessage] operator[SEP] operator[SEP] operator[SEP] {
identifier[JsMessage] identifier[jsMsg] operator[=] operator[SEP] identifier[JsMessage] operator[SEP] identifier[aMessage] operator[SEP] identifier[JsDestinationAddress] identifier[routingDestination] operator[=] identifier[jsMsg] operator[SEP] identifier[getRoutingDestination] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[routingDestination] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[destId] operator[=] identifier[routingDestination] operator[SEP] identifier[getDestinationName] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[temporary] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[destId] operator[SEP] identifier[startsWith] operator[SEP] identifier[SIMPConstants] operator[SEP] identifier[TEMPORARY_PUBSUB_DESTINATION_PREFIX] operator[SEP] operator[SEP] identifier[temporary] operator[=] literal[boolean] operator[SEP] identifier[UserTrace] operator[SEP] identifier[forwardJSMessage] operator[SEP] identifier[jsMsg] , identifier[targetMEUuid] , identifier[destId] , identifier[temporary] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[DestinationHandler] identifier[dest] operator[=] identifier[_destinationManager] operator[SEP] identifier[getDestinationInternal] operator[SEP] identifier[aMessage] operator[SEP] identifier[getGuaranteedTargetDestinationDefinitionUUID] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dest] operator[!=] Other[null] operator[SEP] identifier[UserTrace] operator[SEP] identifier[forwardJSMessage] operator[SEP] identifier[jsMsg] , identifier[targetMEUuid] , identifier[dest] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[dest] operator[SEP] identifier[isTemporary] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[UserTrace] operator[SEP] identifier[forwardJSMessage] operator[SEP] identifier[jsMsg] , identifier[targetMEUuid] , identifier[jsMsg] operator[SEP] identifier[getGuaranteedTargetDestinationDefinitionUUID] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
}
identifier[_mpio] operator[SEP] identifier[sendToMe] operator[SEP] identifier[targetMEUuid] , identifier[aMessage] operator[SEP] identifier[getPriority] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] , identifier[aMessage] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public AbstractNumber multiply(Bruch operand) {
BigInteger z = getZaehler().multiply(operand.getZaehler());
BigInteger n = getNenner().multiply(operand.getNenner());
return Bruch.of(z, n).kuerzen();
} | class class_name[name] begin[{]
method[multiply, return_type[type[AbstractNumber]], modifier[public], parameter[operand]] begin[{]
local_variable[type[BigInteger], z]
local_variable[type[BigInteger], n]
return[call[Bruch.of, parameter[member[.z], member[.n]]]]
end[}]
END[}] | Keyword[public] identifier[AbstractNumber] identifier[multiply] operator[SEP] identifier[Bruch] identifier[operand] operator[SEP] {
identifier[BigInteger] identifier[z] operator[=] identifier[getZaehler] operator[SEP] operator[SEP] operator[SEP] identifier[multiply] operator[SEP] identifier[operand] operator[SEP] identifier[getZaehler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BigInteger] identifier[n] operator[=] identifier[getNenner] operator[SEP] operator[SEP] operator[SEP] identifier[multiply] operator[SEP] identifier[operand] operator[SEP] identifier[getNenner] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Bruch] operator[SEP] identifier[of] operator[SEP] identifier[z] , identifier[n] operator[SEP] operator[SEP] identifier[kuerzen] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T extends AbstractPutObjectRequest> T withKey(String key) {
setKey(key);
@SuppressWarnings("unchecked") T t = (T)this;
return t;
} | class class_name[name] begin[{]
method[withKey, return_type[type[T]], modifier[public], parameter[key]] begin[{]
call[.setKey, parameter[member[.key]]]
local_variable[type[T], t]
return[member[.t]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[AbstractPutObjectRequest] operator[>] identifier[T] identifier[withKey] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[setKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[T] identifier[t] operator[=] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP] Keyword[return] identifier[t] operator[SEP]
}
|
private Element writeModule() {
Element element = doc.createElement("module");
rootElement.appendChild(element);
return element;
} | class class_name[name] begin[{]
method[writeModule, return_type[type[Element]], modifier[private], parameter[]] begin[{]
local_variable[type[Element], element]
call[rootElement.appendChild, parameter[member[.element]]]
return[member[.element]]
end[}]
END[}] | Keyword[private] identifier[Element] identifier[writeModule] operator[SEP] operator[SEP] {
identifier[Element] identifier[element] operator[=] identifier[doc] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[rootElement] operator[SEP] identifier[appendChild] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[return] identifier[element] operator[SEP]
}
|
public String getWithLog(String key) {
final String value = getStr(key);
if (value == null) {
log.debug("No key define for [{}]!", key);
}
return value;
} | class class_name[name] begin[{]
method[getWithLog, return_type[type[String]], modifier[public], parameter[key]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
call[log.debug, parameter[literal["No key define for [{}]!"], member[.key]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getWithLog] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[getStr] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[key] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
|
private int compareKinds(Kind kind1, Kind kind2) {
if (kind1 == Kind.LENGTH && kind2 == Kind.DATA) {
return -1;
}
if (kind1 == Kind.DATA && kind2 == Kind.LENGTH) {
return 1;
}
return kind1.compareTo(kind2);
} | class class_name[name] begin[{]
method[compareKinds, return_type[type[int]], modifier[private], parameter[kind1, kind2]] begin[{]
if[binary_operation[binary_operation[member[.kind1], ==, member[Kind.LENGTH]], &&, binary_operation[member[.kind2], ==, member[Kind.DATA]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.kind1], ==, member[Kind.DATA]], &&, binary_operation[member[.kind2], ==, member[Kind.LENGTH]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
return[call[kind1.compareTo, parameter[member[.kind2]]]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[compareKinds] operator[SEP] identifier[Kind] identifier[kind1] , identifier[Kind] identifier[kind2] operator[SEP] {
Keyword[if] operator[SEP] identifier[kind1] operator[==] identifier[Kind] operator[SEP] identifier[LENGTH] operator[&&] identifier[kind2] operator[==] identifier[Kind] operator[SEP] identifier[DATA] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[kind1] operator[==] identifier[Kind] operator[SEP] identifier[DATA] operator[&&] identifier[kind2] operator[==] identifier[Kind] operator[SEP] identifier[LENGTH] operator[SEP] {
Keyword[return] Other[1] operator[SEP]
}
Keyword[return] identifier[kind1] operator[SEP] identifier[compareTo] operator[SEP] identifier[kind2] operator[SEP] operator[SEP]
}
|
protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod,
TypeDescription.Generic fixedValueType,
StackManipulation valueLoadingInstruction) {
StackManipulation assignment = assigner.assign(fixedValueType, instrumentedMethod.getReturnType(), typing);
if (!assignment.isValid()) {
throw new IllegalArgumentException("Cannot return value of type " + fixedValueType + " for " + instrumentedMethod);
}
StackManipulation.Size stackSize = new StackManipulation.Compound(
valueLoadingInstruction,
assignment,
MethodReturn.of(instrumentedMethod.getReturnType())
).apply(methodVisitor, implementationContext);
return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
} | class class_name[name] begin[{]
method[apply, return_type[type[ByteCodeAppender]], modifier[protected], parameter[methodVisitor, implementationContext, instrumentedMethod, fixedValueType, valueLoadingInstruction]] begin[{]
local_variable[type[StackManipulation], assignment]
if[call[assignment.isValid, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot return value of type "), operandr=MemberReference(member=fixedValueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for "), operator=+), operandr=MemberReference(member=instrumentedMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[StackManipulation], stackSize]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMaximalSize, postfix_operators=[], prefix_operators=[], qualifier=stackSize, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getStackSize, postfix_operators=[], prefix_operators=[], qualifier=instrumentedMethod, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteCodeAppender, sub_type=ReferenceType(arguments=None, dimensions=None, name=Size, sub_type=None)))]
end[}]
END[}] | Keyword[protected] identifier[ByteCodeAppender] operator[SEP] identifier[Size] identifier[apply] operator[SEP] identifier[MethodVisitor] identifier[methodVisitor] , identifier[Context] identifier[implementationContext] , identifier[MethodDescription] identifier[instrumentedMethod] , identifier[TypeDescription] operator[SEP] identifier[Generic] identifier[fixedValueType] , identifier[StackManipulation] identifier[valueLoadingInstruction] operator[SEP] {
identifier[StackManipulation] identifier[assignment] operator[=] identifier[assigner] operator[SEP] identifier[assign] operator[SEP] identifier[fixedValueType] , identifier[instrumentedMethod] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] , identifier[typing] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[assignment] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[fixedValueType] operator[+] literal[String] operator[+] identifier[instrumentedMethod] operator[SEP] operator[SEP]
}
identifier[StackManipulation] operator[SEP] identifier[Size] identifier[stackSize] operator[=] Keyword[new] identifier[StackManipulation] operator[SEP] identifier[Compound] operator[SEP] identifier[valueLoadingInstruction] , identifier[assignment] , identifier[MethodReturn] operator[SEP] identifier[of] operator[SEP] identifier[instrumentedMethod] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[methodVisitor] , identifier[implementationContext] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ByteCodeAppender] operator[SEP] identifier[Size] operator[SEP] identifier[stackSize] operator[SEP] identifier[getMaximalSize] operator[SEP] operator[SEP] , identifier[instrumentedMethod] operator[SEP] identifier[getStackSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String getCurrentValueForGroup(String group) {
Object obj = groupValues.get(group);
if (obj == null) {
return "";
}
return obj.toString();
} | class class_name[name] begin[{]
method[getCurrentValueForGroup, return_type[type[String]], modifier[protected], parameter[group]] begin[{]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
return[call[obj.toString, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getCurrentValueForGroup] operator[SEP] identifier[String] identifier[group] operator[SEP] {
identifier[Object] identifier[obj] operator[=] identifier[groupValues] operator[SEP] identifier[get] operator[SEP] identifier[group] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[return] identifier[obj] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private void populateCache() {
if (disableAllCaches || disablePopulateCache) {
return;
}
// Populate Cache
final long ts = System.currentTimeMillis();
for (int index = 1; ((index < storageBlock) && (cacheInternalNodes.size() < readCacheInternal) && (cacheLeafNodes
.size() < readCacheLeaf)); index++) {
if (freeBlocks.get(index)) {
continue; // skip free
}
try {
final Node<K, V> node = getNodeFromStore(index); // read
(node.isLeaf() ? cacheLeafNodes : cacheInternalNodes).put(node.id, node);
} catch (Node.InvalidNodeID e) {
freeBlocks.set(index); // mark index as free
}
}
log.info("Populated read cache ts=" + (System.currentTimeMillis() - ts) + " blocks=" + storageBlock
+ " elements=" + elements);
} | class class_name[name] begin[{]
method[populateCache, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.disableAllCaches], ||, member[.disablePopulateCache]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], ts]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=freeBlocks, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNodeFromStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=node)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=[], name=Node, sub_type=None)), StatementExpression(expression=TernaryExpression(condition=MethodInvocation(arguments=[], member=isLeaf, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), if_false=MemberReference(member=cacheInternalNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=cacheLeafNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=freeBlocks, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Node.InvalidNodeID']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=storageBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=cacheInternalNodes, selectors=[], type_arguments=None), operandr=MemberReference(member=readCacheInternal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=cacheLeafNodes, selectors=[], type_arguments=None), operandr=MemberReference(member=readCacheLeaf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), 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)
call[log.info, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["Populated read cache ts="], +, binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.ts]]], +, literal[" blocks="]], +, member[.storageBlock]], +, literal[" elements="]], +, member[.elements]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[populateCache] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[disableAllCaches] operator[||] identifier[disablePopulateCache] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[final] Keyword[long] identifier[ts] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[<] identifier[storageBlock] operator[SEP] operator[&&] operator[SEP] identifier[cacheInternalNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[readCacheInternal] operator[SEP] operator[&&] operator[SEP] identifier[cacheLeafNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[readCacheLeaf] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[freeBlocks] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[try] {
Keyword[final] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[node] operator[=] identifier[getNodeFromStore] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[isLeaf] operator[SEP] operator[SEP] operator[?] identifier[cacheLeafNodes] operator[:] identifier[cacheInternalNodes] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[node] operator[SEP] identifier[id] , identifier[node] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Node] operator[SEP] identifier[InvalidNodeID] identifier[e] operator[SEP] {
identifier[freeBlocks] operator[SEP] identifier[set] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
}
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[ts] operator[SEP] operator[+] literal[String] operator[+] identifier[storageBlock] operator[+] literal[String] operator[+] identifier[elements] operator[SEP] operator[SEP]
}
|
public static java.util.List<com.liferay.commerce.model.CPDefinitionInventory> getCPDefinitionInventoriesByUuidAndCompanyId(
String uuid, long companyId) {
return getService()
.getCPDefinitionInventoriesByUuidAndCompanyId(uuid, companyId);
} | class class_name[name] begin[{]
method[getCPDefinitionInventoriesByUuidAndCompanyId, return_type[type[java]], modifier[public static], parameter[uuid, companyId]] begin[{]
return[call[.getService, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CPDefinitionInventory] operator[>] identifier[getCPDefinitionInventoriesByUuidAndCompanyId] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[companyId] operator[SEP] {
Keyword[return] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[getCPDefinitionInventoriesByUuidAndCompanyId] operator[SEP] identifier[uuid] , identifier[companyId] operator[SEP] operator[SEP]
}
|
public static FileFilter xor(FileFilter leftOperand, FileFilter rightOperand) {
return compose(LogicalOperator.XOR, leftOperand, rightOperand);
} | class class_name[name] begin[{]
method[xor, return_type[type[FileFilter]], modifier[public static], parameter[leftOperand, rightOperand]] begin[{]
return[call[.compose, parameter[member[LogicalOperator.XOR], member[.leftOperand], member[.rightOperand]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FileFilter] identifier[xor] operator[SEP] identifier[FileFilter] identifier[leftOperand] , identifier[FileFilter] identifier[rightOperand] operator[SEP] {
Keyword[return] identifier[compose] operator[SEP] identifier[LogicalOperator] operator[SEP] identifier[XOR] , identifier[leftOperand] , identifier[rightOperand] operator[SEP] operator[SEP]
}
|
@Override
public void processEvents() throws IOException, EncodingException {
if (!getIsConnected()) {
LOGGER.warning("Not connnected...");
}
while (true) {
ByteBuffer block = null;
synchronized (receiveBuffer) {
if (!receiveBuffer.isEmpty()) {
block = receiveBuffer.remove(0);
}
}
if (block == null) {
break;
}
elementReader.onReceivedData(block);
}
} | class class_name[name] begin[{]
method[processEvents, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.getIsConnected, parameter[]]] begin[{]
call[LOGGER.warning, parameter[literal["Not connnected..."]]]
else begin[{]
None
end[}]
while[literal[true]] begin[{]
local_variable[type[ByteBuffer], block]
SYNCHRONIZED[member[.receiveBuffer]] BEGIN[{]
if[call[receiveBuffer.isEmpty, parameter[]]] begin[{]
assign[member[.block], call[receiveBuffer.remove, parameter[literal[0]]]]
else begin[{]
None
end[}]
END[}]
if[binary_operation[member[.block], ==, literal[null]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[elementReader.onReceivedData, parameter[member[.block]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[processEvents] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] , identifier[EncodingException] {
Keyword[if] operator[SEP] operator[!] identifier[getIsConnected] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[ByteBuffer] identifier[block] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[receiveBuffer] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[receiveBuffer] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[block] operator[=] identifier[receiveBuffer] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[block] operator[==] Other[null] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[elementReader] operator[SEP] identifier[onReceivedData] operator[SEP] identifier[block] operator[SEP] operator[SEP]
}
}
|
public static String make512Safe(StringBuffer input, String newline) {
StringBuilder result = new StringBuilder();
String content = input.toString();
String rest = content;
while (!rest.isEmpty()) {
if (rest.contains("\n")) {
String line = rest.substring(0, rest.indexOf("\n"));
rest = rest.substring(rest.indexOf("\n") + 1);
if (line.length() > 1 && line.charAt(line.length() - 1) == '\r')
line = line.substring(0, line.length() - 1);
append512Safe(line, result, newline);
} else {
append512Safe(rest, result, newline);
break;
}
}
return result.toString();
} | class class_name[name] begin[{]
method[make512Safe, return_type[type[String]], modifier[public static], parameter[input, newline]] begin[{]
local_variable[type[StringBuilder], result]
local_variable[type[String], content]
local_variable[type[String], rest]
while[call[rest.isEmpty, parameter[]]] begin[{]
if[call[rest.contains, parameter[literal["\n"]]]] begin[{]
local_variable[type[String], line]
assign[member[.rest], call[rest.substring, parameter[binary_operation[call[rest.indexOf, parameter[literal["\n"]]], +, literal[1]]]]]
if[binary_operation[binary_operation[call[line.length, parameter[]], >, literal[1]], &&, binary_operation[call[line.charAt, parameter[binary_operation[call[line.length, parameter[]], -, literal[1]]]], ==, literal['\r']]]] begin[{]
assign[member[.line], call[line.substring, parameter[literal[0], binary_operation[call[line.length, parameter[]], -, literal[1]]]]]
else begin[{]
None
end[}]
call[.append512Safe, parameter[member[.line], member[.result], member[.newline]]]
else begin[{]
call[.append512Safe, parameter[member[.rest], member[.result], member[.newline]]]
BreakStatement(goto=None, label=None)
end[}]
end[}]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[make512Safe] operator[SEP] identifier[StringBuffer] identifier[input] , identifier[String] identifier[newline] operator[SEP] {
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[content] operator[=] identifier[input] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[rest] operator[=] identifier[content] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[rest] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[rest] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[line] operator[=] identifier[rest] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[rest] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[rest] operator[=] identifier[rest] operator[SEP] identifier[substring] operator[SEP] identifier[rest] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[&&] identifier[line] operator[SEP] identifier[charAt] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] identifier[line] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[append512Safe] operator[SEP] identifier[line] , identifier[result] , identifier[newline] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[append512Safe] operator[SEP] identifier[rest] , identifier[result] , identifier[newline] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public EEnum getIDEStructureFLAGS() {
if (ideStructureFLAGSEEnum == null) {
ideStructureFLAGSEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(119);
}
return ideStructureFLAGSEEnum;
} | class class_name[name] begin[{]
method[getIDEStructureFLAGS, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ideStructureFLAGSEEnum], ==, literal[null]]] begin[{]
assign[member[.ideStructureFLAGSEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=119)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ideStructureFLAGSEEnum]]
end[}]
END[}] | Keyword[public] identifier[EEnum] identifier[getIDEStructureFLAGS] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ideStructureFLAGSEEnum] operator[==] Other[null] operator[SEP] {
identifier[ideStructureFLAGSEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[119] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ideStructureFLAGSEEnum] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.