code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
@Nonnull
public String getUntil (final char cEndExcl)
{
final int nStart = m_nCurIndex;
while (m_nCurIndex < m_nMaxIndex && getCurrentChar () != cEndExcl)
++m_nCurIndex;
return m_sInput.substring (nStart, m_nCurIndex);
} | class class_name[name] begin[{]
method[getUntil, return_type[type[String]], modifier[public], parameter[cEndExcl]] begin[{]
local_variable[type[int], nStart]
while[binary_operation[binary_operation[member[.m_nCurIndex], <, member[.m_nMaxIndex]], &&, binary_operation[call[.getCurrentChar, parameter[]], !=, member[.cEndExcl]]]] begin[{]
member[.m_nCurIndex]
end[}]
return[call[m_sInput.substring, parameter[member[.nStart], member[.m_nCurIndex]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[String] identifier[getUntil] operator[SEP] Keyword[final] Keyword[char] identifier[cEndExcl] operator[SEP] {
Keyword[final] Keyword[int] identifier[nStart] operator[=] identifier[m_nCurIndex] operator[SEP] Keyword[while] operator[SEP] identifier[m_nCurIndex] operator[<] identifier[m_nMaxIndex] operator[&&] identifier[getCurrentChar] operator[SEP] operator[SEP] operator[!=] identifier[cEndExcl] operator[SEP] operator[++] identifier[m_nCurIndex] operator[SEP] Keyword[return] identifier[m_sInput] operator[SEP] identifier[substring] operator[SEP] identifier[nStart] , identifier[m_nCurIndex] operator[SEP] operator[SEP]
}
|
public static <T> T getLast(Iterable<T> iterable) {
// TODO(kevinb): Support a concurrently modified collection?
if (iterable instanceof List) {
List<T> list = (List<T>) iterable;
if (list.isEmpty()) {
throw new NoSuchElementException();
}
return getLastInNonemptyList(list);
}
return Iterators.getLast(iterable.iterator());
} | class class_name[name] begin[{]
method[getLast, return_type[type[T]], modifier[public static], parameter[iterable]] begin[{]
if[binary_operation[member[.iterable], instanceof, type[List]]] begin[{]
local_variable[type[List], list]
if[call[list.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.getLastInNonemptyList, parameter[member[.list]]]]
else begin[{]
None
end[}]
return[call[Iterators.getLast, parameter[call[iterable.iterator, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[getLast] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[iterable] operator[SEP] {
Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[List] operator[SEP] {
identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[=] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] operator[SEP] identifier[iterable] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getLastInNonemptyList] operator[SEP] identifier[list] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Iterators] operator[SEP] identifier[getLast] operator[SEP] identifier[iterable] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<Page<UpgradeOperationHistoricalStatusInfoInner>> getOSUpgradeHistoryNextAsync(final String nextPageLink) {
return getOSUpgradeHistoryNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>>, Page<UpgradeOperationHistoricalStatusInfoInner>>() {
@Override
public Page<UpgradeOperationHistoricalStatusInfoInner> call(ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[getOSUpgradeHistoryNextAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
return[call[.getOSUpgradeHistoryNextWithServiceResponseAsync, parameter[member[.nextPageLink]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[UpgradeOperationHistoricalStatusInfoInner] operator[>] operator[>] identifier[getOSUpgradeHistoryNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[getOSUpgradeHistoryNextWithServiceResponseAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[UpgradeOperationHistoricalStatusInfoInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[UpgradeOperationHistoricalStatusInfoInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[UpgradeOperationHistoricalStatusInfoInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[UpgradeOperationHistoricalStatusInfoInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static Calendar addMonths(Calendar origin, int value) {
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.MONTH, value);
return sync(cal);
} | class class_name[name] begin[{]
method[addMonths, return_type[type[Calendar]], modifier[public static], parameter[origin, value]] begin[{]
local_variable[type[Calendar], cal]
call[cal.add, parameter[member[Calendar.MONTH], member[.value]]]
return[call[.sync, parameter[member[.cal]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Calendar] identifier[addMonths] operator[SEP] identifier[Calendar] identifier[origin] , Keyword[int] identifier[value] operator[SEP] {
identifier[Calendar] identifier[cal] operator[=] identifier[sync] operator[SEP] operator[SEP] identifier[Calendar] operator[SEP] identifier[origin] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[sync] operator[SEP] identifier[cal] operator[SEP] operator[SEP]
}
|
private void addReturnTypeNarrowingDeclarations(AbstractTypeDeclaration node) {
TypeElement type = node.getTypeElement();
// No need to run this if the entire class is dead.
if (deadCodeMap != null && deadCodeMap.containsClass(type, elementUtil)) {
return;
}
Map<String, ExecutablePair> newDeclarations = new HashMap<>();
Map<String, TypeMirror> resolvedReturnTypes = new HashMap<>();
for (DeclaredType inheritedType : typeUtil.getObjcOrderedInheritedTypes(type.asType())) {
TypeElement inheritedElem = (TypeElement) inheritedType.asElement();
for (ExecutableElement methodElem : ElementUtil.getMethods(inheritedElem)) {
if (ElementUtil.isPrivate(methodElem)) {
continue;
}
TypeMirror declaredReturnType = typeUtil.erasure(methodElem.getReturnType());
if (!TypeUtil.isReferenceType(declaredReturnType)) {
continue; // Short circuit
}
String selector = nameTable.getMethodSelector(methodElem);
ExecutableType methodType = typeUtil.asMemberOf(inheritedType, methodElem);
TypeMirror returnType = typeUtil.erasure(methodType.getReturnType());
TypeMirror resolvedReturnType = resolvedReturnTypes.get(selector);
if (resolvedReturnType == null) {
resolvedReturnType = declaredReturnType;
resolvedReturnTypes.put(selector, resolvedReturnType);
} else if (!typeUtil.isSubtype(returnType, resolvedReturnType)) {
continue;
}
if (resolvedReturnType != returnType
&& !nameTable.getObjCType(resolvedReturnType).equals(
nameTable.getObjCType(returnType))) {
newDeclarations.put(selector, new ExecutablePair(methodElem, methodType));
resolvedReturnTypes.put(selector, returnType);
}
}
}
for (Map.Entry<String, ExecutablePair> newDecl : newDeclarations.entrySet()) {
if (deadCodeMap != null
&& deadCodeMap.containsMethod(newDecl.getValue().element(), typeUtil)) {
continue;
}
node.addBodyDeclaration(newReturnTypeNarrowingDeclaration(
newDecl.getKey(), newDecl.getValue(), type));
}
} | class class_name[name] begin[{]
method[addReturnTypeNarrowingDeclarations, return_type[void], modifier[private], parameter[node]] begin[{]
local_variable[type[TypeElement], type]
if[binary_operation[binary_operation[member[.deadCodeMap], !=, literal[null]], &&, call[deadCodeMap.containsClass, parameter[member[.type], member[.elementUtil]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Map], newDeclarations]
local_variable[type[Map], resolvedReturnTypes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=asElement, postfix_operators=[], prefix_operators=[], qualifier=inheritedType, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=TypeElement, sub_type=None)), name=inheritedElem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeElement, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=methodElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isPrivate, postfix_operators=[], prefix_operators=[], qualifier=ElementUtil, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getReturnType, postfix_operators=[], prefix_operators=[], qualifier=methodElem, selectors=[], type_arguments=None)], member=erasure, postfix_operators=[], prefix_operators=[], qualifier=typeUtil, selectors=[], type_arguments=None), name=declaredReturnType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeMirror, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=declaredReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isReferenceType, postfix_operators=[], prefix_operators=['!'], qualifier=TypeUtil, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=methodElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethodSelector, postfix_operators=[], prefix_operators=[], qualifier=nameTable, selectors=[], type_arguments=None), name=selector)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=inheritedType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asMemberOf, postfix_operators=[], prefix_operators=[], qualifier=typeUtil, selectors=[], type_arguments=None), name=methodType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExecutableType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getReturnType, postfix_operators=[], prefix_operators=[], qualifier=methodType, selectors=[], type_arguments=None)], member=erasure, postfix_operators=[], prefix_operators=[], qualifier=typeUtil, selectors=[], type_arguments=None), name=returnType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeMirror, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=resolvedReturnTypes, selectors=[], type_arguments=None), name=resolvedReturnType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeMirror, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSubtype, postfix_operators=[], prefix_operators=['!'], qualifier=typeUtil, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=declaredReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=resolvedReturnTypes, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=resolvedReturnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjCType, postfix_operators=[], prefix_operators=['!'], qualifier=nameTable, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjCType, postfix_operators=[], prefix_operators=[], qualifier=nameTable, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=methodElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodType, 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=ExecutablePair, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=newDeclarations, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=resolvedReturnTypes, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=inheritedElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=ElementUtil, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=methodElem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExecutableElement, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=asType, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)], member=getObjcOrderedInheritedTypes, postfix_operators=[], prefix_operators=[], qualifier=typeUtil, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=inheritedType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DeclaredType, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=deadCodeMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=newDecl, selectors=[MethodInvocation(arguments=[], member=element, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=typeUtil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsMethod, postfix_operators=[], prefix_operators=[], qualifier=deadCodeMap, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=newDecl, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=newDecl, selectors=[], type_arguments=None), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newReturnTypeNarrowingDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addBodyDeclaration, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=newDeclarations, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=newDecl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ExecutablePair, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addReturnTypeNarrowingDeclarations] operator[SEP] identifier[AbstractTypeDeclaration] identifier[node] operator[SEP] {
identifier[TypeElement] identifier[type] operator[=] identifier[node] operator[SEP] identifier[getTypeElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deadCodeMap] operator[!=] Other[null] operator[&&] identifier[deadCodeMap] operator[SEP] identifier[containsClass] operator[SEP] identifier[type] , identifier[elementUtil] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[ExecutablePair] operator[>] identifier[newDeclarations] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[TypeMirror] operator[>] identifier[resolvedReturnTypes] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DeclaredType] identifier[inheritedType] operator[:] identifier[typeUtil] operator[SEP] identifier[getObjcOrderedInheritedTypes] operator[SEP] identifier[type] operator[SEP] identifier[asType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[TypeElement] identifier[inheritedElem] operator[=] operator[SEP] identifier[TypeElement] operator[SEP] identifier[inheritedType] operator[SEP] identifier[asElement] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExecutableElement] identifier[methodElem] operator[:] identifier[ElementUtil] operator[SEP] identifier[getMethods] operator[SEP] identifier[inheritedElem] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ElementUtil] operator[SEP] identifier[isPrivate] operator[SEP] identifier[methodElem] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[TypeMirror] identifier[declaredReturnType] operator[=] identifier[typeUtil] operator[SEP] identifier[erasure] operator[SEP] identifier[methodElem] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[TypeUtil] operator[SEP] identifier[isReferenceType] operator[SEP] identifier[declaredReturnType] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] identifier[selector] operator[=] identifier[nameTable] operator[SEP] identifier[getMethodSelector] operator[SEP] identifier[methodElem] operator[SEP] operator[SEP] identifier[ExecutableType] identifier[methodType] operator[=] identifier[typeUtil] operator[SEP] identifier[asMemberOf] operator[SEP] identifier[inheritedType] , identifier[methodElem] operator[SEP] operator[SEP] identifier[TypeMirror] identifier[returnType] operator[=] identifier[typeUtil] operator[SEP] identifier[erasure] operator[SEP] identifier[methodType] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TypeMirror] identifier[resolvedReturnType] operator[=] identifier[resolvedReturnTypes] operator[SEP] identifier[get] operator[SEP] identifier[selector] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolvedReturnType] operator[==] Other[null] operator[SEP] {
identifier[resolvedReturnType] operator[=] identifier[declaredReturnType] operator[SEP] identifier[resolvedReturnTypes] operator[SEP] identifier[put] operator[SEP] identifier[selector] , identifier[resolvedReturnType] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[typeUtil] operator[SEP] identifier[isSubtype] operator[SEP] identifier[returnType] , identifier[resolvedReturnType] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resolvedReturnType] operator[!=] identifier[returnType] operator[&&] operator[!] identifier[nameTable] operator[SEP] identifier[getObjCType] operator[SEP] identifier[resolvedReturnType] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[nameTable] operator[SEP] identifier[getObjCType] operator[SEP] identifier[returnType] operator[SEP] operator[SEP] operator[SEP] {
identifier[newDeclarations] operator[SEP] identifier[put] operator[SEP] identifier[selector] , Keyword[new] identifier[ExecutablePair] operator[SEP] identifier[methodElem] , identifier[methodType] operator[SEP] operator[SEP] operator[SEP] identifier[resolvedReturnTypes] operator[SEP] identifier[put] operator[SEP] identifier[selector] , identifier[returnType] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[ExecutablePair] operator[>] identifier[newDecl] operator[:] identifier[newDeclarations] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[deadCodeMap] operator[!=] Other[null] operator[&&] identifier[deadCodeMap] operator[SEP] identifier[containsMethod] operator[SEP] identifier[newDecl] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[element] operator[SEP] operator[SEP] , identifier[typeUtil] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[node] operator[SEP] identifier[addBodyDeclaration] operator[SEP] identifier[newReturnTypeNarrowingDeclaration] operator[SEP] identifier[newDecl] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[newDecl] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void setAttributeValues(String name, Object[] values) {
setAttributeValues(name, values, ORDER_DOESNT_MATTER);
} | class class_name[name] begin[{]
method[setAttributeValues, return_type[void], modifier[public], parameter[name, values]] begin[{]
call[.setAttributeValues, parameter[member[.name], member[.values], member[.ORDER_DOESNT_MATTER]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setAttributeValues] operator[SEP] identifier[String] identifier[name] , identifier[Object] operator[SEP] operator[SEP] identifier[values] operator[SEP] {
identifier[setAttributeValues] operator[SEP] identifier[name] , identifier[values] , identifier[ORDER_DOESNT_MATTER] operator[SEP] operator[SEP]
}
|
public Node getRootNode(Node n)
{
int nt = n.getNodeType();
return ( (Node.DOCUMENT_NODE == nt) || (Node.DOCUMENT_FRAGMENT_NODE == nt) )
? n : n.getOwnerDocument();
} | class class_name[name] begin[{]
method[getRootNode, return_type[type[Node]], modifier[public], parameter[n]] begin[{]
local_variable[type[int], nt]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=DOCUMENT_NODE, postfix_operators=[], prefix_operators=[], qualifier=Node, selectors=[]), operandr=MemberReference(member=nt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=DOCUMENT_FRAGMENT_NODE, postfix_operators=[], prefix_operators=[], qualifier=Node, selectors=[]), operandr=MemberReference(member=nt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), if_false=MethodInvocation(arguments=[], member=getOwnerDocument, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None), if_true=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] identifier[Node] identifier[getRootNode] operator[SEP] identifier[Node] identifier[n] operator[SEP] {
Keyword[int] identifier[nt] operator[=] identifier[n] operator[SEP] identifier[getNodeType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[Node] operator[SEP] identifier[DOCUMENT_NODE] operator[==] identifier[nt] operator[SEP] operator[||] operator[SEP] identifier[Node] operator[SEP] identifier[DOCUMENT_FRAGMENT_NODE] operator[==] identifier[nt] operator[SEP] operator[SEP] operator[?] identifier[n] operator[:] identifier[n] operator[SEP] identifier[getOwnerDocument] operator[SEP] operator[SEP] operator[SEP]
}
|
public ClassInfoList getAnnotations() {
return filter(new ClassInfoFilter() {
@Override
public boolean accept(final ClassInfo ci) {
return ci.isAnnotation();
}
});
} | class class_name[name] begin[{]
method[getAnnotations, return_type[type[ClassInfoList]], modifier[public], parameter[]] begin[{]
return[call[.filter, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isAnnotation, postfix_operators=[], prefix_operators=[], qualifier=ci, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=accept, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=ci, type=ReferenceType(arguments=None, dimensions=[], name=ClassInfo, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassInfoFilter, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[ClassInfoList] identifier[getAnnotations] operator[SEP] operator[SEP] {
Keyword[return] identifier[filter] operator[SEP] Keyword[new] identifier[ClassInfoFilter] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[accept] operator[SEP] Keyword[final] identifier[ClassInfo] identifier[ci] operator[SEP] {
Keyword[return] identifier[ci] operator[SEP] identifier[isAnnotation] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey,
final Resource credentialPropertiesFile,
final String profilePath, final String profileName) {
LOGGER.debug("Attempting to locate AWS credentials...");
val chain = new ArrayList<AWSCredentialsProvider>();
chain.add(new InstanceProfileCredentialsProvider(false));
if (credentialPropertiesFile != null) {
try {
val f = credentialPropertiesFile.getFile();
chain.add(new PropertiesFileCredentialsProvider(f.getCanonicalPath()));
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
if (StringUtils.isNotBlank(profilePath) && StringUtils.isNotBlank(profileName)) {
addProviderToChain(nothing -> {
chain.add(new ProfileCredentialsProvider(profilePath, profileName));
return null;
});
}
addProviderToChain(nothing -> {
chain.add(new SystemPropertiesCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new EnvironmentVariableCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new ClasspathPropertiesFileCredentialsProvider("awscredentials.properties"));
return null;
});
if (StringUtils.isNotBlank(credentialAccessKey) && StringUtils.isNotBlank(credentialSecretKey)) {
addProviderToChain(nothing -> {
val credentials = new BasicAWSCredentials(credentialAccessKey, credentialSecretKey);
chain.add(new AWSStaticCredentialsProvider(credentials));
return null;
});
}
LOGGER.debug("AWS chained credential providers are configured as [{}]", chain);
return new ChainingAWSCredentialsProvider(chain);
} | class class_name[name] begin[{]
method[getInstance, return_type[type[AWSCredentialsProvider]], modifier[public static], parameter[credentialAccessKey, credentialSecretKey, credentialPropertiesFile, profilePath, profileName]] begin[{]
call[LOGGER.debug, parameter[literal["Attempting to locate AWS credentials..."]]]
local_variable[type[val], chain]
call[chain.add, parameter[ClassCreator(arguments=[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=None, dimensions=None, name=InstanceProfileCredentialsProvider, sub_type=None))]]
if[binary_operation[member[.credentialPropertiesFile], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=credentialPropertiesFile, selectors=[], type_arguments=None), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getCanonicalPath, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PropertiesFileCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), 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=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[call[StringUtils.isNotBlank, parameter[member[.profilePath]]], &&, call[StringUtils.isNotBlank, parameter[member[.profileName]]]]] begin[{]
call[.addProviderToChain, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=profilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=profileName, 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=ProfileCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[MemberReference(member=nothing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
else begin[{]
None
end[}]
call[.addProviderToChain, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SystemPropertiesCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[MemberReference(member=nothing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[.addProviderToChain, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EnvironmentVariableCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[MemberReference(member=nothing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[.addProviderToChain, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="awscredentials.properties")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClasspathPropertiesFileCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[MemberReference(member=nothing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
if[binary_operation[call[StringUtils.isNotBlank, parameter[member[.credentialAccessKey]]], &&, call[StringUtils.isNotBlank, parameter[member[.credentialSecretKey]]]]] begin[{]
call[.addProviderToChain, parameter[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=credentialAccessKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=credentialSecretKey, 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=BasicAWSCredentials, sub_type=None)), name=credentials)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=credentials, 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=AWSStaticCredentialsProvider, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], parameters=[MemberReference(member=nothing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
else begin[{]
None
end[}]
call[LOGGER.debug, parameter[literal["AWS chained credential providers are configured as [{}]"], member[.chain]]]
return[ClassCreator(arguments=[MemberReference(member=chain, 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=ChainingAWSCredentialsProvider, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AWSCredentialsProvider] identifier[getInstance] operator[SEP] Keyword[final] identifier[String] identifier[credentialAccessKey] , Keyword[final] identifier[String] identifier[credentialSecretKey] , Keyword[final] identifier[Resource] identifier[credentialPropertiesFile] , Keyword[final] identifier[String] identifier[profilePath] , Keyword[final] identifier[String] identifier[profileName] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[val] identifier[chain] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[AWSCredentialsProvider] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[InstanceProfileCredentialsProvider] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[credentialPropertiesFile] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[val] identifier[f] operator[=] identifier[credentialPropertiesFile] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[PropertiesFileCredentialsProvider] operator[SEP] identifier[f] operator[SEP] identifier[getCanonicalPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[profilePath] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[profileName] operator[SEP] operator[SEP] {
identifier[addProviderToChain] operator[SEP] identifier[nothing] operator[->] {
identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ProfileCredentialsProvider] operator[SEP] identifier[profilePath] , identifier[profileName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} operator[SEP] operator[SEP]
}
identifier[addProviderToChain] operator[SEP] identifier[nothing] operator[->] {
identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[SystemPropertiesCredentialsProvider] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} operator[SEP] operator[SEP] identifier[addProviderToChain] operator[SEP] identifier[nothing] operator[->] {
identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[EnvironmentVariableCredentialsProvider] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} operator[SEP] operator[SEP] identifier[addProviderToChain] operator[SEP] identifier[nothing] operator[->] {
identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ClasspathPropertiesFileCredentialsProvider] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[credentialAccessKey] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[credentialSecretKey] operator[SEP] operator[SEP] {
identifier[addProviderToChain] operator[SEP] identifier[nothing] operator[->] {
identifier[val] identifier[credentials] operator[=] Keyword[new] identifier[BasicAWSCredentials] operator[SEP] identifier[credentialAccessKey] , identifier[credentialSecretKey] operator[SEP] operator[SEP] identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[AWSStaticCredentialsProvider] operator[SEP] identifier[credentials] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
} operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[chain] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ChainingAWSCredentialsProvider] operator[SEP] identifier[chain] operator[SEP] operator[SEP]
}
|
public boolean isEnabledFor(Priority p) {
switch (p.level) {
case Level.TRACE_INT:
return slf4jLogger.isTraceEnabled();
case Level.DEBUG_INT:
return slf4jLogger.isDebugEnabled();
case Level.INFO_INT:
return slf4jLogger.isInfoEnabled();
case Level.WARN_INT:
return slf4jLogger.isWarnEnabled();
case Level.ERROR_INT:
return slf4jLogger.isErrorEnabled();
case Priority.FATAL_INT:
return slf4jLogger.isErrorEnabled();
}
return false;
} | class class_name[name] begin[{]
method[isEnabledFor, return_type[type[boolean]], modifier[public], parameter[p]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=TRACE_INT, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=DEBUG_INT, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=INFO_INT, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=WARN_INT, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=ERROR_INT, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=FATAL_INT, postfix_operators=[], prefix_operators=[], qualifier=Priority, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=slf4jLogger, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isEnabledFor] operator[SEP] identifier[Priority] identifier[p] operator[SEP] {
Keyword[switch] operator[SEP] identifier[p] operator[SEP] identifier[level] operator[SEP] {
Keyword[case] identifier[Level] operator[SEP] identifier[TRACE_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Level] operator[SEP] identifier[DEBUG_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Level] operator[SEP] identifier[INFO_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Level] operator[SEP] identifier[WARN_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Level] operator[SEP] identifier[ERROR_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Priority] operator[SEP] identifier[FATAL_INT] operator[:] Keyword[return] identifier[slf4jLogger] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void run() {
// 1) validate propagation is executed at the context of the right epoch, otherwise abort
if (!sharedThetaSketch.validateEpoch(epoch)) {
// invalid epoch - should not propagate
sharedThetaSketch.endPropagation(null, false);
return;
}
// 2) handle propagation: either of a single hash or of a sketch
if (singleHash != ConcurrentSharedThetaSketch.NOT_SINGLE_HASH) {
sharedThetaSketch.propagate(singleHash);
} else if (sketchIn != null) {
final long volTheta = sharedThetaSketch.getVolatileTheta();
assert volTheta <= sketchIn.getThetaLong() :
"volTheta = " + volTheta + ", bufTheta = " + sketchIn.getThetaLong();
// propagate values from input sketch one by one
final long[] cacheIn = sketchIn.getCache();
if (sketchIn.isOrdered()) { //Ordered compact, Use early stop
for (final long hashIn : cacheIn) {
if (hashIn >= volTheta) {
break; //early stop
}
sharedThetaSketch.propagate(hashIn);
}
} else { //not ordered, also may have zeros (gaps) in the array.
for (final long hashIn : cacheIn) {
if (hashIn > 0) {
sharedThetaSketch.propagate(hashIn);
}
}
}
}
// 3) complete propagation: ping local buffer
sharedThetaSketch.endPropagation(localPropagationInProgress, false);
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
if[call[sharedThetaSketch.validateEpoch, parameter[member[.epoch]]]] begin[{]
call[sharedThetaSketch.endPropagation, parameter[literal[null], literal[false]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.singleHash], !=, member[ConcurrentSharedThetaSketch.NOT_SINGLE_HASH]]] begin[{]
call[sharedThetaSketch.propagate, parameter[member[.singleHash]]]
else begin[{]
if[binary_operation[member[.sketchIn], !=, literal[null]]] begin[{]
local_variable[type[long], volTheta]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=volTheta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getThetaLong, postfix_operators=[], prefix_operators=[], qualifier=sketchIn, selectors=[], type_arguments=None), operator=<=), label=None, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="volTheta = "), operandr=MemberReference(member=volTheta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", bufTheta = "), operator=+), operandr=MethodInvocation(arguments=[], member=getThetaLong, postfix_operators=[], prefix_operators=[], qualifier=sketchIn, selectors=[], type_arguments=None), operator=+))
local_variable[type[long], cacheIn]
if[call[sketchIn.isOrdered, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hashIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=volTheta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hashIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=propagate, postfix_operators=[], prefix_operators=[], qualifier=sharedThetaSketch, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=cacheIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=hashIn)], modifiers={'final'}, type=BasicType(dimensions=[], name=long))), label=None)
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hashIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hashIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=propagate, postfix_operators=[], prefix_operators=[], qualifier=sharedThetaSketch, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=cacheIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=hashIn)], modifiers={'final'}, type=BasicType(dimensions=[], name=long))), label=None)
end[}]
else begin[{]
None
end[}]
end[}]
call[sharedThetaSketch.endPropagation, parameter[member[.localPropagationInProgress], literal[false]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[sharedThetaSketch] operator[SEP] identifier[validateEpoch] operator[SEP] identifier[epoch] operator[SEP] operator[SEP] {
identifier[sharedThetaSketch] operator[SEP] identifier[endPropagation] operator[SEP] Other[null] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[singleHash] operator[!=] identifier[ConcurrentSharedThetaSketch] operator[SEP] identifier[NOT_SINGLE_HASH] operator[SEP] {
identifier[sharedThetaSketch] operator[SEP] identifier[propagate] operator[SEP] identifier[singleHash] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[sketchIn] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[long] identifier[volTheta] operator[=] identifier[sharedThetaSketch] operator[SEP] identifier[getVolatileTheta] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[volTheta] operator[<=] identifier[sketchIn] operator[SEP] identifier[getThetaLong] operator[SEP] operator[SEP] operator[:] literal[String] operator[+] identifier[volTheta] operator[+] literal[String] operator[+] identifier[sketchIn] operator[SEP] identifier[getThetaLong] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[cacheIn] operator[=] identifier[sketchIn] operator[SEP] identifier[getCache] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sketchIn] operator[SEP] identifier[isOrdered] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] Keyword[long] identifier[hashIn] operator[:] identifier[cacheIn] operator[SEP] {
Keyword[if] operator[SEP] identifier[hashIn] operator[>=] identifier[volTheta] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[sharedThetaSketch] operator[SEP] identifier[propagate] operator[SEP] identifier[hashIn] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[final] Keyword[long] identifier[hashIn] operator[:] identifier[cacheIn] operator[SEP] {
Keyword[if] operator[SEP] identifier[hashIn] operator[>] Other[0] operator[SEP] {
identifier[sharedThetaSketch] operator[SEP] identifier[propagate] operator[SEP] identifier[hashIn] operator[SEP] operator[SEP]
}
}
}
}
identifier[sharedThetaSketch] operator[SEP] identifier[endPropagation] operator[SEP] identifier[localPropagationInProgress] , literal[boolean] operator[SEP] operator[SEP]
}
|
private <T> T populateEntity(final T t,
final Map<Field, Long> enumeratesMap,
final Set<Field> nullableFields,
final int currentEmbeddedDepth) {
final Map<Field, GenContainer> genContainers = this.populateScanner.scan(t.getClass());
for (final Map.Entry<Field, GenContainer> annotatedField : genContainers.entrySet()) {
final Field field = annotatedField.getKey();
// If field had errors or null gen in prev populate iteration, just skip that field
if (nullableFields.contains(field))
continue;
try {
field.setAccessible(true);
final Object objValue = generateObject(field,
annotatedField.getValue(),
enumeratesMap,
nullableFields,
currentEmbeddedDepth);
field.set(t, objValue);
} catch (ClassCastException e) {
logger.warning(e.getMessage() + " | field TYPE and GENERATE TYPE are not compatible");
nullableFields.add(field); // skip field due to error as if it null
throw e;
} catch (IllegalAccessException e) {
logger.warning(e.getMessage() + " | have NO ACCESS to field: " + field.getName());
nullableFields.add(field); // skip field due to error as if it null
} catch (Exception e) {
logger.warning(e.getMessage());
nullableFields.add(field); // skip field due to error as if it null
} finally {
annotatedField.getKey().setAccessible(false);
}
}
return t;
} | class class_name[name] begin[{]
method[populateEntity, return_type[type[T]], modifier[private], parameter[t, enumeratesMap, nullableFields, currentEmbeddedDepth]] begin[{]
local_variable[type[Map], genContainers]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=annotatedField, selectors=[], type_arguments=None), name=field)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=nullableFields, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=annotatedField, selectors=[], type_arguments=None), MemberReference(member=enumeratesMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nullableFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentEmbeddedDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=objValue)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" | field TYPE and GENERATE TYPE are not compatible"), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=nullableFields, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" | have NO ACCESS to field: "), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=nullableFields, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=nullableFields, 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=getKey, postfix_operators=[], prefix_operators=[], qualifier=annotatedField, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setAccessible, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=genContainers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=annotatedField)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=GenContainer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.t]]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[T] identifier[populateEntity] operator[SEP] Keyword[final] identifier[T] identifier[t] , Keyword[final] identifier[Map] operator[<] identifier[Field] , identifier[Long] operator[>] identifier[enumeratesMap] , Keyword[final] identifier[Set] operator[<] identifier[Field] operator[>] identifier[nullableFields] , Keyword[final] Keyword[int] identifier[currentEmbeddedDepth] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[Field] , identifier[GenContainer] operator[>] identifier[genContainers] operator[=] Keyword[this] operator[SEP] identifier[populateScanner] operator[SEP] identifier[scan] operator[SEP] identifier[t] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Field] , identifier[GenContainer] operator[>] identifier[annotatedField] operator[:] identifier[genContainers] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Field] identifier[field] operator[=] identifier[annotatedField] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nullableFields] operator[SEP] identifier[contains] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[try] {
identifier[field] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[objValue] operator[=] identifier[generateObject] operator[SEP] identifier[field] , identifier[annotatedField] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[enumeratesMap] , identifier[nullableFields] , identifier[currentEmbeddedDepth] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[set] operator[SEP] identifier[t] , identifier[objValue] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[nullableFields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[nullableFields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[nullableFields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[annotatedField] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[t] operator[SEP]
}
|
public static boolean fieldInsnEqual(FieldInsnNode insn1, FieldInsnNode insn2)
{
return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc);
} | class class_name[name] begin[{]
method[fieldInsnEqual, return_type[type[boolean]], modifier[public static], parameter[insn1, insn2]] begin[{]
return[binary_operation[binary_operation[call[insn1.owner.equals, parameter[member[insn2.owner]]], &&, call[insn1.name.equals, parameter[member[insn2.name]]]], &&, call[insn1.desc.equals, parameter[member[insn2.desc]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[fieldInsnEqual] operator[SEP] identifier[FieldInsnNode] identifier[insn1] , identifier[FieldInsnNode] identifier[insn2] operator[SEP] {
Keyword[return] identifier[insn1] operator[SEP] identifier[owner] operator[SEP] identifier[equals] operator[SEP] identifier[insn2] operator[SEP] identifier[owner] operator[SEP] operator[&&] identifier[insn1] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] identifier[insn2] operator[SEP] identifier[name] operator[SEP] operator[&&] identifier[insn1] operator[SEP] identifier[desc] operator[SEP] identifier[equals] operator[SEP] identifier[insn2] operator[SEP] identifier[desc] operator[SEP] operator[SEP]
}
|
public static HttpRequest put(final String destination) {
return new HttpRequest()
.method(HttpMethod.PUT)
.set(destination);
} | class class_name[name] begin[{]
method[put, return_type[type[HttpRequest]], modifier[public static], parameter[destination]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=PUT, postfix_operators=[], prefix_operators=[], qualifier=HttpMethod, selectors=[])], member=method, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=HttpRequest, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpRequest] identifier[put] operator[SEP] Keyword[final] identifier[String] identifier[destination] operator[SEP] {
Keyword[return] Keyword[new] identifier[HttpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[HttpMethod] operator[SEP] identifier[PUT] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[destination] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) {
System.out.println("Fastest instance is " + fastestInstance());
System.out.println("Fastest Java instance is " + fastestJavaInstance());
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
call[System.out.println, parameter[binary_operation[literal["Fastest instance is "], +, call[.fastestInstance, parameter[]]]]]
call[System.out.println, parameter[binary_operation[literal["Fastest Java instance is "], +, call[.fastestJavaInstance, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[fastestInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[fastestJavaInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object get(String fieldName) throws IOException {
Object value = getValueMarshaller(fieldName).getJavaObject(struct);
LOG.debug("Fetched {}={}", fieldName, value);
return value;
} | class class_name[name] begin[{]
method[get, return_type[type[Object]], modifier[public], parameter[fieldName]] begin[{]
local_variable[type[Object], value]
call[LOG.debug, parameter[literal["Fetched {}={}"], member[.fieldName], member[.value]]]
return[member[.value]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[get] operator[SEP] identifier[String] identifier[fieldName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Object] identifier[value] operator[=] identifier[getValueMarshaller] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[getJavaObject] operator[SEP] identifier[struct] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[fieldName] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
private static Mode chooseMode(String content, String encoding) {
if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) {
// Choose Kanji mode if all input are double-byte characters
return Mode.KANJI;
}
boolean hasNumeric = false;
boolean hasAlphanumeric = false;
for (int i = 0; i < content.length(); ++i) {
char c = content.charAt(i);
if (c >= '0' && c <= '9') {
hasNumeric = true;
} else if (getAlphanumericCode(c) != -1) {
hasAlphanumeric = true;
} else {
return Mode.BYTE;
}
}
if (hasAlphanumeric) {
return Mode.ALPHANUMERIC;
}
if (hasNumeric) {
return Mode.NUMERIC;
}
return Mode.BYTE;
} | class class_name[name] begin[{]
method[chooseMode, return_type[type[Mode]], modifier[private static], parameter[content, encoding]] begin[{]
if[binary_operation[literal["Shift_JIS"], &&, call[.isOnlyDoubleByteKanji, parameter[member[.content]]]]] begin[{]
return[member[Mode.KANJI]]
else begin[{]
None
end[}]
local_variable[type[boolean], hasNumeric]
local_variable[type[boolean], hasAlphanumeric]
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=content, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAlphanumericCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=BYTE, postfix_operators=[], prefix_operators=[], qualifier=Mode, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasAlphanumeric, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasNumeric, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
if[member[.hasAlphanumeric]] begin[{]
return[member[Mode.ALPHANUMERIC]]
else begin[{]
None
end[}]
if[member[.hasNumeric]] begin[{]
return[member[Mode.NUMERIC]]
else begin[{]
None
end[}]
return[member[Mode.BYTE]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Mode] identifier[chooseMode] operator[SEP] identifier[String] identifier[content] , identifier[String] identifier[encoding] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[encoding] operator[SEP] operator[&&] identifier[isOnlyDoubleByteKanji] operator[SEP] identifier[content] operator[SEP] operator[SEP] {
Keyword[return] identifier[Mode] operator[SEP] identifier[KANJI] operator[SEP]
}
Keyword[boolean] identifier[hasNumeric] operator[=] literal[boolean] operator[SEP] Keyword[boolean] identifier[hasAlphanumeric] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[content] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[content] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[String] operator[&&] identifier[c] operator[<=] literal[String] operator[SEP] {
identifier[hasNumeric] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[getAlphanumericCode] operator[SEP] identifier[c] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[hasAlphanumeric] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Mode] operator[SEP] identifier[BYTE] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[hasAlphanumeric] operator[SEP] {
Keyword[return] identifier[Mode] operator[SEP] identifier[ALPHANUMERIC] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hasNumeric] operator[SEP] {
Keyword[return] identifier[Mode] operator[SEP] identifier[NUMERIC] operator[SEP]
}
Keyword[return] identifier[Mode] operator[SEP] identifier[BYTE] operator[SEP]
}
|
public String getResourceClassName(String strBasePackage, String resourceName)
{
if (resourceName == null)
resourceName = strBasePackage.substring(strBasePackage.lastIndexOf('.') + 1);
strBasePackage = strBasePackage.substring(0, strBasePackage.lastIndexOf('.') + 1);
resourceName = Utility.getFullClassName(null, strBasePackage, resourceName);
resourceName = Utility.convertClassName(resourceName, Constants.RES_SUBPACKAGE);
return strBasePackage;
} | class class_name[name] begin[{]
method[getResourceClassName, return_type[type[String]], modifier[public], parameter[strBasePackage, resourceName]] begin[{]
if[binary_operation[member[.resourceName], ==, literal[null]]] begin[{]
assign[member[.resourceName], call[strBasePackage.substring, parameter[binary_operation[call[strBasePackage.lastIndexOf, parameter[literal['.']]], +, literal[1]]]]]
else begin[{]
None
end[}]
assign[member[.strBasePackage], call[strBasePackage.substring, parameter[literal[0], binary_operation[call[strBasePackage.lastIndexOf, parameter[literal['.']]], +, literal[1]]]]]
assign[member[.resourceName], call[Utility.getFullClassName, parameter[literal[null], member[.strBasePackage], member[.resourceName]]]]
assign[member[.resourceName], call[Utility.convertClassName, parameter[member[.resourceName], member[Constants.RES_SUBPACKAGE]]]]
return[member[.strBasePackage]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getResourceClassName] operator[SEP] identifier[String] identifier[strBasePackage] , identifier[String] identifier[resourceName] operator[SEP] {
Keyword[if] operator[SEP] identifier[resourceName] operator[==] Other[null] operator[SEP] identifier[resourceName] operator[=] identifier[strBasePackage] operator[SEP] identifier[substring] operator[SEP] identifier[strBasePackage] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[strBasePackage] operator[=] identifier[strBasePackage] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[strBasePackage] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[resourceName] operator[=] identifier[Utility] operator[SEP] identifier[getFullClassName] operator[SEP] Other[null] , identifier[strBasePackage] , identifier[resourceName] operator[SEP] operator[SEP] identifier[resourceName] operator[=] identifier[Utility] operator[SEP] identifier[convertClassName] operator[SEP] identifier[resourceName] , identifier[Constants] operator[SEP] identifier[RES_SUBPACKAGE] operator[SEP] operator[SEP] Keyword[return] identifier[strBasePackage] operator[SEP]
}
|
private final static HashMap<String, String> toHashMap(List<? extends ResourceInfo.Property> propList) {
if (propList == null)
return null;
HashMap<String, String> propMap = new HashMap<String, String>();
for (ResourceInfo.Property prop : propList)
propMap.put(prop.getName(), prop.getValue());
return propMap;
} | class class_name[name] begin[{]
method[toHashMap, return_type[type[HashMap]], modifier[final private static], parameter[propList]] begin[{]
if[binary_operation[member[.propList], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[HashMap], propMap]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=propMap, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=propList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=prop)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResourceInfo, sub_type=ReferenceType(arguments=None, dimensions=None, name=Property, sub_type=None)))), label=None)
return[member[.propMap]]
end[}]
END[}] | Keyword[private] Keyword[final] Keyword[static] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[toHashMap] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[ResourceInfo] operator[SEP] identifier[Property] operator[>] identifier[propList] operator[SEP] {
Keyword[if] operator[SEP] identifier[propList] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[propMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ResourceInfo] operator[SEP] identifier[Property] identifier[prop] operator[:] identifier[propList] operator[SEP] identifier[propMap] operator[SEP] identifier[put] operator[SEP] identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[prop] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[propMap] operator[SEP]
}
|
public Version append(int number, String label) {
validateNumber(number);
return appendNumber(number, label);
} | class class_name[name] begin[{]
method[append, return_type[type[Version]], modifier[public], parameter[number, label]] begin[{]
call[.validateNumber, parameter[member[.number]]]
return[call[.appendNumber, parameter[member[.number], member[.label]]]]
end[}]
END[}] | Keyword[public] identifier[Version] identifier[append] operator[SEP] Keyword[int] identifier[number] , identifier[String] identifier[label] operator[SEP] {
identifier[validateNumber] operator[SEP] identifier[number] operator[SEP] operator[SEP] Keyword[return] identifier[appendNumber] operator[SEP] identifier[number] , identifier[label] operator[SEP] operator[SEP]
}
|
public DAFileWriter appendImports(@Nonnull Collection<DAImport> mapperImports) throws IOException {
checkNotNull(mapperImports, "Collection of imports can not be null");
if (mapperImports.isEmpty()) {
return this;
}
List<DAName> imports = removeDuplicatesFilterJavaLangAndSortImports(mapperImports);
if (imports.isEmpty()) {
this.importQualifiedNames = Collections.emptySet();
this.importSimpleNames = Collections.emptySet();
return this;
}
this.importQualifiedNames = from(mapperImports)
.transform(DAImportFunctions.toQualifiedName())
.filter(notNull())
.toSet();
this.importSimpleNames = from(mapperImports).transform(DAImportFunctions.toSimpleName())
.filter(notNull())
.toSet();
for (DAName name : imports) {
writer.append("import ").append(name).append(";");
writer.newLine();
}
writer.newLine();
return this;
} | class class_name[name] begin[{]
method[appendImports, return_type[type[DAFileWriter]], modifier[public], parameter[mapperImports]] begin[{]
call[.checkNotNull, parameter[member[.mapperImports], literal["Collection of imports can not be null"]]]
if[call[mapperImports.isEmpty, parameter[]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[List], imports]
if[call[imports.isEmpty, parameter[]]] begin[{]
assign[THIS[member[None.importQualifiedNames]], call[Collections.emptySet, parameter[]]]
assign[THIS[member[None.importSimpleNames]], call[Collections.emptySet, parameter[]]]
return[THIS[]]
else begin[{]
None
end[}]
assign[THIS[member[None.importQualifiedNames]], call[.from, parameter[member[.mapperImports]]]]
assign[THIS[member[None.importSimpleNames]], call[.from, parameter[member[.mapperImports]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="import ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=newLine, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=imports, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DAName, sub_type=None))), label=None)
call[writer.newLine, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DAFileWriter] identifier[appendImports] operator[SEP] annotation[@] identifier[Nonnull] identifier[Collection] operator[<] identifier[DAImport] operator[>] identifier[mapperImports] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkNotNull] operator[SEP] identifier[mapperImports] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mapperImports] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
identifier[List] operator[<] identifier[DAName] operator[>] identifier[imports] operator[=] identifier[removeDuplicatesFilterJavaLangAndSortImports] operator[SEP] identifier[mapperImports] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[imports] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[importQualifiedNames] operator[=] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[importSimpleNames] operator[=] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
Keyword[this] operator[SEP] identifier[importQualifiedNames] operator[=] identifier[from] operator[SEP] identifier[mapperImports] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[DAImportFunctions] operator[SEP] identifier[toQualifiedName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[notNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[importSimpleNames] operator[=] identifier[from] operator[SEP] identifier[mapperImports] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[DAImportFunctions] operator[SEP] identifier[toSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[notNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DAName] identifier[name] operator[:] identifier[imports] operator[SEP] {
identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
protected boolean shouldEnable( int[] selected ) {
return selected != null && selected.length >= 1 && (requiredCount == -1 || requiredCount == selected.length);
} | class class_name[name] begin[{]
method[shouldEnable, return_type[type[boolean]], modifier[protected], parameter[selected]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.selected], !=, literal[null]], &&, binary_operation[member[selected.length], >=, literal[1]]], &&, binary_operation[binary_operation[member[.requiredCount], ==, literal[1]], ||, binary_operation[member[.requiredCount], ==, member[selected.length]]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[shouldEnable] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[selected] operator[SEP] {
Keyword[return] identifier[selected] operator[!=] Other[null] operator[&&] identifier[selected] operator[SEP] identifier[length] operator[>=] Other[1] operator[&&] operator[SEP] identifier[requiredCount] operator[==] operator[-] Other[1] operator[||] identifier[requiredCount] operator[==] identifier[selected] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
|
public double calculateDistance(S individual, double[] lambda,
double[] z_, double[] nz_) {
double scale;
double distance;
double[] vecInd = new double[problem.getNumberOfObjectives()];
double[] vecProj = new double[problem.getNumberOfObjectives()];
// normalize the weight vector (line segment)
double nd = norm_vector(lambda);
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
lambda[i] = lambda[i] / nd;
}
// vecInd has been normalized to the range [0,1]
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
vecInd[i] = (individual.getObjective(i) - z_[i]) / (nz_[i] - z_[i]);
}
scale = innerproduct(vecInd, lambda);
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
vecProj[i] = vecInd[i] - scale * lambda[i];
}
distance = norm_vector(vecProj);
return distance;
} | class class_name[name] begin[{]
method[calculateDistance, return_type[type[double]], modifier[public], parameter[individual, lambda, z_, nz_]] begin[{]
local_variable[type[double], scale]
local_variable[type[double], distance]
local_variable[type[double], vecInd]
local_variable[type[double], vecProj]
local_variable[type[double], nd]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lambda, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=lambda, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=nd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumberOfObjectives, postfix_operators=[], prefix_operators=[], qualifier=problem, 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)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=vecInd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjective, postfix_operators=[], prefix_operators=[], qualifier=individual, selectors=[], type_arguments=None), operandr=MemberReference(member=z_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), operandr=BinaryOperation(operandl=MemberReference(member=nz_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=z_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), operator=/)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumberOfObjectives, postfix_operators=[], prefix_operators=[], qualifier=problem, 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)
assign[member[.scale], call[.innerproduct, parameter[member[.vecInd], member[.lambda]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=vecProj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=vecInd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=BinaryOperation(operandl=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lambda, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=-)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumberOfObjectives, postfix_operators=[], prefix_operators=[], qualifier=problem, 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)
assign[member[.distance], call[.norm_vector, parameter[member[.vecProj]]]]
return[member[.distance]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[calculateDistance] operator[SEP] identifier[S] identifier[individual] , Keyword[double] operator[SEP] operator[SEP] identifier[lambda] , Keyword[double] operator[SEP] operator[SEP] identifier[z_] , Keyword[double] operator[SEP] operator[SEP] identifier[nz_] operator[SEP] {
Keyword[double] identifier[scale] operator[SEP] Keyword[double] identifier[distance] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[vecInd] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[problem] operator[SEP] identifier[getNumberOfObjectives] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[vecProj] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[problem] operator[SEP] identifier[getNumberOfObjectives] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[nd] operator[=] identifier[norm_vector] operator[SEP] identifier[lambda] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[problem] operator[SEP] identifier[getNumberOfObjectives] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[lambda] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[lambda] operator[SEP] identifier[i] operator[SEP] operator[/] identifier[nd] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[problem] operator[SEP] identifier[getNumberOfObjectives] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[vecInd] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] identifier[individual] operator[SEP] identifier[getObjective] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[z_] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[/] operator[SEP] identifier[nz_] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[z_] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[scale] operator[=] identifier[innerproduct] operator[SEP] identifier[vecInd] , identifier[lambda] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[problem] operator[SEP] identifier[getNumberOfObjectives] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[vecProj] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[vecInd] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[scale] operator[*] identifier[lambda] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[distance] operator[=] identifier[norm_vector] operator[SEP] identifier[vecProj] operator[SEP] operator[SEP] Keyword[return] identifier[distance] operator[SEP]
}
|
public String get(ConfigKey pKey) {
String value = globalConfig.get(pKey);
if (value == null) {
value = pKey.getDefaultValue();
}
return value;
} | class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[pKey]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
assign[member[.value], call[pKey.getDefaultValue, parameter[]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[get] operator[SEP] identifier[ConfigKey] identifier[pKey] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[globalConfig] operator[SEP] identifier[get] operator[SEP] identifier[pKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[pKey] operator[SEP] identifier[getDefaultValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
|
public ArrayList<String> getCarouselImages(){
ArrayList<String> carouselImages = new ArrayList<>();
for(CTInboxMessageContent ctInboxMessageContent: getInboxMessageContents()){
carouselImages.add(ctInboxMessageContent.getMedia());
}
return carouselImages;
} | class class_name[name] begin[{]
method[getCarouselImages, return_type[type[ArrayList]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], carouselImages]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMedia, postfix_operators=[], prefix_operators=[], qualifier=ctInboxMessageContent, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=carouselImages, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInboxMessageContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ctInboxMessageContent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CTInboxMessageContent, sub_type=None))), label=None)
return[member[.carouselImages]]
end[}]
END[}] | Keyword[public] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[getCarouselImages] operator[SEP] operator[SEP] {
identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[carouselImages] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CTInboxMessageContent] identifier[ctInboxMessageContent] operator[:] identifier[getInboxMessageContents] operator[SEP] operator[SEP] operator[SEP] {
identifier[carouselImages] operator[SEP] identifier[add] operator[SEP] identifier[ctInboxMessageContent] operator[SEP] identifier[getMedia] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[carouselImages] operator[SEP]
}
|
private static Composite addEOC(Composite composite, Bound eocBound)
{
return eocBound == Bound.END ? composite.end() : composite.start();
} | class class_name[name] begin[{]
method[addEOC, return_type[type[Composite]], modifier[private static], parameter[composite, eocBound]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=eocBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=END, postfix_operators=[], prefix_operators=[], qualifier=Bound, selectors=[]), operator===), if_false=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=composite, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=end, postfix_operators=[], prefix_operators=[], qualifier=composite, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Composite] identifier[addEOC] operator[SEP] identifier[Composite] identifier[composite] , identifier[Bound] identifier[eocBound] operator[SEP] {
Keyword[return] identifier[eocBound] operator[==] identifier[Bound] operator[SEP] identifier[END] operator[?] identifier[composite] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[:] identifier[composite] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
public final void warn(Object pObject)
{
getLogger().log(FQCN, Level.WARN, pObject, null);
} | class class_name[name] begin[{]
method[warn, return_type[void], modifier[final public], parameter[pObject]] begin[{]
call[.getLogger, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[warn] operator[SEP] identifier[Object] identifier[pObject] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[FQCN] , identifier[Level] operator[SEP] identifier[WARN] , identifier[pObject] , Other[null] operator[SEP] operator[SEP]
}
|
public EClass getFNORG() {
if (fnorgEClass == null) {
fnorgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(429);
}
return fnorgEClass;
} | class class_name[name] begin[{]
method[getFNORG, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.fnorgEClass], ==, literal[null]]] begin[{]
assign[member[.fnorgEClass], 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=429)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.fnorgEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getFNORG] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fnorgEClass] operator[==] Other[null] operator[SEP] {
identifier[fnorgEClass] operator[=] operator[SEP] identifier[EClass] 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[429] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fnorgEClass] operator[SEP]
}
|
public SQLStatement parse(final boolean useCache, final String sql) {
Optional<SQLStatement> cachedSQLStatement = getSQLStatementFromCache(useCache, sql);
if (cachedSQLStatement.isPresent()) {
return cachedSQLStatement.get();
}
SQLStatement result = SQLParserFactory.newInstance(dbType, encryptRule, shardingTableMetaData, sql).parse();
if (useCache) {
parsingResultCache.put(sql, result);
}
return result;
} | class class_name[name] begin[{]
method[parse, return_type[type[SQLStatement]], modifier[public], parameter[useCache, sql]] begin[{]
local_variable[type[Optional], cachedSQLStatement]
if[call[cachedSQLStatement.isPresent, parameter[]]] begin[{]
return[call[cachedSQLStatement.get, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[SQLStatement], result]
if[member[.useCache]] begin[{]
call[parsingResultCache.put, parameter[member[.sql], member[.result]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[SQLStatement] identifier[parse] operator[SEP] Keyword[final] Keyword[boolean] identifier[useCache] , Keyword[final] identifier[String] identifier[sql] operator[SEP] {
identifier[Optional] operator[<] identifier[SQLStatement] operator[>] identifier[cachedSQLStatement] operator[=] identifier[getSQLStatementFromCache] operator[SEP] identifier[useCache] , identifier[sql] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cachedSQLStatement] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[cachedSQLStatement] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SQLStatement] identifier[result] operator[=] identifier[SQLParserFactory] operator[SEP] identifier[newInstance] operator[SEP] identifier[dbType] , identifier[encryptRule] , identifier[shardingTableMetaData] , identifier[sql] operator[SEP] operator[SEP] identifier[parse] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[useCache] operator[SEP] {
identifier[parsingResultCache] operator[SEP] identifier[put] operator[SEP] identifier[sql] , identifier[result] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static JedisPool create(final PippoSettings settings) {
String host = settings.getString(HOST, Protocol.DEFAULT_HOST).trim();
int minIdle = settings.getInteger(MIN_IDLE, GenericObjectPoolConfig.DEFAULT_MIN_IDLE);
int maxIdle = settings.getInteger(MAX_IDLE, GenericObjectPoolConfig.DEFAULT_MAX_IDLE);
int maxTotal = settings.getInteger(MAX_TOTAL, GenericObjectPoolConfig.DEFAULT_MAX_TOTAL);
JedisPoolConfig config = new JedisPoolConfig();
config.setMinIdle(minIdle);
config.setMaxIdle(maxIdle);
config.setMaxTotal(maxTotal);
try {
return new JedisPool(config, new URI(host));
} catch (URISyntaxException e) {
throw new PippoRuntimeException("Malformed redis URI", e);
}
} | class class_name[name] begin[{]
method[create, return_type[type[JedisPool]], modifier[public static], parameter[settings]] begin[{]
local_variable[type[String], host]
local_variable[type[int], minIdle]
local_variable[type[int], maxIdle]
local_variable[type[int], maxTotal]
local_variable[type[JedisPoolConfig], config]
call[config.setMinIdle, parameter[member[.minIdle]]]
call[config.setMaxIdle, parameter[member[.maxIdle]]]
call[config.setMaxTotal, parameter[member[.maxTotal]]]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=host, 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=URI, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JedisPool, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Malformed redis URI"), 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=PippoRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JedisPool] identifier[create] operator[SEP] Keyword[final] identifier[PippoSettings] identifier[settings] operator[SEP] {
identifier[String] identifier[host] operator[=] identifier[settings] operator[SEP] identifier[getString] operator[SEP] identifier[HOST] , identifier[Protocol] operator[SEP] identifier[DEFAULT_HOST] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[minIdle] operator[=] identifier[settings] operator[SEP] identifier[getInteger] operator[SEP] identifier[MIN_IDLE] , identifier[GenericObjectPoolConfig] operator[SEP] identifier[DEFAULT_MIN_IDLE] operator[SEP] operator[SEP] Keyword[int] identifier[maxIdle] operator[=] identifier[settings] operator[SEP] identifier[getInteger] operator[SEP] identifier[MAX_IDLE] , identifier[GenericObjectPoolConfig] operator[SEP] identifier[DEFAULT_MAX_IDLE] operator[SEP] operator[SEP] Keyword[int] identifier[maxTotal] operator[=] identifier[settings] operator[SEP] identifier[getInteger] operator[SEP] identifier[MAX_TOTAL] , identifier[GenericObjectPoolConfig] operator[SEP] identifier[DEFAULT_MAX_TOTAL] operator[SEP] operator[SEP] identifier[JedisPoolConfig] identifier[config] operator[=] Keyword[new] identifier[JedisPoolConfig] operator[SEP] operator[SEP] operator[SEP] identifier[config] operator[SEP] identifier[setMinIdle] operator[SEP] identifier[minIdle] operator[SEP] operator[SEP] identifier[config] operator[SEP] identifier[setMaxIdle] operator[SEP] identifier[maxIdle] operator[SEP] operator[SEP] identifier[config] operator[SEP] identifier[setMaxTotal] operator[SEP] identifier[maxTotal] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] Keyword[new] identifier[JedisPool] operator[SEP] identifier[config] , Keyword[new] identifier[URI] operator[SEP] identifier[host] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PippoRuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static int[] renderedImage2IntegerArray( RenderedImage renderedImage, double multiply ) {
int width = renderedImage.getWidth();
int height = renderedImage.getHeight();
int[] values = new int[width * height];
RandomIter imageIter = RandomIterFactory.create(renderedImage, null);
int index = 0;;
for( int x = 0; x < width; x++ ) {
for( int y = 0; y < height; y++ ) {
double sample = imageIter.getSampleDouble(x, y, 0);
sample = sample * multiply;
values[index++] = (int) sample;
}
}
imageIter.done();
return values;
} | class class_name[name] begin[{]
method[renderedImage2IntegerArray, return_type[type[int]], modifier[public static], parameter[renderedImage, multiply]] begin[{]
local_variable[type[int], width]
local_variable[type[int], height]
local_variable[type[int], values]
local_variable[type[RandomIter], imageIter]
local_variable[type[int], index]
Statement(label=None)
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getSampleDouble, postfix_operators=[], prefix_operators=[], qualifier=imageIter, selectors=[], type_arguments=None), name=sample)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sample, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=sample, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=multiply, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=sample, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=height, 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=y)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=y, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=width, 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=x)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=x, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[imageIter.done, parameter[]]
return[member[.values]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[renderedImage2IntegerArray] operator[SEP] identifier[RenderedImage] identifier[renderedImage] , Keyword[double] identifier[multiply] operator[SEP] {
Keyword[int] identifier[width] operator[=] identifier[renderedImage] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[renderedImage] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[values] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[width] operator[*] identifier[height] operator[SEP] operator[SEP] identifier[RandomIter] identifier[imageIter] operator[=] identifier[RandomIterFactory] operator[SEP] identifier[create] operator[SEP] identifier[renderedImage] , Other[null] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[x] operator[=] Other[0] operator[SEP] identifier[x] operator[<] identifier[width] operator[SEP] identifier[x] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[y] operator[=] Other[0] operator[SEP] identifier[y] operator[<] identifier[height] operator[SEP] identifier[y] operator[++] operator[SEP] {
Keyword[double] identifier[sample] operator[=] identifier[imageIter] operator[SEP] identifier[getSampleDouble] operator[SEP] identifier[x] , identifier[y] , Other[0] operator[SEP] operator[SEP] identifier[sample] operator[=] identifier[sample] operator[*] identifier[multiply] operator[SEP] identifier[values] operator[SEP] identifier[index] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[sample] operator[SEP]
}
}
identifier[imageIter] operator[SEP] identifier[done] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[values] operator[SEP]
}
|
public static FramesConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_FRAMES);
final int horizontals = node.readInteger(ATT_HORIZONTAL);
final int verticals = node.readInteger(ATT_VERTICAL);
final int offsetX = node.readInteger(0, ATT_OFFSET_X);
final int offsetY = node.readInteger(0, ATT_OFFSET_Y);
return new FramesConfig(horizontals, verticals, offsetX, offsetY);
} | class class_name[name] begin[{]
method[imports, return_type[type[FramesConfig]], modifier[public static], parameter[root]] begin[{]
call[Check.notNull, parameter[member[.root]]]
local_variable[type[Xml], node]
local_variable[type[int], horizontals]
local_variable[type[int], verticals]
local_variable[type[int], offsetX]
local_variable[type[int], offsetY]
return[ClassCreator(arguments=[MemberReference(member=horizontals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=verticals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offsetX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offsetY, 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=FramesConfig, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FramesConfig] identifier[imports] operator[SEP] identifier[Xml] identifier[root] operator[SEP] {
identifier[Check] operator[SEP] identifier[notNull] operator[SEP] identifier[root] operator[SEP] operator[SEP] Keyword[final] identifier[Xml] identifier[node] operator[=] identifier[root] operator[SEP] identifier[getChild] operator[SEP] identifier[NODE_FRAMES] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[horizontals] operator[=] identifier[node] operator[SEP] identifier[readInteger] operator[SEP] identifier[ATT_HORIZONTAL] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[verticals] operator[=] identifier[node] operator[SEP] identifier[readInteger] operator[SEP] identifier[ATT_VERTICAL] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[offsetX] operator[=] identifier[node] operator[SEP] identifier[readInteger] operator[SEP] Other[0] , identifier[ATT_OFFSET_X] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[offsetY] operator[=] identifier[node] operator[SEP] identifier[readInteger] operator[SEP] Other[0] , identifier[ATT_OFFSET_Y] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[FramesConfig] operator[SEP] identifier[horizontals] , identifier[verticals] , identifier[offsetX] , identifier[offsetY] operator[SEP] operator[SEP]
}
|
@Override
public Object find(Class entityClass, Object key)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);
Object e = r.db(entityMetadata.getSchema()).table(entityMetadata.getTableName()).get(key).run(connection,
entityClass);
PropertyAccessorHelper.setId(e, entityMetadata, key);
return e;
} | class class_name[name] begin[{]
method[find, return_type[type[Object]], modifier[public], parameter[entityClass, key]] begin[{]
local_variable[type[EntityMetadata], entityMetadata]
local_variable[type[Object], e]
call[PropertyAccessorHelper.setId, parameter[member[.e], member[.entityMetadata], member[.key]]]
return[member[.e]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[find] operator[SEP] identifier[Class] identifier[entityClass] , identifier[Object] identifier[key] operator[SEP] {
identifier[EntityMetadata] identifier[entityMetadata] operator[=] identifier[KunderaMetadataManager] operator[SEP] identifier[getEntityMetadata] operator[SEP] identifier[kunderaMetadata] , identifier[entityClass] operator[SEP] operator[SEP] identifier[Object] identifier[e] operator[=] identifier[r] operator[SEP] identifier[db] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getSchema] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[run] operator[SEP] identifier[connection] , identifier[entityClass] operator[SEP] operator[SEP] identifier[PropertyAccessorHelper] operator[SEP] identifier[setId] operator[SEP] identifier[e] , identifier[entityMetadata] , identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
|
public static <T extends GenericEvent> GenericEventType getTypeOf(Class<T> clazz) {
GenericEventType eventType = TYPE_MAP.get(clazz);
if (eventType == null) {
eventType = new GenericEventType();
TYPE_MAP.put(clazz, eventType);
}
return eventType;
} | class class_name[name] begin[{]
method[getTypeOf, return_type[type[GenericEventType]], modifier[public static], parameter[clazz]] begin[{]
local_variable[type[GenericEventType], eventType]
if[binary_operation[member[.eventType], ==, literal[null]]] begin[{]
assign[member[.eventType], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GenericEventType, sub_type=None))]
call[TYPE_MAP.put, parameter[member[.clazz], member[.eventType]]]
else begin[{]
None
end[}]
return[member[.eventType]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[GenericEvent] operator[>] identifier[GenericEventType] identifier[getTypeOf] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
identifier[GenericEventType] identifier[eventType] operator[=] identifier[TYPE_MAP] operator[SEP] identifier[get] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eventType] operator[==] Other[null] operator[SEP] {
identifier[eventType] operator[=] Keyword[new] identifier[GenericEventType] operator[SEP] operator[SEP] operator[SEP] identifier[TYPE_MAP] operator[SEP] identifier[put] operator[SEP] identifier[clazz] , identifier[eventType] operator[SEP] operator[SEP]
}
Keyword[return] identifier[eventType] operator[SEP]
}
|
public static boolean isPublicStatic(Field f) {
final int modifiers = f.getModifiers();
return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers);
} | class class_name[name] begin[{]
method[isPublicStatic, return_type[type[boolean]], modifier[public static], parameter[f]] begin[{]
local_variable[type[int], modifiers]
return[binary_operation[call[Modifier.isPublic, parameter[member[.modifiers]]], &&, call[Modifier.isStatic, parameter[member[.modifiers]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isPublicStatic] operator[SEP] identifier[Field] identifier[f] operator[SEP] {
Keyword[final] Keyword[int] identifier[modifiers] operator[=] identifier[f] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Modifier] operator[SEP] identifier[isPublic] operator[SEP] identifier[modifiers] operator[SEP] operator[&&] identifier[Modifier] operator[SEP] identifier[isStatic] operator[SEP] identifier[modifiers] operator[SEP] operator[SEP]
}
|
public UReport press(final int iterations, final int stableSpan, final double stableBound,
final long timeLimit, final TimeUnit timeUnit) {
return press(null, iterations, stableSpan, stableBound, timeLimit, timeUnit);
} | class class_name[name] begin[{]
method[press, return_type[type[UReport]], modifier[public], parameter[iterations, stableSpan, stableBound, timeLimit, timeUnit]] begin[{]
return[call[.press, parameter[literal[null], member[.iterations], member[.stableSpan], member[.stableBound], member[.timeLimit], member[.timeUnit]]]]
end[}]
END[}] | Keyword[public] identifier[UReport] identifier[press] operator[SEP] Keyword[final] Keyword[int] identifier[iterations] , Keyword[final] Keyword[int] identifier[stableSpan] , Keyword[final] Keyword[double] identifier[stableBound] , Keyword[final] Keyword[long] identifier[timeLimit] , Keyword[final] identifier[TimeUnit] identifier[timeUnit] operator[SEP] {
Keyword[return] identifier[press] operator[SEP] Other[null] , identifier[iterations] , identifier[stableSpan] , identifier[stableBound] , identifier[timeLimit] , identifier[timeUnit] operator[SEP] operator[SEP]
}
|
public File getFile() throws IllegalStateException {
File f = tempFile;
if(f==null) throw new IllegalStateException();
return f;
} | class class_name[name] begin[{]
method[getFile, return_type[type[File]], modifier[public], parameter[]] begin[{]
local_variable[type[File], f]
if[binary_operation[member[.f], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.f]]
end[}]
END[}] | Keyword[public] identifier[File] identifier[getFile] operator[SEP] operator[SEP] Keyword[throws] identifier[IllegalStateException] {
identifier[File] identifier[f] operator[=] identifier[tempFile] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP]
}
|
public static <T> void removeValue(Map<?,T> map, T value) {
ArrayList<Object> keys = new ArrayList<>();
for (Map.Entry<?,T> e : map.entrySet())
if (e.getValue().equals(value))
keys.add(e.getKey());
for (Object key : keys)
map.remove(key);
} | class class_name[name] begin[{]
method[removeValue, return_type[void], modifier[public static], parameter[map, value]] begin[{]
local_variable[type[ArrayList], keys]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=keys, selectors=[], type_arguments=None), label=None)), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[removeValue] operator[SEP] identifier[Map] operator[<] operator[?] , identifier[T] operator[>] identifier[map] , identifier[T] identifier[value] operator[SEP] {
identifier[ArrayList] operator[<] identifier[Object] operator[>] identifier[keys] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] operator[?] , identifier[T] operator[>] identifier[e] operator[:] identifier[map] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[keys] operator[SEP] identifier[add] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[key] operator[:] identifier[keys] operator[SEP] identifier[map] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
@Override
public void cancel() throws IllegalStateException, NoSuchObjectLocalException, EJBException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "cancel: " + this);
// Determine if the calling bean is in a state that allows timer service
// method access - throws IllegalStateException if not allowed.
checkTimerAccess();
// Determine if this timer is considered cancelled for the current
// thread/transaction - throws NoSuchObjectLocalException if cancelled.
checkIfCancelled();
// -----------------------------------------------------------------------
// Concurrency behavior for Non-persistent timer cancel: RTC107334
//
// Concurrent Cancel and getTimers() / Expiration
// - Once cancel has called (but before the transaction commits), timer
// expiration will not occur and getTimers() will not return the
// cancelled timer. If rollback occurs, the timer will be re-scheduled
// and once again be returned by getTimers().
// > Differs from persistent timers; persistent timers may or may not
// block expiration (depending on database); but getTimers() would
// return the timer until the cancel commits. Difference in getTimers()
// behavior maintained since it was originally implemented that way
// and would cause no significant problem for applications.
//
// Concurrent Cancel and Expiration:
// - If cancel occurs just before the timeout begins running, then the
// timer will not run; unless rollback occurs, then it will be
// re-scheduled and run immediately.
// - If the timeout method has started running, the cancel will not be
// blocked; however the timer will not re-schedule if it fails. The
// cancel transaction will be able to complete even if the timer
// is still running; but all other attempts to access it will
// report it does not exist.
// - If the cancel rolls back while the timer is running, the code will
// insure it is only re-scheduled one time.
// > Differs from persistent timers largely depending on database;
// closer to the behavior of using optimistic locking (Oracle).
//
// Concurrent Cancels
// - Neither cancel will be blocked; the timer will not run if
// expiration occurs after either cancel is called.
// - Both transactions will be allowed to commit; the timer will be
// permanently destroyed after the first commit.
// - If one commits, then the other rolls back, the rollback will have
// no effect on the timer; it has been permanently removed.
// - If one rolls back, then the other one commits; the roll back will
// re-schedule the timer, then the commit will remove it again and
// permanently delete it.
// - There is a possibility the timer may run after the first one rolls
// back and the second one commits.
// > Differs from persistent timers largely depending on database;
// closer to the behavior of using optimistic locking (Oracle), where
// both commits are allowed to proceed.
// -----------------------------------------------------------------------
ContainerTx tx = ivContainer.getCurrentContainerTx();
if (tx != null)
{
boolean queuedToStart = (tx.timersQueuedToStart != null) ? tx.timersQueuedToStart.remove(ivTaskId) != null : false;
if (queuedToStart) {
// If this timer was also created in the same transaction, then it
// just needs to be removed from the queue of timers to start, and
// remove called with destroy=true to update state; the cancel
// cannot ever be rolled back.
remove(true);
} else {
// Remove from the active timers map and cancel, but do not permanently
// remove to permit restore on rollback.
remove(false);
if (tx.timersCanceled == null) {
tx.timersCanceled = new LinkedHashMap<String, TimerNpImpl>();
}
tx.timersCanceled.put(ivTaskId, this);
}
}
else
{
// Here for backward compatibility. Could only occur for EJB 1.1
// module with BMT bean, which the customer has re-coded to
// implement TimedObject.
// Remove from the active timers map and cancel permanently (destroy)
remove(true);
}
if (ivTimeoutThread == Thread.currentThread()) {
// clear the firing thread; subsequent attempts to access this timer
// will result in NoSuchObjectLocalException. RTC127173
ivTimeoutThread = null;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "cancel: successful");
} | class class_name[name] begin[{]
method[cancel, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[boolean], isTraceOn]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], binary_operation[literal["cancel: "], +, THIS[]]]]
else begin[{]
None
end[}]
call[.checkTimerAccess, parameter[]]
call[.checkIfCancelled, parameter[]]
local_variable[type[ContainerTx], tx]
if[binary_operation[member[.tx], !=, literal[null]]] begin[{]
local_variable[type[boolean], queuedToStart]
if[member[.queuedToStart]] begin[{]
call[.remove, parameter[literal[true]]]
else begin[{]
call[.remove, parameter[literal[false]]]
if[binary_operation[member[tx.timersCanceled], ==, literal[null]]] begin[{]
assign[member[tx.timersCanceled], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TimerNpImpl, sub_type=None))], dimensions=None, name=LinkedHashMap, sub_type=None))]
else begin[{]
None
end[}]
call[tx.timersCanceled.put, parameter[member[.ivTaskId], THIS[]]]
end[}]
else begin[{]
call[.remove, parameter[literal[true]]]
end[}]
if[binary_operation[member[.ivTimeoutThread], ==, call[Thread.currentThread, parameter[]]]] begin[{]
assign[member[.ivTimeoutThread], literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["cancel: successful"]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[cancel] operator[SEP] operator[SEP] Keyword[throws] identifier[IllegalStateException] , identifier[NoSuchObjectLocalException] , identifier[EJBException] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP] identifier[checkTimerAccess] operator[SEP] operator[SEP] operator[SEP] identifier[checkIfCancelled] operator[SEP] operator[SEP] operator[SEP] identifier[ContainerTx] identifier[tx] operator[=] identifier[ivContainer] operator[SEP] identifier[getCurrentContainerTx] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tx] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] identifier[queuedToStart] operator[=] operator[SEP] identifier[tx] operator[SEP] identifier[timersQueuedToStart] operator[!=] Other[null] operator[SEP] operator[?] identifier[tx] operator[SEP] identifier[timersQueuedToStart] operator[SEP] identifier[remove] operator[SEP] identifier[ivTaskId] operator[SEP] operator[!=] Other[null] operator[:] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[queuedToStart] operator[SEP] {
identifier[remove] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[remove] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tx] operator[SEP] identifier[timersCanceled] operator[==] Other[null] operator[SEP] {
identifier[tx] operator[SEP] identifier[timersCanceled] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[TimerNpImpl] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[tx] operator[SEP] identifier[timersCanceled] operator[SEP] identifier[put] operator[SEP] identifier[ivTaskId] , Keyword[this] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[remove] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ivTimeoutThread] operator[==] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] {
identifier[ivTimeoutThread] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
private static ProcessHandle getCurrentProcess() {
try {
return (ProcessHandle) ProcessHandle.class.getDeclaredMethod("current").invoke(null);
} catch (ReflectiveOperationException ex) {
InternalLogger.log(Level.ERROR, ex, "Failed to receive the handle of the current process");
return null;
}
} | class class_name[name] begin[{]
method[getCurrentProcess, return_type[type[ProcessHandle]], modifier[private static], parameter[]] begin[{]
TryStatement(block=[ReturnStatement(expression=Cast(expression=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="current")], member=getDeclaredMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ProcessHandle, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=ProcessHandle, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to receive the handle of the current process")], member=log, postfix_operators=[], prefix_operators=[], qualifier=InternalLogger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ReflectiveOperationException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[ProcessHandle] identifier[getCurrentProcess] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] operator[SEP] identifier[ProcessHandle] operator[SEP] identifier[ProcessHandle] operator[SEP] Keyword[class] operator[SEP] identifier[getDeclaredMethod] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[invoke] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ReflectiveOperationException] identifier[ex] operator[SEP] {
identifier[InternalLogger] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[ERROR] , identifier[ex] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
protected void onDrawHorizontalScrollBar(Canvas canvas, Drawable scrollBar, int l, int t, int r, int b) {
scrollBar.setColorFilter(tint != null ? tint.getColorForState(getDrawableState(), tint.getDefaultColor()) : Color.WHITE, tintMode);
scrollBar.setBounds(l, t, r, b);
scrollBar.draw(canvas);
} | class class_name[name] begin[{]
method[onDrawHorizontalScrollBar, return_type[void], modifier[protected], parameter[canvas, scrollBar, l, t, r, b]] begin[{]
call[scrollBar.setColorFilter, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=tint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=WHITE, postfix_operators=[], prefix_operators=[], qualifier=Color, selectors=[]), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDrawableState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDefaultColor, postfix_operators=[], prefix_operators=[], qualifier=tint, selectors=[], type_arguments=None)], member=getColorForState, postfix_operators=[], prefix_operators=[], qualifier=tint, selectors=[], type_arguments=None)), member[.tintMode]]]
call[scrollBar.setBounds, parameter[member[.l], member[.t], member[.r], member[.b]]]
call[scrollBar.draw, parameter[member[.canvas]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[onDrawHorizontalScrollBar] operator[SEP] identifier[Canvas] identifier[canvas] , identifier[Drawable] identifier[scrollBar] , Keyword[int] identifier[l] , Keyword[int] identifier[t] , Keyword[int] identifier[r] , Keyword[int] identifier[b] operator[SEP] {
identifier[scrollBar] operator[SEP] identifier[setColorFilter] operator[SEP] identifier[tint] operator[!=] Other[null] operator[?] identifier[tint] operator[SEP] identifier[getColorForState] operator[SEP] identifier[getDrawableState] operator[SEP] operator[SEP] , identifier[tint] operator[SEP] identifier[getDefaultColor] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[Color] operator[SEP] identifier[WHITE] , identifier[tintMode] operator[SEP] operator[SEP] identifier[scrollBar] operator[SEP] identifier[setBounds] operator[SEP] identifier[l] , identifier[t] , identifier[r] , identifier[b] operator[SEP] operator[SEP] identifier[scrollBar] operator[SEP] identifier[draw] operator[SEP] identifier[canvas] operator[SEP] operator[SEP]
}
|
static public String
canonical(String s)
{
if(s != null) {
s = s.trim();
if(s.length() == 0)
s = null;
}
return s;
} | class class_name[name] begin[{]
method[canonical, return_type[type[String]], modifier[public static], parameter[s]] begin[{]
if[binary_operation[member[.s], !=, literal[null]]] begin[{]
assign[member[.s], call[s.trim, parameter[]]]
if[binary_operation[call[s.length, parameter[]], ==, literal[0]]] begin[{]
assign[member[.s], literal[null]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.s]]
end[}]
END[}] | Keyword[static] Keyword[public] identifier[String] identifier[canonical] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[!=] Other[null] operator[SEP] {
identifier[s] operator[=] identifier[s] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[s] operator[=] Other[null] operator[SEP]
}
Keyword[return] identifier[s] operator[SEP]
}
|
public static <T extends ImageGray<T>>
T nv21ToGray( byte[] data , int width , int height ,
T output , Class<T> outputType ) {
if( outputType == GrayU8.class ) {
return (T)nv21ToGray(data,width,height,(GrayU8)output);
} else if( outputType == GrayF32.class ) {
return (T)nv21ToGray(data,width,height,(GrayF32)output);
} else {
throw new IllegalArgumentException("Unsupported BoofCV Image Type "+outputType.getSimpleName());
}
} | class class_name[name] begin[{]
method[nv21ToGray, return_type[type[T]], modifier[public static], parameter[data, width, height, output, outputType]] begin[{]
if[binary_operation[member[.outputType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GrayU8, sub_type=None))]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrayU8, sub_type=None))], member=nv21ToGray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
else begin[{]
if[binary_operation[member[.outputType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GrayF32, sub_type=None))]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrayF32, sub_type=None))], member=nv21ToGray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported BoofCV Image Type "), operandr=MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=outputType, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[ImageGray] operator[<] identifier[T] operator[>] operator[>] identifier[T] identifier[nv21ToGray] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[int] identifier[width] , Keyword[int] identifier[height] , identifier[T] identifier[output] , identifier[Class] operator[<] identifier[T] operator[>] identifier[outputType] operator[SEP] {
Keyword[if] operator[SEP] identifier[outputType] operator[==] identifier[GrayU8] operator[SEP] Keyword[class] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[nv21ToGray] operator[SEP] identifier[data] , identifier[width] , identifier[height] , operator[SEP] identifier[GrayU8] operator[SEP] identifier[output] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[outputType] operator[==] identifier[GrayF32] operator[SEP] Keyword[class] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[nv21ToGray] operator[SEP] identifier[data] , identifier[width] , identifier[height] , operator[SEP] identifier[GrayF32] operator[SEP] identifier[output] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[outputType] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private ScanStatus createNewScanFromExistingScan(String scanId, ScanOptions scanOptions, ScanStatus existingScanStatus) {
List<ScanRangeStatus> pendingScanRangeStatuses = Lists.newArrayList();
Multimap<String, ScanRangeStatus> scanRangeStatusesByPlacement = HashMultimap.create();
for (ScanRangeStatus scanRangeStatus : existingScanStatus.getAllScanRanges()) {
scanRangeStatusesByPlacement.put(scanRangeStatus.getPlacement(),
new ScanRangeStatus(
scanRangeStatus.getTaskId(), scanRangeStatus.getPlacement(), scanRangeStatus.getScanRange(),
scanRangeStatus.getBatchId(), scanRangeStatus.getBlockedByBatchId(), scanRangeStatus.getConcurrencyId()));
}
for (String placement : scanOptions.getPlacements()) {
Collection<ScanRangeStatus> scanRangeStatusesForPlacement = scanRangeStatusesByPlacement.get(placement);
if (scanRangeStatusesForPlacement.isEmpty()) {
throw new IllegalStateException(String.format("Previous scan \"%s\" had no plan for placement \"%s\"", scanId, placement));
}
pendingScanRangeStatuses.addAll(scanRangeStatusesForPlacement);
}
return new ScanStatus(scanId, scanOptions, false, false, new Date(), pendingScanRangeStatuses,
ImmutableList.of(), ImmutableList.of());
} | class class_name[name] begin[{]
method[createNewScanFromExistingScan, return_type[type[ScanStatus]], modifier[private], parameter[scanId, scanOptions, existingScanStatus]] begin[{]
local_variable[type[List], pendingScanRangeStatuses]
local_variable[type[Multimap], scanRangeStatusesByPlacement]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPlacement, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTaskId, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPlacement, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getScanRange, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getBatchId, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getBlockedByBatchId, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getConcurrencyId, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatus, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ScanRangeStatus, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatusesByPlacement, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllScanRanges, postfix_operators=[], prefix_operators=[], qualifier=existingScanStatus, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=scanRangeStatus)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ScanRangeStatus, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=placement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatusesByPlacement, selectors=[], type_arguments=None), name=scanRangeStatusesForPlacement)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ScanRangeStatus, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=scanRangeStatusesForPlacement, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Previous scan \"%s\" had no plan for placement \"%s\""), MemberReference(member=scanId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=placement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=scanRangeStatusesForPlacement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=pendingScanRangeStatuses, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPlacements, postfix_operators=[], prefix_operators=[], qualifier=scanOptions, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=placement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[ClassCreator(arguments=[MemberReference(member=scanId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scanOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None)), MemberReference(member=pendingScanRangeStatuses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableList, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableList, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ScanStatus, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[ScanStatus] identifier[createNewScanFromExistingScan] operator[SEP] identifier[String] identifier[scanId] , identifier[ScanOptions] identifier[scanOptions] , identifier[ScanStatus] identifier[existingScanStatus] operator[SEP] {
identifier[List] operator[<] identifier[ScanRangeStatus] operator[>] identifier[pendingScanRangeStatuses] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[Multimap] operator[<] identifier[String] , identifier[ScanRangeStatus] operator[>] identifier[scanRangeStatusesByPlacement] operator[=] identifier[HashMultimap] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ScanRangeStatus] identifier[scanRangeStatus] operator[:] identifier[existingScanStatus] operator[SEP] identifier[getAllScanRanges] operator[SEP] operator[SEP] operator[SEP] {
identifier[scanRangeStatusesByPlacement] operator[SEP] identifier[put] operator[SEP] identifier[scanRangeStatus] operator[SEP] identifier[getPlacement] operator[SEP] operator[SEP] , Keyword[new] identifier[ScanRangeStatus] operator[SEP] identifier[scanRangeStatus] operator[SEP] identifier[getTaskId] operator[SEP] operator[SEP] , identifier[scanRangeStatus] operator[SEP] identifier[getPlacement] operator[SEP] operator[SEP] , identifier[scanRangeStatus] operator[SEP] identifier[getScanRange] operator[SEP] operator[SEP] , identifier[scanRangeStatus] operator[SEP] identifier[getBatchId] operator[SEP] operator[SEP] , identifier[scanRangeStatus] operator[SEP] identifier[getBlockedByBatchId] operator[SEP] operator[SEP] , identifier[scanRangeStatus] operator[SEP] identifier[getConcurrencyId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[placement] operator[:] identifier[scanOptions] operator[SEP] identifier[getPlacements] operator[SEP] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[ScanRangeStatus] operator[>] identifier[scanRangeStatusesForPlacement] operator[=] identifier[scanRangeStatusesByPlacement] operator[SEP] identifier[get] operator[SEP] identifier[placement] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scanRangeStatusesForPlacement] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[scanId] , identifier[placement] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pendingScanRangeStatuses] operator[SEP] identifier[addAll] operator[SEP] identifier[scanRangeStatusesForPlacement] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ScanStatus] operator[SEP] identifier[scanId] , identifier[scanOptions] , literal[boolean] , literal[boolean] , Keyword[new] identifier[Date] operator[SEP] operator[SEP] , identifier[pendingScanRangeStatuses] , identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] operator[SEP] , identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void createKeyPair(int length, String identity, char[] password, OutputStream privateKeyStream,
OutputStream
publicKeyStream) throws Exception {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(ALGORITHM, PROVIDER);
SecureRandom random = SecureRandom.getInstanceStrong();
keyPairGenerator.initialize(length, random);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
PGPPublicKey publicKey = new JcaPGPKeyConverter().getPGPPublicKey(PGPPublicKey.RSA_GENERAL, keyPair
.getPublic(), new Date());
RSAPrivateCrtKey privateCrtKey = (RSAPrivateCrtKey) keyPair.getPrivate();
RSASecretBCPGKey secretBCPGKey = new RSASecretBCPGKey(privateCrtKey.getPrivateExponent(), privateCrtKey
.getPrimeP(), privateCrtKey.getPrimeQ());
PGPPrivateKey privateKey = new PGPPrivateKey(publicKey.getKeyID(), publicKey.getPublicKeyPacket(),
secretBCPGKey);
PGPKeyPair pgpKeyPair = new PGPKeyPair(publicKey, privateKey);
PGPDigestCalculator calculator = new JcaPGPDigestCalculatorProviderBuilder().build().get
(HashAlgorithmTags.SHA1);
PGPSecretKey secretKey = new PGPSecretKey(PGPSignature.DEFAULT_CERTIFICATION, pgpKeyPair, identity,
calculator, null, null, new JcaPGPContentSignerBuilder(pgpKeyPair.getPublicKey().getAlgorithm(),
HashAlgorithmTags.SHA1), new JcePBESecretKeyEncryptorBuilder(PGPEncryptedData.CAST5, calculator)
.setProvider(PROVIDER).build(password));
try(ArmoredOutputStream privateArm = new ArmoredOutputStream(privateKeyStream);
ArmoredOutputStream publicArm = new ArmoredOutputStream(publicKeyStream)) {
secretKey.encode(privateArm);
secretKey.getPublicKey().encode(publicArm);
}
} | class class_name[name] begin[{]
method[createKeyPair, return_type[void], modifier[public static], parameter[length, identity, password, privateKeyStream, publicKeyStream]] begin[{]
local_variable[type[KeyPairGenerator], keyPairGenerator]
local_variable[type[SecureRandom], random]
call[keyPairGenerator.initialize, parameter[member[.length], member[.random]]]
local_variable[type[KeyPair], keyPair]
local_variable[type[PGPPublicKey], publicKey]
local_variable[type[RSAPrivateCrtKey], privateCrtKey]
local_variable[type[RSASecretBCPGKey], secretBCPGKey]
local_variable[type[PGPPrivateKey], privateKey]
local_variable[type[PGPKeyPair], pgpKeyPair]
local_variable[type[PGPDigestCalculator], calculator]
local_variable[type[PGPSecretKey], secretKey]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=privateArm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=secretKey, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getPublicKey, postfix_operators=[], prefix_operators=[], qualifier=secretKey, selectors=[MethodInvocation(arguments=[MemberReference(member=publicArm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=privateArm, type=ReferenceType(arguments=None, dimensions=[], name=ArmoredOutputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=privateKeyStream, 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=ArmoredOutputStream, sub_type=None))), TryResource(annotations=[], modifiers=set(), name=publicArm, type=ReferenceType(arguments=None, dimensions=[], name=ArmoredOutputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=publicKeyStream, 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=ArmoredOutputStream, sub_type=None)))])
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[createKeyPair] operator[SEP] Keyword[int] identifier[length] , identifier[String] identifier[identity] , Keyword[char] operator[SEP] operator[SEP] identifier[password] , identifier[OutputStream] identifier[privateKeyStream] , identifier[OutputStream] identifier[publicKeyStream] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[KeyPairGenerator] identifier[keyPairGenerator] operator[=] identifier[KeyPairGenerator] operator[SEP] identifier[getInstance] operator[SEP] identifier[ALGORITHM] , identifier[PROVIDER] operator[SEP] operator[SEP] identifier[SecureRandom] identifier[random] operator[=] identifier[SecureRandom] operator[SEP] identifier[getInstanceStrong] operator[SEP] operator[SEP] operator[SEP] identifier[keyPairGenerator] operator[SEP] identifier[initialize] operator[SEP] identifier[length] , identifier[random] operator[SEP] operator[SEP] identifier[KeyPair] identifier[keyPair] operator[=] identifier[keyPairGenerator] operator[SEP] identifier[generateKeyPair] operator[SEP] operator[SEP] operator[SEP] identifier[PGPPublicKey] identifier[publicKey] operator[=] Keyword[new] identifier[JcaPGPKeyConverter] operator[SEP] operator[SEP] operator[SEP] identifier[getPGPPublicKey] operator[SEP] identifier[PGPPublicKey] operator[SEP] identifier[RSA_GENERAL] , identifier[keyPair] operator[SEP] identifier[getPublic] operator[SEP] operator[SEP] , Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[RSAPrivateCrtKey] identifier[privateCrtKey] operator[=] operator[SEP] identifier[RSAPrivateCrtKey] operator[SEP] identifier[keyPair] operator[SEP] identifier[getPrivate] operator[SEP] operator[SEP] operator[SEP] identifier[RSASecretBCPGKey] identifier[secretBCPGKey] operator[=] Keyword[new] identifier[RSASecretBCPGKey] operator[SEP] identifier[privateCrtKey] operator[SEP] identifier[getPrivateExponent] operator[SEP] operator[SEP] , identifier[privateCrtKey] operator[SEP] identifier[getPrimeP] operator[SEP] operator[SEP] , identifier[privateCrtKey] operator[SEP] identifier[getPrimeQ] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PGPPrivateKey] identifier[privateKey] operator[=] Keyword[new] identifier[PGPPrivateKey] operator[SEP] identifier[publicKey] operator[SEP] identifier[getKeyID] operator[SEP] operator[SEP] , identifier[publicKey] operator[SEP] identifier[getPublicKeyPacket] operator[SEP] operator[SEP] , identifier[secretBCPGKey] operator[SEP] operator[SEP] identifier[PGPKeyPair] identifier[pgpKeyPair] operator[=] Keyword[new] identifier[PGPKeyPair] operator[SEP] identifier[publicKey] , identifier[privateKey] operator[SEP] operator[SEP] identifier[PGPDigestCalculator] identifier[calculator] operator[=] Keyword[new] identifier[JcaPGPDigestCalculatorProviderBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HashAlgorithmTags] operator[SEP] identifier[SHA1] operator[SEP] operator[SEP] identifier[PGPSecretKey] identifier[secretKey] operator[=] Keyword[new] identifier[PGPSecretKey] operator[SEP] identifier[PGPSignature] operator[SEP] identifier[DEFAULT_CERTIFICATION] , identifier[pgpKeyPair] , identifier[identity] , identifier[calculator] , Other[null] , Other[null] , Keyword[new] identifier[JcaPGPContentSignerBuilder] operator[SEP] identifier[pgpKeyPair] operator[SEP] identifier[getPublicKey] operator[SEP] operator[SEP] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] , identifier[HashAlgorithmTags] operator[SEP] identifier[SHA1] operator[SEP] , Keyword[new] identifier[JcePBESecretKeyEncryptorBuilder] operator[SEP] identifier[PGPEncryptedData] operator[SEP] identifier[CAST5] , identifier[calculator] operator[SEP] operator[SEP] identifier[setProvider] operator[SEP] identifier[PROVIDER] operator[SEP] operator[SEP] identifier[build] operator[SEP] identifier[password] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[ArmoredOutputStream] identifier[privateArm] operator[=] Keyword[new] identifier[ArmoredOutputStream] operator[SEP] identifier[privateKeyStream] operator[SEP] operator[SEP] identifier[ArmoredOutputStream] identifier[publicArm] operator[=] Keyword[new] identifier[ArmoredOutputStream] operator[SEP] identifier[publicKeyStream] operator[SEP] operator[SEP] {
identifier[secretKey] operator[SEP] identifier[encode] operator[SEP] identifier[privateArm] operator[SEP] operator[SEP] identifier[secretKey] operator[SEP] identifier[getPublicKey] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[publicArm] operator[SEP] operator[SEP]
}
}
|
@PutAction("{model}")
public void update(@DbBind MODEL_TYPE model, MODEL_TYPE data) {
$.merge(data).filter("-id").to(model);
dao.save(model);
} | class class_name[name] begin[{]
method[update, return_type[void], modifier[public], parameter[model, data]] begin[{]
call[$.merge, parameter[member[.data]]]
call[dao.save, parameter[member[.model]]]
end[}]
END[}] | annotation[@] identifier[PutAction] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[update] operator[SEP] annotation[@] identifier[DbBind] identifier[MODEL_TYPE] identifier[model] , identifier[MODEL_TYPE] identifier[data] operator[SEP] {
identifier[$] operator[SEP] identifier[merge] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[filter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[dao] operator[SEP] identifier[save] operator[SEP] identifier[model] operator[SEP] operator[SEP]
}
|
public static boolean check(Tile tile1, Tile tile2, Tile tile3, Tile tile4) {
return tile1 == tile2 && tile2 == tile3 && tile3 == tile4;
} | class class_name[name] begin[{]
method[check, return_type[type[boolean]], modifier[public static], parameter[tile1, tile2, tile3, tile4]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.tile1], ==, member[.tile2]], &&, binary_operation[member[.tile2], ==, member[.tile3]]], &&, binary_operation[member[.tile3], ==, member[.tile4]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[check] operator[SEP] identifier[Tile] identifier[tile1] , identifier[Tile] identifier[tile2] , identifier[Tile] identifier[tile3] , identifier[Tile] identifier[tile4] operator[SEP] {
Keyword[return] identifier[tile1] operator[==] identifier[tile2] operator[&&] identifier[tile2] operator[==] identifier[tile3] operator[&&] identifier[tile3] operator[==] identifier[tile4] operator[SEP]
}
|
private <T extends IEntity> IntuitMessage prepareQuery(String query) throws FMSException {
IntuitMessage intuitMessage = new IntuitMessage();
RequestElements requestElements = intuitMessage.getRequestElements();
//set the request params
Map<String, String> requestParameters = requestElements.getRequestParameters();
if (query.length() > LENGTH_200) {
requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.POST.toString());
requestElements.setPostString(query);
} else {
requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.GET.toString());
requestParameters.put(RequestElements.REQ_PARAM_QUERY, query);
}
requestElements.setAction(OperationType.QUERY.toString());
requestElements.setContext(context);
return intuitMessage;
} | class class_name[name] begin[{]
method[prepareQuery, return_type[type[IntuitMessage]], modifier[private], parameter[query]] begin[{]
local_variable[type[IntuitMessage], intuitMessage]
local_variable[type[RequestElements], requestElements]
local_variable[type[Map], requestParameters]
if[binary_operation[call[query.length, parameter[]], >, member[.LENGTH_200]]] begin[{]
call[requestParameters.put, parameter[member[RequestElements.REQ_PARAM_METHOD_TYPE], call[MethodType.POST.toString, parameter[]]]]
call[requestElements.setPostString, parameter[member[.query]]]
else begin[{]
call[requestParameters.put, parameter[member[RequestElements.REQ_PARAM_METHOD_TYPE], call[MethodType.GET.toString, parameter[]]]]
call[requestParameters.put, parameter[member[RequestElements.REQ_PARAM_QUERY], member[.query]]]
end[}]
call[requestElements.setAction, parameter[call[OperationType.QUERY.toString, parameter[]]]]
call[requestElements.setContext, parameter[member[.context]]]
return[member[.intuitMessage]]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] Keyword[extends] identifier[IEntity] operator[>] identifier[IntuitMessage] identifier[prepareQuery] operator[SEP] identifier[String] identifier[query] operator[SEP] Keyword[throws] identifier[FMSException] {
identifier[IntuitMessage] identifier[intuitMessage] operator[=] Keyword[new] identifier[IntuitMessage] operator[SEP] operator[SEP] operator[SEP] identifier[RequestElements] identifier[requestElements] operator[=] identifier[intuitMessage] operator[SEP] identifier[getRequestElements] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[requestParameters] operator[=] identifier[requestElements] operator[SEP] identifier[getRequestParameters] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[query] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] identifier[LENGTH_200] operator[SEP] {
identifier[requestParameters] operator[SEP] identifier[put] operator[SEP] identifier[RequestElements] operator[SEP] identifier[REQ_PARAM_METHOD_TYPE] , identifier[MethodType] operator[SEP] identifier[POST] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestElements] operator[SEP] identifier[setPostString] operator[SEP] identifier[query] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[requestParameters] operator[SEP] identifier[put] operator[SEP] identifier[RequestElements] operator[SEP] identifier[REQ_PARAM_METHOD_TYPE] , identifier[MethodType] operator[SEP] identifier[GET] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestParameters] operator[SEP] identifier[put] operator[SEP] identifier[RequestElements] operator[SEP] identifier[REQ_PARAM_QUERY] , identifier[query] operator[SEP] operator[SEP]
}
identifier[requestElements] operator[SEP] identifier[setAction] operator[SEP] identifier[OperationType] operator[SEP] identifier[QUERY] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestElements] operator[SEP] identifier[setContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[return] identifier[intuitMessage] operator[SEP]
}
|
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) {
switch (hexDigit) {
case '0':
return new boolean[] { false, false, false, false };
case '1':
return new boolean[] { false, false, false, true };
case '2':
return new boolean[] { false, false, true, false };
case '3':
return new boolean[] { false, false, true, true };
case '4':
return new boolean[] { false, true, false, false };
case '5':
return new boolean[] { false, true, false, true };
case '6':
return new boolean[] { false, true, true, false };
case '7':
return new boolean[] { false, true, true, true };
case '8':
return new boolean[] { true, false, false, false };
case '9':
return new boolean[] { true, false, false, true };
case 'a':// fall through
case 'A':
return new boolean[] { true, false, true, false };
case 'b':// fall through
case 'B':
return new boolean[] { true, false, true, true };
case 'c':// fall through
case 'C':
return new boolean[] { true, true, false, false };
case 'd':// fall through
case 'D':
return new boolean[] { true, true, false, true };
case 'e':// fall through
case 'E':
return new boolean[] { true, true, true, false };
case 'f':// fall through
case 'F':
return new boolean[] { true, true, true, true };
default:
throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit");
}
} | class class_name[name] begin[{]
method[hexDigitMsb0ToBinary, return_type[type[boolean]], modifier[public static], parameter[hexDigit]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='1')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='2')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='3')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='4')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='5')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='6')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='8')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='a'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='A')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='b'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='B')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='c'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='C')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='d'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='D')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='e'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='E')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='f'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='F')], statements=[ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot interpret '"), operandr=MemberReference(member=hexDigit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' as a hexadecimal digit"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=hexDigit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] operator[SEP] operator[SEP] identifier[hexDigitMsb0ToBinary] operator[SEP] Keyword[final] Keyword[char] identifier[hexDigit] operator[SEP] {
Keyword[switch] operator[SEP] identifier[hexDigit] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] Keyword[new] Keyword[boolean] operator[SEP] operator[SEP] {
literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean]
} operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[hexDigit] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
protected Html unmarshal(StringBuilder sb) throws JAXBException {
Html html = null;
sb = replaceIframeEndTag(sb);
sb = removeDoctypeDeclaration(sb);
sb = replaceNamedEntity(sb);
StringReader stringReader = new StringReader(sb.toString());
html = (Html) jaxbContext.createUnmarshaller().unmarshal(stringReader);
return html;
} | class class_name[name] begin[{]
method[unmarshal, return_type[type[Html]], modifier[protected], parameter[sb]] begin[{]
local_variable[type[Html], html]
assign[member[.sb], call[.replaceIframeEndTag, parameter[member[.sb]]]]
assign[member[.sb], call[.removeDoctypeDeclaration, parameter[member[.sb]]]]
assign[member[.sb], call[.replaceNamedEntity, parameter[member[.sb]]]]
local_variable[type[StringReader], stringReader]
assign[member[.html], Cast(expression=MethodInvocation(arguments=[], member=createUnmarshaller, postfix_operators=[], prefix_operators=[], qualifier=jaxbContext, selectors=[MethodInvocation(arguments=[MemberReference(member=stringReader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmarshal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Html, sub_type=None))]
return[member[.html]]
end[}]
END[}] | Keyword[protected] identifier[Html] identifier[unmarshal] operator[SEP] identifier[StringBuilder] identifier[sb] operator[SEP] Keyword[throws] identifier[JAXBException] {
identifier[Html] identifier[html] operator[=] Other[null] operator[SEP] identifier[sb] operator[=] identifier[replaceIframeEndTag] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[sb] operator[=] identifier[removeDoctypeDeclaration] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[sb] operator[=] identifier[replaceNamedEntity] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[StringReader] identifier[stringReader] operator[=] Keyword[new] identifier[StringReader] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[=] operator[SEP] identifier[Html] operator[SEP] identifier[jaxbContext] operator[SEP] identifier[createUnmarshaller] operator[SEP] operator[SEP] operator[SEP] identifier[unmarshal] operator[SEP] identifier[stringReader] operator[SEP] operator[SEP] Keyword[return] identifier[html] operator[SEP]
}
|
public static Image newImage(final String id, final IResource imageResource)
{
final Image image = new Image(id, imageResource);
image.setOutputMarkupId(true);
return image;
} | class class_name[name] begin[{]
method[newImage, return_type[type[Image]], modifier[public static], parameter[id, imageResource]] begin[{]
local_variable[type[Image], image]
call[image.setOutputMarkupId, parameter[literal[true]]]
return[member[.image]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Image] identifier[newImage] operator[SEP] Keyword[final] identifier[String] identifier[id] , Keyword[final] identifier[IResource] identifier[imageResource] operator[SEP] {
Keyword[final] identifier[Image] identifier[image] operator[=] Keyword[new] identifier[Image] operator[SEP] identifier[id] , identifier[imageResource] operator[SEP] operator[SEP] identifier[image] operator[SEP] identifier[setOutputMarkupId] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[image] operator[SEP]
}
|
protected boolean isCurrentDateTimeFunction(String string, Database database) {
return string.toLowerCase(Locale.US).startsWith("current_timestamp")
|| string.toLowerCase(Locale.US).startsWith(DatabaseFunction.CURRENT_DATE_TIME_PLACE_HOLDER)
|| database.getCurrentDateTimeFunction().toLowerCase(Locale.US).equals(string.toLowerCase(Locale.US));
} | class class_name[name] begin[{]
method[isCurrentDateTimeFunction, return_type[type[boolean]], modifier[protected], parameter[string, database]] begin[{]
return[binary_operation[binary_operation[call[string.toLowerCase, parameter[member[Locale.US]]], ||, call[string.toLowerCase, parameter[member[Locale.US]]]], ||, call[database.getCurrentDateTimeFunction, parameter[]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isCurrentDateTimeFunction] operator[SEP] identifier[String] identifier[string] , identifier[Database] identifier[database] operator[SEP] {
Keyword[return] identifier[string] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[US] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[string] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[US] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[DatabaseFunction] operator[SEP] identifier[CURRENT_DATE_TIME_PLACE_HOLDER] operator[SEP] operator[||] identifier[database] operator[SEP] identifier[getCurrentDateTimeFunction] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[US] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[string] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[US] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getIgnoreEMail(String serverName) {
if (serverName != null) {
return ignoreEMails.get(serverName);
} else {
return null;
}
} | class class_name[name] begin[{]
method[getIgnoreEMail, return_type[type[String]], modifier[public], parameter[serverName]] begin[{]
if[binary_operation[member[.serverName], !=, literal[null]]] begin[{]
return[call[ignoreEMails.get, parameter[member[.serverName]]]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getIgnoreEMail] operator[SEP] identifier[String] identifier[serverName] operator[SEP] {
Keyword[if] operator[SEP] identifier[serverName] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[ignoreEMails] operator[SEP] identifier[get] operator[SEP] identifier[serverName] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public Router<T> addRoute(HttpMethod method, String pathPattern, T target) {
getMethodlessRouter(method).addRoute(pathPattern, target);
return this;
} | class class_name[name] begin[{]
method[addRoute, return_type[type[Router]], modifier[public], parameter[method, pathPattern, target]] begin[{]
call[.getMethodlessRouter, parameter[member[.method]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Router] operator[<] identifier[T] operator[>] identifier[addRoute] operator[SEP] identifier[HttpMethod] identifier[method] , identifier[String] identifier[pathPattern] , identifier[T] identifier[target] operator[SEP] {
identifier[getMethodlessRouter] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[addRoute] operator[SEP] identifier[pathPattern] , identifier[target] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public JvmTypeReference typeRef(Class<?> clazz, JvmTypeReference... typeArgs) {
JvmType type = references.findDeclaredType(clazz, context);
if (type == null) {
return createUnknownTypeReference(clazz.getName());
}
return typeRef(type, typeArgs);
} | class class_name[name] begin[{]
method[typeRef, return_type[type[JvmTypeReference]], modifier[public], parameter[clazz, typeArgs]] begin[{]
local_variable[type[JvmType], type]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
return[call[.createUnknownTypeReference, parameter[call[clazz.getName, parameter[]]]]]
else begin[{]
None
end[}]
return[call[.typeRef, parameter[member[.type], member[.typeArgs]]]]
end[}]
END[}] | Keyword[public] identifier[JvmTypeReference] identifier[typeRef] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[JvmTypeReference] operator[...] identifier[typeArgs] operator[SEP] {
identifier[JvmType] identifier[type] operator[=] identifier[references] operator[SEP] identifier[findDeclaredType] operator[SEP] identifier[clazz] , identifier[context] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[createUnknownTypeReference] operator[SEP] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[typeRef] operator[SEP] identifier[type] , identifier[typeArgs] operator[SEP] operator[SEP]
}
|
public static <T> T getFirst(T[] array, T defaultValue) {
return getElementAt(array, 0, defaultValue);
} | class class_name[name] begin[{]
method[getFirst, return_type[type[T]], modifier[public static], parameter[array, defaultValue]] begin[{]
return[call[.getElementAt, parameter[member[.array], literal[0], member[.defaultValue]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[getFirst] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[array] , identifier[T] identifier[defaultValue] operator[SEP] {
Keyword[return] identifier[getElementAt] operator[SEP] identifier[array] , Other[0] , identifier[defaultValue] operator[SEP] operator[SEP]
}
|
public Writer getWriter(String encoding)
throws IOException
{
if (encoding==null ||
StringUtil.__ISO_8859_1.equalsIgnoreCase(encoding) ||
"ISO8859_1".equalsIgnoreCase(encoding))
return getISO8859Writer();
if ("UTF-8".equalsIgnoreCase(encoding) ||
"UTF8".equalsIgnoreCase(encoding))
return getUTF8Writer();
if ("US-ASCII".equalsIgnoreCase(encoding))
return getASCIIWriter();
return new OutputStreamWriter(this,encoding);
} | class class_name[name] begin[{]
method[getWriter, return_type[type[Writer]], modifier[public], parameter[encoding]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.encoding], ==, literal[null]], ||, call[StringUtil.__ISO_8859_1.equalsIgnoreCase, parameter[member[.encoding]]]], ||, literal["ISO8859_1"]]] begin[{]
return[call[.getISO8859Writer, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[literal["UTF-8"], ||, literal["UTF8"]]] begin[{]
return[call[.getUTF8Writer, parameter[]]]
else begin[{]
None
end[}]
if[literal["US-ASCII"]] begin[{]
return[call[.getASCIIWriter, parameter[]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=encoding, 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=OutputStreamWriter, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Writer] identifier[getWriter] operator[SEP] identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[encoding] operator[==] Other[null] operator[||] identifier[StringUtil] operator[SEP] identifier[__ISO_8859_1] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] Keyword[return] identifier[getISO8859Writer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] Keyword[return] identifier[getUTF8Writer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] Keyword[return] identifier[getASCIIWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[OutputStreamWriter] operator[SEP] Keyword[this] , identifier[encoding] operator[SEP] operator[SEP]
}
|
public void setBiolexicon_id(String v) {
if (POSVerb_Type.featOkTst && ((POSVerb_Type)jcasType).casFeat_biolexicon_id == null)
jcasType.jcas.throwFeatMissing("biolexicon_id", "ch.epfl.bbp.uima.types.POSVerb");
jcasType.ll_cas.ll_setStringValue(addr, ((POSVerb_Type)jcasType).casFeatCode_biolexicon_id, v);} | class class_name[name] begin[{]
method[setBiolexicon_id, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[POSVerb_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=POSVerb_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["biolexicon_id"], literal["ch.epfl.bbp.uima.types.POSVerb"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=POSVerb_Type, sub_type=None)), member[.v]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBiolexicon_id] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[POSVerb_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[POSVerb_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_biolexicon_id] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[POSVerb_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_biolexicon_id] , identifier[v] operator[SEP] operator[SEP]
}
|
private void configureHandlers() {
Handlers actualHandlers = new Handlers();
actualHandlers.setHandlers(new ArrayList<Handler>());
if (this.handlers.isEmpty()) {
for (Class<? extends SAML2Handler> commonHandlerClass : getDefaultHandlers()) {
addHandler(commonHandlerClass, actualHandlers);
}
} else {
for (Handler handler : this.handlers) {
actualHandlers.add(handler);
}
}
getPicketLinkType().setHandlers(actualHandlers);
} | class class_name[name] begin[{]
method[configureHandlers, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[Handlers], actualHandlers]
call[actualHandlers.setHandlers, parameter[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=Handler, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
if[THIS[member[None.handlers]call[None.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=commonHandlerClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=actualHandlers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDefaultHandlers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=commonHandlerClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=SAML2Handler, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=actualHandlers, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=handlers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Handler, sub_type=None))), label=None)
end[}]
call[.getPicketLinkType, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[configureHandlers] operator[SEP] operator[SEP] {
identifier[Handlers] identifier[actualHandlers] operator[=] Keyword[new] identifier[Handlers] operator[SEP] operator[SEP] operator[SEP] identifier[actualHandlers] operator[SEP] identifier[setHandlers] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[Handler] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[handlers] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[SAML2Handler] operator[>] identifier[commonHandlerClass] operator[:] identifier[getDefaultHandlers] operator[SEP] operator[SEP] operator[SEP] {
identifier[addHandler] operator[SEP] identifier[commonHandlerClass] , identifier[actualHandlers] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[Handler] identifier[handler] operator[:] Keyword[this] operator[SEP] identifier[handlers] operator[SEP] {
identifier[actualHandlers] operator[SEP] identifier[add] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
}
identifier[getPicketLinkType] operator[SEP] operator[SEP] operator[SEP] identifier[setHandlers] operator[SEP] identifier[actualHandlers] operator[SEP] operator[SEP]
}
|
public static void setInstance(final RuntimeDelegate delegate) {
SecurityManager security = getSecurityManager();
if (security != null) {
security.checkPermission(SUPPRESS_ACCESS_CHECKS_PERMISSION);
}
synchronized(RuntimeDelegate.CACHED_DELEGATE) {
RuntimeDelegate.CACHED_DELEGATE.set(delegate);
}
} | class class_name[name] begin[{]
method[setInstance, return_type[void], modifier[public static], parameter[delegate]] begin[{]
local_variable[type[SecurityManager], security]
if[binary_operation[member[.security], !=, literal[null]]] begin[{]
call[security.checkPermission, parameter[member[.SUPPRESS_ACCESS_CHECKS_PERMISSION]]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[RuntimeDelegate.CACHED_DELEGATE]] BEGIN[{]
call[RuntimeDelegate.CACHED_DELEGATE.set, parameter[member[.delegate]]]
END[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setInstance] operator[SEP] Keyword[final] identifier[RuntimeDelegate] identifier[delegate] operator[SEP] {
identifier[SecurityManager] identifier[security] operator[=] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[security] operator[!=] Other[null] operator[SEP] {
identifier[security] operator[SEP] identifier[checkPermission] operator[SEP] identifier[SUPPRESS_ACCESS_CHECKS_PERMISSION] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[RuntimeDelegate] operator[SEP] identifier[CACHED_DELEGATE] operator[SEP] {
identifier[RuntimeDelegate] operator[SEP] identifier[CACHED_DELEGATE] operator[SEP] identifier[set] operator[SEP] identifier[delegate] operator[SEP] operator[SEP]
}
}
|
private static CharSequence reverse(CharSequence s) {
int length = s.length();
if (length <= 1) {
return s;
}
char[] buffer = new char[length];
buffer[0] = s.charAt(length - 1);
for (int i = 1; i < length; i++) {
buffer[i] = s.charAt(length - 1 - i);
if (Character.isSurrogatePair(buffer[i], buffer[i - 1])) {
swap(buffer, i - 1, i);
}
}
return new String(buffer);
} | class class_name[name] begin[{]
method[reverse, return_type[type[CharSequence]], modifier[private static], parameter[s]] begin[{]
local_variable[type[int], length]
if[binary_operation[member[.length], <=, literal[1]]] begin[{]
return[member[.s]]
else begin[{]
None
end[}]
local_variable[type[char], buffer]
assign[member[.buffer], call[s.charAt, parameter[binary_operation[member[.length], -, literal[1]]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))])], member=isSurrogatePair, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=swap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=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=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[CharSequence] identifier[reverse] operator[SEP] identifier[CharSequence] identifier[s] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[<=] Other[1] operator[SEP] {
Keyword[return] identifier[s] operator[SEP]
}
Keyword[char] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] Other[0] operator[SEP] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[buffer] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[length] operator[-] Other[1] operator[-] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Character] operator[SEP] identifier[isSurrogatePair] operator[SEP] identifier[buffer] operator[SEP] identifier[i] operator[SEP] , identifier[buffer] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[swap] operator[SEP] identifier[buffer] , identifier[i] operator[-] Other[1] , identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[buffer] operator[SEP] operator[SEP]
}
|
private double normPDF(double x) {
return Math.exp(-x*x / 2) / (Math.sqrt(2 * Math.PI));
} | class class_name[name] begin[{]
method[normPDF, return_type[type[double]], modifier[private], parameter[x]] begin[{]
return[binary_operation[call[Math.exp, parameter[binary_operation[binary_operation[member[.x], *, member[.x]], /, literal[2]]]], /, call[Math.sqrt, parameter[binary_operation[literal[2], *, member[Math.PI]]]]]]
end[}]
END[}] | Keyword[private] Keyword[double] identifier[normPDF] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] identifier[Math] operator[SEP] identifier[exp] operator[SEP] operator[-] identifier[x] operator[*] identifier[x] operator[/] Other[2] operator[SEP] operator[/] operator[SEP] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] Other[2] operator[*] identifier[Math] operator[SEP] identifier[PI] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
public static String normalize(String src,Mode mode) {
return normalize(src, mode, 0);
} | class class_name[name] begin[{]
method[normalize, return_type[type[String]], modifier[public static], parameter[src, mode]] begin[{]
return[call[.normalize, parameter[member[.src], member[.mode], literal[0]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[String] identifier[normalize] operator[SEP] identifier[String] identifier[src] , identifier[Mode] identifier[mode] operator[SEP] {
Keyword[return] identifier[normalize] operator[SEP] identifier[src] , identifier[mode] , Other[0] operator[SEP] operator[SEP]
}
|
@Override
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
{
checkParameterBounds(parameterIndex);
throw SQLError.noSupport();
} | class class_name[name] begin[{]
method[setBlob, return_type[void], modifier[public], parameter[parameterIndex, inputStream]] begin[{]
call[.checkParameterBounds, parameter[member[.parameterIndex]]]
ThrowStatement(expression=MethodInvocation(arguments=[], member=noSupport, postfix_operators=[], prefix_operators=[], qualifier=SQLError, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setBlob] operator[SEP] Keyword[int] identifier[parameterIndex] , identifier[InputStream] identifier[inputStream] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkParameterBounds] operator[SEP] identifier[parameterIndex] operator[SEP] operator[SEP] Keyword[throw] identifier[SQLError] operator[SEP] identifier[noSupport] operator[SEP] operator[SEP] operator[SEP]
}
|
public static DataSource createDataSource(String source){
String typeAndConfig = configuration.getProperty(source);
if (typeAndConfig == null){
log.error("No configuration for data source: " + source);
return null;
}
String[] typeAndConfigArray = typeAndConfig.split(DELIMITORS, 2);
if (typeAndConfigArray.length < 2){
log.error("Wrong configuration format for data source '" + source + "': " + typeAndConfig);
return null;
}
String type = typeAndConfigArray[0];
String config = typeAndConfigArray[1];
return createDataSource(source, type, config);
} | class class_name[name] begin[{]
method[createDataSource, return_type[type[DataSource]], modifier[public static], parameter[source]] begin[{]
local_variable[type[String], typeAndConfig]
if[binary_operation[member[.typeAndConfig], ==, literal[null]]] begin[{]
call[log.error, parameter[binary_operation[literal["No configuration for data source: "], +, member[.source]]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], typeAndConfigArray]
if[binary_operation[member[typeAndConfigArray.length], <, literal[2]]] begin[{]
call[log.error, parameter[binary_operation[binary_operation[binary_operation[literal["Wrong configuration format for data source '"], +, member[.source]], +, literal["': "]], +, member[.typeAndConfig]]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], type]
local_variable[type[String], config]
return[call[.createDataSource, parameter[member[.source], member[.type], member[.config]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DataSource] identifier[createDataSource] operator[SEP] identifier[String] identifier[source] operator[SEP] {
identifier[String] identifier[typeAndConfig] operator[=] identifier[configuration] operator[SEP] identifier[getProperty] operator[SEP] identifier[source] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeAndConfig] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[source] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[typeAndConfigArray] operator[=] identifier[typeAndConfig] operator[SEP] identifier[split] operator[SEP] identifier[DELIMITORS] , Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeAndConfigArray] operator[SEP] identifier[length] operator[<] Other[2] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[source] operator[+] literal[String] operator[+] identifier[typeAndConfig] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[type] operator[=] identifier[typeAndConfigArray] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[config] operator[=] identifier[typeAndConfigArray] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[createDataSource] operator[SEP] identifier[source] , identifier[type] , identifier[config] operator[SEP] operator[SEP]
}
|
public int loadGlyphs (List glyphs, int maxGlyphsToLoad) throws SlickException {
if (rowHeight != 0 && maxGlyphsToLoad == -1) {
// If this page has glyphs and we are not loading incrementally, return zero if any of the glyphs don't fit.
int testX = pageX;
int testY = pageY;
int testRowHeight = rowHeight;
for (Iterator iter = getIterator(glyphs); iter.hasNext();) {
Glyph glyph = (Glyph)iter.next();
int width = glyph.getWidth();
int height = glyph.getHeight();
if (testX + width >= pageWidth) {
testX = 0;
testY += testRowHeight;
testRowHeight = height;
} else if (height > testRowHeight) {
testRowHeight = height;
}
if (testY + testRowHeight >= pageWidth) return 0;
testX += width;
}
}
Color.white.bind();
pageImage.bind();
int i = 0;
for (Iterator iter = getIterator(glyphs); iter.hasNext();) {
Glyph glyph = (Glyph)iter.next();
int width = Math.min(MAX_GLYPH_SIZE, glyph.getWidth());
int height = Math.min(MAX_GLYPH_SIZE, glyph.getHeight());
if (rowHeight == 0) {
// The first glyph always fits.
rowHeight = height;
} else {
// Wrap to the next line if needed, or break if no more fit.
if (pageX + width >= pageWidth) {
if (pageY + rowHeight + height >= pageHeight) break;
pageX = 0;
pageY += rowHeight;
rowHeight = height;
} else if (height > rowHeight) {
if (pageY + height >= pageHeight) break;
rowHeight = height;
}
}
renderGlyph(glyph, width, height);
pageGlyphs.add(glyph);
pageX += width;
iter.remove();
i++;
if (i == maxGlyphsToLoad) {
// If loading incrementally, flip orderAscending so it won't change, since we'll probably load the rest next time.
orderAscending = !orderAscending;
break;
}
}
TextureImpl.bindNone();
// Every other batch of glyphs added to a page are sorted the opposite way to attempt to keep same size glyps together.
orderAscending = !orderAscending;
return i;
} | class class_name[name] begin[{]
method[loadGlyphs, return_type[type[int]], modifier[public], parameter[glyphs, maxGlyphsToLoad]] begin[{]
if[binary_operation[binary_operation[member[.rowHeight], !=, literal[0]], &&, binary_operation[member[.maxGlyphsToLoad], ==, literal[1]]]] begin[{]
local_variable[type[int], testX]
local_variable[type[int], testY]
local_variable[type[int], testRowHeight]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Glyph, sub_type=None)), name=glyph)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Glyph, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=glyph, selectors=[], type_arguments=None), name=width)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=glyph, selectors=[], type_arguments=None), name=height)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=testX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=pageWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=testRowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=testRowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=testX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=testY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=testRowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=testRowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=testY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=testRowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=pageWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=testX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=glyphs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
else begin[{]
None
end[}]
call[Color.white.bind, parameter[]]
call[pageImage.bind, parameter[]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Glyph, sub_type=None)), name=glyph)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Glyph, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=MAX_GLYPH_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=glyph, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=width)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=MAX_GLYPH_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=glyph, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=height)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pageX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=pageWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pageY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=pageHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pageY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=pageHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pageX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pageY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=glyph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=renderGlyph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=glyph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=pageGlyphs, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pageX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxGlyphsToLoad, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=orderAscending, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=orderAscending, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=glyphs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
call[TextureImpl.bindNone, parameter[]]
assign[member[.orderAscending], member[.orderAscending]]
return[member[.i]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[loadGlyphs] operator[SEP] identifier[List] identifier[glyphs] , Keyword[int] identifier[maxGlyphsToLoad] operator[SEP] Keyword[throws] identifier[SlickException] {
Keyword[if] operator[SEP] identifier[rowHeight] operator[!=] Other[0] operator[&&] identifier[maxGlyphsToLoad] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[testX] operator[=] identifier[pageX] operator[SEP] Keyword[int] identifier[testY] operator[=] identifier[pageY] operator[SEP] Keyword[int] identifier[testRowHeight] operator[=] identifier[rowHeight] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] identifier[iter] operator[=] identifier[getIterator] operator[SEP] identifier[glyphs] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Glyph] identifier[glyph] operator[=] operator[SEP] identifier[Glyph] operator[SEP] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[width] operator[=] identifier[glyph] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[glyph] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[testX] operator[+] identifier[width] operator[>=] identifier[pageWidth] operator[SEP] {
identifier[testX] operator[=] Other[0] operator[SEP] identifier[testY] operator[+=] identifier[testRowHeight] operator[SEP] identifier[testRowHeight] operator[=] identifier[height] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[height] operator[>] identifier[testRowHeight] operator[SEP] {
identifier[testRowHeight] operator[=] identifier[height] operator[SEP]
}
Keyword[if] operator[SEP] identifier[testY] operator[+] identifier[testRowHeight] operator[>=] identifier[pageWidth] operator[SEP] Keyword[return] Other[0] operator[SEP] identifier[testX] operator[+=] identifier[width] operator[SEP]
}
}
identifier[Color] operator[SEP] identifier[white] operator[SEP] identifier[bind] operator[SEP] operator[SEP] operator[SEP] identifier[pageImage] operator[SEP] identifier[bind] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] identifier[iter] operator[=] identifier[getIterator] operator[SEP] identifier[glyphs] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Glyph] identifier[glyph] operator[=] operator[SEP] identifier[Glyph] operator[SEP] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[width] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[MAX_GLYPH_SIZE] , identifier[glyph] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[MAX_GLYPH_SIZE] , identifier[glyph] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rowHeight] operator[==] Other[0] operator[SEP] {
identifier[rowHeight] operator[=] identifier[height] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[pageX] operator[+] identifier[width] operator[>=] identifier[pageWidth] operator[SEP] {
Keyword[if] operator[SEP] identifier[pageY] operator[+] identifier[rowHeight] operator[+] identifier[height] operator[>=] identifier[pageHeight] operator[SEP] Keyword[break] operator[SEP] identifier[pageX] operator[=] Other[0] operator[SEP] identifier[pageY] operator[+=] identifier[rowHeight] operator[SEP] identifier[rowHeight] operator[=] identifier[height] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[height] operator[>] identifier[rowHeight] operator[SEP] {
Keyword[if] operator[SEP] identifier[pageY] operator[+] identifier[height] operator[>=] identifier[pageHeight] operator[SEP] Keyword[break] operator[SEP] identifier[rowHeight] operator[=] identifier[height] operator[SEP]
}
}
identifier[renderGlyph] operator[SEP] identifier[glyph] , identifier[width] , identifier[height] operator[SEP] operator[SEP] identifier[pageGlyphs] operator[SEP] identifier[add] operator[SEP] identifier[glyph] operator[SEP] operator[SEP] identifier[pageX] operator[+=] identifier[width] operator[SEP] identifier[iter] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[==] identifier[maxGlyphsToLoad] operator[SEP] {
identifier[orderAscending] operator[=] operator[!] identifier[orderAscending] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[TextureImpl] operator[SEP] identifier[bindNone] operator[SEP] operator[SEP] operator[SEP] identifier[orderAscending] operator[=] operator[!] identifier[orderAscending] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
|
public void setAuthorized( boolean authorized ) {
if( isAuthorized() != authorized ) {
this.authorized = authorized;
// We need to apply a change to our enabled state depending on our
// new authorized state.
if( authorized ) {
// install the last requested enabled state
setEnabled(maskedEnabledState);
} else {
// Record the current enabled state and then disable
maskedEnabledState = isEnabled();
internalSetEnabled(false);
}
}
} | class class_name[name] begin[{]
method[setAuthorized, return_type[void], modifier[public], parameter[authorized]] begin[{]
if[binary_operation[call[.isAuthorized, parameter[]], !=, member[.authorized]]] begin[{]
assign[THIS[member[None.authorized]], member[.authorized]]
if[member[.authorized]] begin[{]
call[.setEnabled, parameter[member[.maskedEnabledState]]]
else begin[{]
assign[member[.maskedEnabledState], call[.isEnabled, parameter[]]]
call[.internalSetEnabled, parameter[literal[false]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAuthorized] operator[SEP] Keyword[boolean] identifier[authorized] operator[SEP] {
Keyword[if] operator[SEP] identifier[isAuthorized] operator[SEP] operator[SEP] operator[!=] identifier[authorized] operator[SEP] {
Keyword[this] operator[SEP] identifier[authorized] operator[=] identifier[authorized] operator[SEP] Keyword[if] operator[SEP] identifier[authorized] operator[SEP] {
identifier[setEnabled] operator[SEP] identifier[maskedEnabledState] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[maskedEnabledState] operator[=] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[internalSetEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
|
Rule Phrygian() {
return Sequence(IgnoreCase("phr"),
Optional(Sequence(IgnoreCase("y"),
Optional(Sequence(IgnoreCase("g"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
))
))
).label(Phrygian).suppressSubnodes();
} | class class_name[name] begin[{]
method[Phrygian, return_type[type[Rule]], modifier[default], parameter[]] begin[{]
return[call[.Sequence, parameter[call[.IgnoreCase, parameter[literal["phr"]]], call[.Optional, parameter[call[.Sequence, parameter[call[.IgnoreCase, parameter[literal["y"]]], call[.Optional, parameter[call[.Sequence, parameter[call[.IgnoreCase, parameter[literal["g"]]], call[.Optional, parameter[call[.Sequence, parameter[call[.IgnoreCase, parameter[literal["i"]]], call[.Optional, parameter[call[.Sequence, parameter[call[.IgnoreCase, parameter[literal["a"]]], call[.Optional, parameter[call[.IgnoreCase, parameter[literal["n"]]]]]]]]]]]]]]]]]]]]]]]]
end[}]
END[}] | identifier[Rule] identifier[Phrygian] operator[SEP] operator[SEP] {
Keyword[return] identifier[Sequence] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] , identifier[Optional] operator[SEP] identifier[Sequence] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] , identifier[Optional] operator[SEP] identifier[Sequence] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] , identifier[Optional] operator[SEP] identifier[Sequence] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] , identifier[Optional] operator[SEP] identifier[Sequence] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] , identifier[Optional] operator[SEP] identifier[IgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[Phrygian] operator[SEP] operator[SEP] identifier[suppressSubnodes] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object mod(final Object o1, final Object o2, final ASTNode node1, final ASTNode node2)
{
if (o1 != null && o2 != null)
{
switch (getBaseType(o1, o2))
{
// case STRING:
// return String.valueOf(o1) + String.valueOf(o2);
case INTEGER:
return Integer.valueOf(((Number) o1).intValue() % ((Number) o2).intValue());
case LONG:
return Long.valueOf(((Number) o1).longValue() % ((Number) o2).longValue());
case DOUBLE:
return Double.valueOf(((Number) o1).doubleValue() % ((Number) o2).doubleValue());
case FLOAT:
return Float.valueOf(((Number) o1).floatValue() % ((Number) o2).floatValue());
case SHORT:
return Short.valueOf((short) (((Number) o1).intValue() % ((Number) o2).intValue()));
case HS:
BigDecimal b1 = getBigDecimal(o1),
b2 = getBigDecimal(o2);
return b1.divide(b2);
default:
throw UnsupportedTypeException(o1, o2, node1, node2, "%");
}
}
else
{
throw valueIsNullException(o1, o2, node1, node2);
}
} | class class_name[name] begin[{]
method[mod, return_type[type[Object]], modifier[public static], parameter[o1, o2, node1, node2]] begin[{]
if[binary_operation[binary_operation[member[.o1], !=, literal[null]], &&, binary_operation[member[.o2], !=, literal[null]]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['INTEGER'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator=%)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['LONG'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator=%)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['DOUBLE'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator=%)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FLOAT'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator=%)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['SHORT'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator=%), type=BasicType(dimensions=[], name=short))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Short, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['HS'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=b1), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=b2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=b2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=divide, postfix_operators=[], prefix_operators=[], qualifier=b1, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%")], member=UnsupportedTypeException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBaseType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
else begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueIsNullException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[mod] operator[SEP] Keyword[final] identifier[Object] identifier[o1] , Keyword[final] identifier[Object] identifier[o2] , Keyword[final] identifier[ASTNode] identifier[node1] , Keyword[final] identifier[ASTNode] identifier[node2] operator[SEP] {
Keyword[if] operator[SEP] identifier[o1] operator[!=] Other[null] operator[&&] identifier[o2] operator[!=] Other[null] operator[SEP] {
Keyword[switch] operator[SEP] identifier[getBaseType] operator[SEP] identifier[o1] , identifier[o2] operator[SEP] operator[SEP] {
Keyword[case] identifier[INTEGER] operator[:] Keyword[return] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[%] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[LONG] operator[:] Keyword[return] identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[%] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[DOUBLE] operator[:] Keyword[return] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[%] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[FLOAT] operator[:] Keyword[return] identifier[Float] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[%] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[SHORT] operator[:] Keyword[return] identifier[Short] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[short] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[%] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[HS] operator[:] identifier[BigDecimal] identifier[b1] operator[=] identifier[getBigDecimal] operator[SEP] identifier[o1] operator[SEP] , identifier[b2] operator[=] identifier[getBigDecimal] operator[SEP] identifier[o2] operator[SEP] operator[SEP] Keyword[return] identifier[b1] operator[SEP] identifier[divide] operator[SEP] identifier[b2] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] identifier[UnsupportedTypeException] operator[SEP] identifier[o1] , identifier[o2] , identifier[node1] , identifier[node2] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] identifier[valueIsNullException] operator[SEP] identifier[o1] , identifier[o2] , identifier[node1] , identifier[node2] operator[SEP] operator[SEP]
}
}
|
public static boolean isPrintableString(String str) {
for (int i = 0; i < str.length(); i++) {
if (!isPrintableChar(str.charAt(i))) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[isPrintableString, return_type[type[boolean]], modifier[public static], parameter[str]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], member=isPrintableChar, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str, 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[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isPrintableString] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isPrintableChar] operator[SEP] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static boolean intersectCircleCircle(float aX, float aY, float radiusSquaredA, float bX, float bY, float radiusSquaredB, Vector3f intersectionCenterAndHL) {
float dX = bX - aX, dY = bY - aY;
float distSquared = dX * dX + dY * dY;
float h = 0.5f + (radiusSquaredA - radiusSquaredB) / distSquared;
float r_i = (float) Math.sqrt(radiusSquaredA - h * h * distSquared);
if (r_i >= 0.0f) {
intersectionCenterAndHL.x = aX + h * dX;
intersectionCenterAndHL.y = aY + h * dY;
intersectionCenterAndHL.z = r_i;
return true;
}
return false;
} | class class_name[name] begin[{]
method[intersectCircleCircle, return_type[type[boolean]], modifier[public static], parameter[aX, aY, radiusSquaredA, bX, bY, radiusSquaredB, intersectionCenterAndHL]] begin[{]
local_variable[type[float], dX]
local_variable[type[float], distSquared]
local_variable[type[float], h]
local_variable[type[float], r_i]
if[binary_operation[member[.r_i], >=, literal[0.0f]]] begin[{]
assign[member[intersectionCenterAndHL.x], binary_operation[member[.aX], +, binary_operation[member[.h], *, member[.dX]]]]
assign[member[intersectionCenterAndHL.y], binary_operation[member[.aY], +, binary_operation[member[.h], *, member[.dY]]]]
assign[member[intersectionCenterAndHL.z], member[.r_i]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[intersectCircleCircle] operator[SEP] Keyword[float] identifier[aX] , Keyword[float] identifier[aY] , Keyword[float] identifier[radiusSquaredA] , Keyword[float] identifier[bX] , Keyword[float] identifier[bY] , Keyword[float] identifier[radiusSquaredB] , identifier[Vector3f] identifier[intersectionCenterAndHL] operator[SEP] {
Keyword[float] identifier[dX] operator[=] identifier[bX] operator[-] identifier[aX] , identifier[dY] operator[=] identifier[bY] operator[-] identifier[aY] operator[SEP] Keyword[float] identifier[distSquared] operator[=] identifier[dX] operator[*] identifier[dX] operator[+] identifier[dY] operator[*] identifier[dY] operator[SEP] Keyword[float] identifier[h] operator[=] literal[Float] operator[+] operator[SEP] identifier[radiusSquaredA] operator[-] identifier[radiusSquaredB] operator[SEP] operator[/] identifier[distSquared] operator[SEP] Keyword[float] identifier[r_i] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[radiusSquaredA] operator[-] identifier[h] operator[*] identifier[h] operator[*] identifier[distSquared] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r_i] operator[>=] literal[Float] operator[SEP] {
identifier[intersectionCenterAndHL] operator[SEP] identifier[x] operator[=] identifier[aX] operator[+] identifier[h] operator[*] identifier[dX] operator[SEP] identifier[intersectionCenterAndHL] operator[SEP] identifier[y] operator[=] identifier[aY] operator[+] identifier[h] operator[*] identifier[dY] operator[SEP] identifier[intersectionCenterAndHL] operator[SEP] identifier[z] operator[=] identifier[r_i] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private List<T> finalizeCurrentBatch() {
List<T> finalizedList;
synchronized (items) {
finalizedList = ImmutableList.copyOf(items);
items.clear();
/*
* To avoid reprocessing being triggered on an empty list.
*/
cancelTask(maxTask);
cancelTask(idleTask);
}
return finalizedList;
} | class class_name[name] begin[{]
method[finalizeCurrentBatch, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[List], finalizedList]
SYNCHRONIZED[member[.items]] BEGIN[{]
assign[member[.finalizedList], call[ImmutableList.copyOf, parameter[member[.items]]]]
call[items.clear, parameter[]]
call[.cancelTask, parameter[member[.maxTask]]]
call[.cancelTask, parameter[member[.idleTask]]]
END[}]
return[member[.finalizedList]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[T] operator[>] identifier[finalizeCurrentBatch] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[T] operator[>] identifier[finalizedList] operator[SEP] Keyword[synchronized] operator[SEP] identifier[items] operator[SEP] {
identifier[finalizedList] operator[=] identifier[ImmutableList] operator[SEP] identifier[copyOf] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[items] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[cancelTask] operator[SEP] identifier[maxTask] operator[SEP] operator[SEP] identifier[cancelTask] operator[SEP] identifier[idleTask] operator[SEP] operator[SEP]
}
Keyword[return] identifier[finalizedList] operator[SEP]
}
|
protected LightweightTypeReference visitTypeArgument(LightweightTypeReference reference, Visiting visiting) {
return visitTypeArgument(reference, visiting, false);
} | class class_name[name] begin[{]
method[visitTypeArgument, return_type[type[LightweightTypeReference]], modifier[protected], parameter[reference, visiting]] begin[{]
return[call[.visitTypeArgument, parameter[member[.reference], member[.visiting], literal[false]]]]
end[}]
END[}] | Keyword[protected] identifier[LightweightTypeReference] identifier[visitTypeArgument] operator[SEP] identifier[LightweightTypeReference] identifier[reference] , identifier[Visiting] identifier[visiting] operator[SEP] {
Keyword[return] identifier[visitTypeArgument] operator[SEP] identifier[reference] , identifier[visiting] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public void set_attribute_config_3(final AttributeConfig_3[] newConf) throws DevFailed {
MDC.setContextMap(contextMap);
xlogger.entry();
checkInitialization();
deviceMonitoring.startRequest("set_attribute_config_3");
for (final AttributeConfig_3 attributeConfig : newConf) {
final String attributeName = attributeConfig.name;
final AttributeImpl attribute = AttributeGetterSetter.getAttribute(attributeName, attributeList);
if (attribute.getName().equals(STATE_NAME) || attribute.getName().equals(STATUS_NAME)) {
throw DevFailedUtils.newDevFailed("set attribute is not possible for " + attribute.getName());
}
if (!attribute.getFormat().equals(attributeConfig.data_format)
|| !attribute.getWritable().equals(attributeConfig.writable)
|| !attribute.getDispLevel().equals(attributeConfig.level)
|| attribute.getTangoType() != attributeConfig.data_type) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_NOT_ALLOWED, "not a good config");
}
final AttributePropertiesImpl props = TangoIDLAttributeUtil.toAttributeProperties(attributeConfig);
logger.debug("set_attribute_config_3: {}", props);
attribute.setProperties(props);
}
xlogger.exit();
} | class class_name[name] begin[{]
method[set_attribute_config_3, return_type[void], modifier[public], parameter[newConf]] begin[{]
call[MDC.setContextMap, parameter[member[.contextMap]]]
call[xlogger.entry, parameter[]]
call[.checkInitialization, parameter[]]
call[deviceMonitoring.startRequest, parameter[literal["set_attribute_config_3"]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=attributeConfig, selectors=[]), name=attributeName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=attributeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attributeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=AttributeGetterSetter, selectors=[], type_arguments=None), name=attribute)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AttributeImpl, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[MethodInvocation(arguments=[MemberReference(member=STATE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[MethodInvocation(arguments=[MemberReference(member=STATUS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="set attribute is not possible for "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), operator=+)], member=newDevFailed, postfix_operators=[], prefix_operators=[], qualifier=DevFailedUtils, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getFormat, postfix_operators=[], prefix_operators=['!'], qualifier=attribute, selectors=[MethodInvocation(arguments=[MemberReference(member=data_format, postfix_operators=[], prefix_operators=[], qualifier=attributeConfig, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getWritable, postfix_operators=[], prefix_operators=['!'], qualifier=attribute, selectors=[MethodInvocation(arguments=[MemberReference(member=writable, postfix_operators=[], prefix_operators=[], qualifier=attributeConfig, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), operandr=MethodInvocation(arguments=[], member=getDispLevel, postfix_operators=[], prefix_operators=['!'], qualifier=attribute, selectors=[MethodInvocation(arguments=[MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=attributeConfig, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getTangoType, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), operandr=MemberReference(member=data_type, postfix_operators=[], prefix_operators=[], qualifier=attributeConfig, selectors=[]), operator=!=), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=ATTR_NOT_ALLOWED, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMessages, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="not a good config")], member=newDevFailed, postfix_operators=[], prefix_operators=[], qualifier=DevFailedUtils, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=attributeConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toAttributeProperties, postfix_operators=[], prefix_operators=[], qualifier=TangoIDLAttributeUtil, selectors=[], type_arguments=None), name=props)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AttributePropertiesImpl, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="set_attribute_config_3: {}"), MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperties, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=newConf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=attributeConfig)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AttributeConfig_3, sub_type=None))), label=None)
call[xlogger.exit, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[set_attribute_config_3] operator[SEP] Keyword[final] identifier[AttributeConfig_3] operator[SEP] operator[SEP] identifier[newConf] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[MDC] operator[SEP] identifier[setContextMap] operator[SEP] identifier[contextMap] operator[SEP] operator[SEP] identifier[xlogger] operator[SEP] identifier[entry] operator[SEP] operator[SEP] operator[SEP] identifier[checkInitialization] operator[SEP] operator[SEP] operator[SEP] identifier[deviceMonitoring] operator[SEP] identifier[startRequest] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[AttributeConfig_3] identifier[attributeConfig] operator[:] identifier[newConf] operator[SEP] {
Keyword[final] identifier[String] identifier[attributeName] operator[=] identifier[attributeConfig] operator[SEP] identifier[name] operator[SEP] Keyword[final] identifier[AttributeImpl] identifier[attribute] operator[=] identifier[AttributeGetterSetter] operator[SEP] identifier[getAttribute] operator[SEP] identifier[attributeName] , identifier[attributeList] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[STATE_NAME] operator[SEP] operator[||] identifier[attribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[STATUS_NAME] operator[SEP] operator[SEP] {
Keyword[throw] identifier[DevFailedUtils] operator[SEP] identifier[newDevFailed] operator[SEP] literal[String] operator[+] identifier[attribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[attribute] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[attributeConfig] operator[SEP] identifier[data_format] operator[SEP] operator[||] operator[!] identifier[attribute] operator[SEP] identifier[getWritable] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[attributeConfig] operator[SEP] identifier[writable] operator[SEP] operator[||] operator[!] identifier[attribute] operator[SEP] identifier[getDispLevel] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[attributeConfig] operator[SEP] identifier[level] operator[SEP] operator[||] identifier[attribute] operator[SEP] identifier[getTangoType] operator[SEP] operator[SEP] operator[!=] identifier[attributeConfig] operator[SEP] identifier[data_type] operator[SEP] {
Keyword[throw] identifier[DevFailedUtils] operator[SEP] identifier[newDevFailed] operator[SEP] identifier[ExceptionMessages] operator[SEP] identifier[ATTR_NOT_ALLOWED] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[AttributePropertiesImpl] identifier[props] operator[=] identifier[TangoIDLAttributeUtil] operator[SEP] identifier[toAttributeProperties] operator[SEP] identifier[attributeConfig] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[props] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] identifier[setProperties] operator[SEP] identifier[props] operator[SEP] operator[SEP]
}
identifier[xlogger] operator[SEP] identifier[exit] operator[SEP] operator[SEP] operator[SEP]
}
|
private void initDefaultLoginFilter(H http) {
DefaultLoginPageGeneratingFilter loginPageGeneratingFilter = http
.getSharedObject(DefaultLoginPageGeneratingFilter.class);
if (loginPageGeneratingFilter != null) {
loginPageGeneratingFilter.setRememberMeParameter(getRememberMeParameter());
}
} | class class_name[name] begin[{]
method[initDefaultLoginFilter, return_type[void], modifier[private], parameter[http]] begin[{]
local_variable[type[DefaultLoginPageGeneratingFilter], loginPageGeneratingFilter]
if[binary_operation[member[.loginPageGeneratingFilter], !=, literal[null]]] begin[{]
call[loginPageGeneratingFilter.setRememberMeParameter, parameter[call[.getRememberMeParameter, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initDefaultLoginFilter] operator[SEP] identifier[H] identifier[http] operator[SEP] {
identifier[DefaultLoginPageGeneratingFilter] identifier[loginPageGeneratingFilter] operator[=] identifier[http] operator[SEP] identifier[getSharedObject] operator[SEP] identifier[DefaultLoginPageGeneratingFilter] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loginPageGeneratingFilter] operator[!=] Other[null] operator[SEP] {
identifier[loginPageGeneratingFilter] operator[SEP] identifier[setRememberMeParameter] operator[SEP] identifier[getRememberMeParameter] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void process(GrayU8 orig, GrayS16 derivX, GrayS16 derivY, @Nullable ImageBorder_S32 border ) {
InputSanityCheck.reshapeOneIn(orig, derivX, derivY);
if( BoofConcurrency.USE_CONCURRENT ) {
GradientPrewitt_Shared_MT.process(orig, derivX, derivY);
} else {
GradientPrewitt_Shared.process(orig, derivX, derivY);
}
if( border != null ) {
border.setImage(orig);
ConvolveJustBorder_General_SB.convolve(kernelDerivX_I32, border,derivX);
ConvolveJustBorder_General_SB.convolve(kernelDerivY_I32, border,derivY);
}
} | class class_name[name] begin[{]
method[process, return_type[void], modifier[public static], parameter[orig, derivX, derivY, border]] begin[{]
call[InputSanityCheck.reshapeOneIn, parameter[member[.orig], member[.derivX], member[.derivY]]]
if[member[BoofConcurrency.USE_CONCURRENT]] begin[{]
call[GradientPrewitt_Shared_MT.process, parameter[member[.orig], member[.derivX], member[.derivY]]]
else begin[{]
call[GradientPrewitt_Shared.process, parameter[member[.orig], member[.derivX], member[.derivY]]]
end[}]
if[binary_operation[member[.border], !=, literal[null]]] begin[{]
call[border.setImage, parameter[member[.orig]]]
call[ConvolveJustBorder_General_SB.convolve, parameter[member[.kernelDerivX_I32], member[.border], member[.derivX]]]
call[ConvolveJustBorder_General_SB.convolve, parameter[member[.kernelDerivY_I32], member[.border], member[.derivY]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[process] operator[SEP] identifier[GrayU8] identifier[orig] , identifier[GrayS16] identifier[derivX] , identifier[GrayS16] identifier[derivY] , annotation[@] identifier[Nullable] identifier[ImageBorder_S32] identifier[border] operator[SEP] {
identifier[InputSanityCheck] operator[SEP] identifier[reshapeOneIn] operator[SEP] identifier[orig] , identifier[derivX] , identifier[derivY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[BoofConcurrency] operator[SEP] identifier[USE_CONCURRENT] operator[SEP] {
identifier[GradientPrewitt_Shared_MT] operator[SEP] identifier[process] operator[SEP] identifier[orig] , identifier[derivX] , identifier[derivY] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[GradientPrewitt_Shared] operator[SEP] identifier[process] operator[SEP] identifier[orig] , identifier[derivX] , identifier[derivY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[border] operator[!=] Other[null] operator[SEP] {
identifier[border] operator[SEP] identifier[setImage] operator[SEP] identifier[orig] operator[SEP] operator[SEP] identifier[ConvolveJustBorder_General_SB] operator[SEP] identifier[convolve] operator[SEP] identifier[kernelDerivX_I32] , identifier[border] , identifier[derivX] operator[SEP] operator[SEP] identifier[ConvolveJustBorder_General_SB] operator[SEP] identifier[convolve] operator[SEP] identifier[kernelDerivY_I32] , identifier[border] , identifier[derivY] operator[SEP] operator[SEP]
}
}
|
static boolean isClusterCandidate_(double x_1, double y1, double x2,
double y2, double sqr_tolerance) {
double dx = x_1 - x2;
double dy = y1 - y2;
return dx * dx + dy * dy <= sqr_tolerance;
} | class class_name[name] begin[{]
method[isClusterCandidate_, return_type[type[boolean]], modifier[static], parameter[x_1, y1, x2, y2, sqr_tolerance]] begin[{]
local_variable[type[double], dx]
local_variable[type[double], dy]
return[binary_operation[binary_operation[binary_operation[member[.dx], *, member[.dx]], +, binary_operation[member[.dy], *, member[.dy]]], <=, member[.sqr_tolerance]]]
end[}]
END[}] | Keyword[static] Keyword[boolean] identifier[isClusterCandidate_] operator[SEP] Keyword[double] identifier[x_1] , Keyword[double] identifier[y1] , Keyword[double] identifier[x2] , Keyword[double] identifier[y2] , Keyword[double] identifier[sqr_tolerance] operator[SEP] {
Keyword[double] identifier[dx] operator[=] identifier[x_1] operator[-] identifier[x2] operator[SEP] Keyword[double] identifier[dy] operator[=] identifier[y1] operator[-] identifier[y2] operator[SEP] Keyword[return] identifier[dx] operator[*] identifier[dx] operator[+] identifier[dy] operator[*] identifier[dy] operator[<=] identifier[sqr_tolerance] operator[SEP]
}
|
private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){
if(acceptTasks.get()){
return queue.submit(callable);
} else {
throw new RejectedExecutionException("Database is closed");
}
} | class class_name[name] begin[{]
method[submitTaskToQueue, return_type[type[Future]], modifier[private], parameter[callable]] begin[{]
if[call[acceptTasks.get, parameter[]]] begin[{]
return[call[queue.submit, parameter[member[.callable]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Database is closed")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RejectedExecutionException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[Future] operator[<] identifier[T] operator[>] identifier[submitTaskToQueue] operator[SEP] identifier[SQLQueueCallable] operator[<] identifier[T] operator[>] identifier[callable] operator[SEP] {
Keyword[if] operator[SEP] identifier[acceptTasks] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[queue] operator[SEP] identifier[submit] operator[SEP] identifier[callable] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[RejectedExecutionException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return XBoolean.S_FALSE;
} | class class_name[name] begin[{]
method[execute, return_type[type[XObject]], modifier[public], parameter[xctxt]] begin[{]
return[member[XBoolean.S_FALSE]]
end[}]
END[}] | Keyword[public] identifier[XObject] identifier[execute] operator[SEP] identifier[XPathContext] identifier[xctxt] operator[SEP] Keyword[throws] identifier[javax] operator[SEP] identifier[xml] operator[SEP] identifier[transform] operator[SEP] identifier[TransformerException] {
Keyword[return] identifier[XBoolean] operator[SEP] identifier[S_FALSE] operator[SEP]
}
|
@Override
public boolean checkSessionStillValid(ISession s, long accessedTime) {
final String methodName = "checkSessionStillValid";
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[CHECK_SESSION_STILL_VALID]);
}
long nowTime = System.currentTimeMillis();
boolean rc = true;
synchronized (s) {
if (s.isValid()) {
if (s.getMaxInactiveInterval() != -1) {
long maxinact = 1000 * (long) s.getMaxInactiveInterval();
boolean active = s.getRefCount() > 0;
if (_isApplicationSessionStore) {
//the RefCount is not correct when dealing with an applicationSessionStore
s.setRefCount(0);
active = false;
}
boolean timedOut = (accessedTime <= nowTime - maxinact);
/*
* invalidate if:
* session has timedOut AND (is not active OR (the Invalidation Multiple has not been set to 0
* and the session is that many times the invalidation interval)
*
* The default value for the invalidation interval is 3.
*
* PK03711 removed check for active and always invalidated timedout sessions for v6.1 and earlier
* v7 CTS defect 391577 forced us to put this code back, so we introduced the InvalidateIfActive property
* In the service stream, the ForceSessionInvalidationMultiple was used, so we are using the same property
*/
if ((timedOut) && ((!active) ||
((_smc.getForceSessionInvalidationMultiple() != 0) &&
(accessedTime <= nowTime - (_smc.getForceSessionInvalidationMultiple() * maxinact))))) {
if (maxinact != 0) {
_storeCallback.sessionInvalidatedByTimeout(s);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
String message = "Going to invalidate session with id=" + s.getId();
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[CHECK_SESSION_STILL_VALID], message);
}
s.invalidate();
rc = false;
}
}
} else { //isValid
rc = false;
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[CHECK_SESSION_STILL_VALID]);
}
return rc;
} | class class_name[name] begin[{]
method[checkSessionStillValid, return_type[type[boolean]], modifier[public], parameter[s, accessedTime]] begin[{]
local_variable[type[String], methodName]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[LoggingUtil.SESSION_LOGGER_CORE.entering, parameter[member[.methodClassName], member[.methodNames]]]
else begin[{]
None
end[}]
local_variable[type[long], nowTime]
local_variable[type[boolean], rc]
SYNCHRONIZED[member[.s]] BEGIN[{]
if[call[s.isValid, parameter[]]] begin[{]
if[binary_operation[call[s.getMaxInactiveInterval, parameter[]], !=, literal[1]]] begin[{]
local_variable[type[long], maxinact]
local_variable[type[boolean], active]
if[member[._isApplicationSessionStore]] begin[{]
call[s.setRefCount, parameter[literal[0]]]
assign[member[.active], literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], timedOut]
if[binary_operation[member[.timedOut], &&, binary_operation[member[.active], ||, binary_operation[binary_operation[call[_smc.getForceSessionInvalidationMultiple, parameter[]], !=, literal[0]], &&, binary_operation[member[.accessedTime], <=, binary_operation[member[.nowTime], -, binary_operation[call[_smc.getForceSessionInvalidationMultiple, parameter[]], *, member[.maxinact]]]]]]]] begin[{]
if[binary_operation[member[.maxinact], !=, literal[0]]] begin[{]
call[_storeCallback.sessionInvalidatedByTimeout, parameter[member[.s]]]
else begin[{]
None
end[}]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
local_variable[type[String], message]
call[LoggingUtil.SESSION_LOGGER_CORE.logp, parameter[member[Level.FINE], member[.methodClassName], member[.methodNames], member[.message]]]
else begin[{]
None
end[}]
call[s.invalidate, parameter[]]
assign[member[.rc], literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
assign[member[.rc], literal[false]]
end[}]
END[}]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[LoggingUtil.SESSION_LOGGER_CORE.exiting, parameter[member[.methodClassName], member[.methodNames]]]
else begin[{]
None
end[}]
return[member[.rc]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[checkSessionStillValid] operator[SEP] identifier[ISession] identifier[s] , Keyword[long] identifier[accessedTime] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[entering] operator[SEP] identifier[methodClassName] , identifier[methodNames] operator[SEP] identifier[CHECK_SESSION_STILL_VALID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[long] identifier[nowTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[rc] operator[=] literal[boolean] operator[SEP] Keyword[synchronized] operator[SEP] identifier[s] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[getMaxInactiveInterval] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[long] identifier[maxinact] operator[=] Other[1000] operator[*] operator[SEP] Keyword[long] operator[SEP] identifier[s] operator[SEP] identifier[getMaxInactiveInterval] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[active] operator[=] identifier[s] operator[SEP] identifier[getRefCount] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[_isApplicationSessionStore] operator[SEP] {
identifier[s] operator[SEP] identifier[setRefCount] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[active] operator[=] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[timedOut] operator[=] operator[SEP] identifier[accessedTime] operator[<=] identifier[nowTime] operator[-] identifier[maxinact] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[timedOut] operator[SEP] operator[&&] operator[SEP] operator[SEP] operator[!] identifier[active] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[_smc] operator[SEP] identifier[getForceSessionInvalidationMultiple] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[accessedTime] operator[<=] identifier[nowTime] operator[-] operator[SEP] identifier[_smc] operator[SEP] identifier[getForceSessionInvalidationMultiple] operator[SEP] operator[SEP] operator[*] identifier[maxinact] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[maxinact] operator[!=] Other[0] operator[SEP] {
identifier[_storeCallback] operator[SEP] identifier[sessionInvalidatedByTimeout] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[s] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[methodClassName] , identifier[methodNames] operator[SEP] identifier[CHECK_SESSION_STILL_VALID] operator[SEP] , identifier[message] operator[SEP] operator[SEP]
}
identifier[s] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP] identifier[rc] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[else] {
identifier[rc] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[exiting] operator[SEP] identifier[methodClassName] , identifier[methodNames] operator[SEP] identifier[CHECK_SESSION_STILL_VALID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rc] operator[SEP]
}
|
private static String relationalMapperName(Class<?> configuredClass, String resource){
String className = configuredClass.getName().replaceAll("\\.","");
if(isEmpty(resource))
return className;
if(!isPath(resource))
return write(className, String.valueOf(resource.hashCode()));
String[]dep = resource.split("\\\\");
if(dep.length<=1)dep = resource.split("/");
String xml = dep[dep.length-1];
return write(className, xml.replaceAll("\\.","").replaceAll(" ",""));
} | class class_name[name] begin[{]
method[relationalMapperName, return_type[type[String]], modifier[private static], parameter[configuredClass, resource]] begin[{]
local_variable[type[String], className]
if[call[.isEmpty, parameter[member[.resource]]]] begin[{]
return[member[.className]]
else begin[{]
None
end[}]
if[call[.isPath, parameter[member[.resource]]]] begin[{]
return[call[.write, parameter[member[.className], call[String.valueOf, parameter[call[resource.hashCode, parameter[]]]]]]]
else begin[{]
None
end[}]
local_variable[type[String], dep]
if[binary_operation[member[dep.length], <=, literal[1]]] begin[{]
assign[member[.dep], call[resource.split, parameter[literal["/"]]]]
else begin[{]
None
end[}]
local_variable[type[String], xml]
return[call[.write, parameter[member[.className], call[xml.replaceAll, parameter[literal["\\."], literal[""]]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[relationalMapperName] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[configuredClass] , identifier[String] identifier[resource] operator[SEP] {
identifier[String] identifier[className] operator[=] identifier[configuredClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[return] identifier[className] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isPath] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[return] identifier[write] operator[SEP] identifier[className] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[resource] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[dep] operator[=] identifier[resource] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dep] operator[SEP] identifier[length] operator[<=] Other[1] operator[SEP] identifier[dep] operator[=] identifier[resource] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[xml] operator[=] identifier[dep] operator[SEP] identifier[dep] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[write] operator[SEP] identifier[className] , identifier[xml] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public void add(int index, Double value) {
if (value == null) {
stateList.add(index, Type.NULL);
} else {
stateList.add(index, Type.DOUBLE);
}
super.add(index, value);
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[index, value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
call[stateList.add, parameter[member[.index], member[Type.NULL]]]
else begin[{]
call[stateList.add, parameter[member[.index], member[Type.DOUBLE]]]
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add] operator[SEP] Keyword[int] identifier[index] , identifier[Double] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[stateList] operator[SEP] identifier[add] operator[SEP] identifier[index] , identifier[Type] operator[SEP] identifier[NULL] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[stateList] operator[SEP] identifier[add] operator[SEP] identifier[index] , identifier[Type] operator[SEP] identifier[DOUBLE] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[add] operator[SEP] identifier[index] , identifier[value] operator[SEP] operator[SEP]
}
|
public ConnectionDefinition merge(MergeableMetadata<?> jmd) throws Exception
{
if (jmd instanceof ConnectionDefinitionImpl)
{
ConnectionDefinitionImpl input = (ConnectionDefinitionImpl) jmd;
List<ConfigProperty> newConfigProperty = MergeUtil.mergeConfigList(this.configProperties,
input.configProperties);
XsdString newManagedconnectionfactoryClass = this.managedconnectionfactoryClass == null
? input.managedconnectionfactoryClass
: this.managedconnectionfactoryClass;
XsdString newConnectionInterface = this.connectionInterface == null
? input.connectionInterface
: this.connectionInterface;
XsdString newConnectionfactoryImplClass = this.connectionfactoryImplClass == null
? input.connectionfactoryImplClass
: this.connectionfactoryImplClass;
XsdString newConnectionfactoryInterface = this.connectionfactoryInterface == null
? input.connectionfactoryInterface
: this.connectionfactoryInterface;
String newId = this.id == null ? input.id : this.id;
XsdString newConnectionImplClass = this.connectionImplClass == null
? input.connectionImplClass
: this.connectionImplClass;
return new ConnectionDefinitionImpl(newManagedconnectionfactoryClass, newConfigProperty,
newConnectionfactoryInterface, newConnectionfactoryImplClass,
newConnectionInterface, newConnectionImplClass, newId);
}
else
{
return this;
}
} | class class_name[name] begin[{]
method[merge, return_type[type[ConnectionDefinition]], modifier[public], parameter[jmd]] begin[{]
if[binary_operation[member[.jmd], instanceof, type[ConnectionDefinitionImpl]]] begin[{]
local_variable[type[ConnectionDefinitionImpl], input]
local_variable[type[List], newConfigProperty]
local_variable[type[XsdString], newManagedconnectionfactoryClass]
local_variable[type[XsdString], newConnectionInterface]
local_variable[type[XsdString], newConnectionfactoryImplClass]
local_variable[type[XsdString], newConnectionfactoryInterface]
local_variable[type[String], newId]
local_variable[type[XsdString], newConnectionImplClass]
return[ClassCreator(arguments=[MemberReference(member=newManagedconnectionfactoryClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newConfigProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newConnectionfactoryInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newConnectionfactoryImplClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newConnectionInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newConnectionImplClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newId, 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=ConnectionDefinitionImpl, sub_type=None))]
else begin[{]
return[THIS[]]
end[}]
end[}]
END[}] | Keyword[public] identifier[ConnectionDefinition] identifier[merge] operator[SEP] identifier[MergeableMetadata] operator[<] operator[?] operator[>] identifier[jmd] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[jmd] Keyword[instanceof] identifier[ConnectionDefinitionImpl] operator[SEP] {
identifier[ConnectionDefinitionImpl] identifier[input] operator[=] operator[SEP] identifier[ConnectionDefinitionImpl] operator[SEP] identifier[jmd] operator[SEP] identifier[List] operator[<] identifier[ConfigProperty] operator[>] identifier[newConfigProperty] operator[=] identifier[MergeUtil] operator[SEP] identifier[mergeConfigList] operator[SEP] Keyword[this] operator[SEP] identifier[configProperties] , identifier[input] operator[SEP] identifier[configProperties] operator[SEP] operator[SEP] identifier[XsdString] identifier[newManagedconnectionfactoryClass] operator[=] Keyword[this] operator[SEP] identifier[managedconnectionfactoryClass] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[managedconnectionfactoryClass] operator[:] Keyword[this] operator[SEP] identifier[managedconnectionfactoryClass] operator[SEP] identifier[XsdString] identifier[newConnectionInterface] operator[=] Keyword[this] operator[SEP] identifier[connectionInterface] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[connectionInterface] operator[:] Keyword[this] operator[SEP] identifier[connectionInterface] operator[SEP] identifier[XsdString] identifier[newConnectionfactoryImplClass] operator[=] Keyword[this] operator[SEP] identifier[connectionfactoryImplClass] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[connectionfactoryImplClass] operator[:] Keyword[this] operator[SEP] identifier[connectionfactoryImplClass] operator[SEP] identifier[XsdString] identifier[newConnectionfactoryInterface] operator[=] Keyword[this] operator[SEP] identifier[connectionfactoryInterface] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[connectionfactoryInterface] operator[:] Keyword[this] operator[SEP] identifier[connectionfactoryInterface] operator[SEP] identifier[String] identifier[newId] operator[=] Keyword[this] operator[SEP] identifier[id] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[id] operator[:] Keyword[this] operator[SEP] identifier[id] operator[SEP] identifier[XsdString] identifier[newConnectionImplClass] operator[=] Keyword[this] operator[SEP] identifier[connectionImplClass] operator[==] Other[null] operator[?] identifier[input] operator[SEP] identifier[connectionImplClass] operator[:] Keyword[this] operator[SEP] identifier[connectionImplClass] operator[SEP] Keyword[return] Keyword[new] identifier[ConnectionDefinitionImpl] operator[SEP] identifier[newManagedconnectionfactoryClass] , identifier[newConfigProperty] , identifier[newConnectionfactoryInterface] , identifier[newConnectionfactoryImplClass] , identifier[newConnectionInterface] , identifier[newConnectionImplClass] , identifier[newId] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP]
}
}
|
public static String[] techniquesToStringArray(Set<ExperimentalTechnique> experimentalTechniques) {
if(experimentalTechniques==null){
return new String[0];
}
String[] outArray = new String[experimentalTechniques.size()];
int index = 0;
for (ExperimentalTechnique experimentalTechnique : experimentalTechniques) {
outArray[index] = experimentalTechnique.getName();
index++;
}
return outArray;
} | class class_name[name] begin[{]
method[techniquesToStringArray, return_type[type[String]], modifier[public static], parameter[experimentalTechniques]] begin[{]
if[binary_operation[member[.experimentalTechniques], ==, literal[null]]] begin[{]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], outArray]
local_variable[type[int], index]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=outArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=experimentalTechnique, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=experimentalTechniques, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=experimentalTechnique)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExperimentalTechnique, sub_type=None))), label=None)
return[member[.outArray]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] operator[SEP] operator[SEP] identifier[techniquesToStringArray] operator[SEP] identifier[Set] operator[<] identifier[ExperimentalTechnique] operator[>] identifier[experimentalTechniques] operator[SEP] {
Keyword[if] operator[SEP] identifier[experimentalTechniques] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[outArray] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[experimentalTechniques] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[ExperimentalTechnique] identifier[experimentalTechnique] operator[:] identifier[experimentalTechniques] operator[SEP] {
identifier[outArray] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[experimentalTechnique] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[++] operator[SEP]
}
Keyword[return] identifier[outArray] operator[SEP]
}
|
public static Cluster updateCluster(Cluster currentCluster, List<Node> updatedNodeList) {
List<Node> newNodeList = new ArrayList<Node>(updatedNodeList);
for(Node currentNode: currentCluster.getNodes()) {
if(!updatedNodeList.contains(currentNode))
newNodeList.add(currentNode);
}
Collections.sort(newNodeList);
return new Cluster(currentCluster.getName(),
newNodeList,
Lists.newArrayList(currentCluster.getZones()));
} | class class_name[name] begin[{]
method[updateCluster, return_type[type[Cluster]], modifier[public static], parameter[currentCluster, updatedNodeList]] begin[{]
local_variable[type[List], newNodeList]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=currentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=updatedNodeList, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=newNodeList, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=currentCluster, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=currentNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
call[Collections.sort, parameter[member[.newNodeList]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=currentCluster, selectors=[], type_arguments=None), MemberReference(member=newNodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getZones, postfix_operators=[], prefix_operators=[], qualifier=currentCluster, selectors=[], type_arguments=None)], member=newArrayList, postfix_operators=[], prefix_operators=[], qualifier=Lists, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Cluster, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Cluster] identifier[updateCluster] operator[SEP] identifier[Cluster] identifier[currentCluster] , identifier[List] operator[<] identifier[Node] operator[>] identifier[updatedNodeList] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[newNodeList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Node] operator[>] operator[SEP] identifier[updatedNodeList] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[currentNode] operator[:] identifier[currentCluster] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[updatedNodeList] operator[SEP] identifier[contains] operator[SEP] identifier[currentNode] operator[SEP] operator[SEP] identifier[newNodeList] operator[SEP] identifier[add] operator[SEP] identifier[currentNode] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[newNodeList] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Cluster] operator[SEP] identifier[currentCluster] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[newNodeList] , identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] identifier[currentCluster] operator[SEP] identifier[getZones] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private CmsUgcSession createSession(CmsObject cms, CmsUgcConfiguration config) throws CmsUgcException {
if (getQueue(config).waitForSlot()) {
try {
return new CmsUgcSession(m_adminCms, cms, config);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e);
}
} else {
String message = Messages.get().container(Messages.ERR_WAIT_QUEUE_EXCEEDED_0).key(
cms.getRequestContext().getLocale());
throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxQueueLengthExceeded, message);
}
} | class class_name[name] begin[{]
method[createSession, return_type[type[CmsUgcSession]], modifier[private], parameter[cms, config]] begin[{]
if[call[.getQueue, parameter[member[.config]]]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=m_adminCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=config, 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=CmsUgcSession, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsUgcException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
else begin[{]
local_variable[type[String], message]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=errMaxQueueLengthExceeded, postfix_operators=[], prefix_operators=[], qualifier=CmsUgcConstants.ErrorCode, selectors=[]), 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=CmsUgcException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[private] identifier[CmsUgcSession] identifier[createSession] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[CmsUgcConfiguration] identifier[config] operator[SEP] Keyword[throws] identifier[CmsUgcException] {
Keyword[if] operator[SEP] identifier[getQueue] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[waitForSlot] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[CmsUgcSession] operator[SEP] identifier[m_adminCms] , identifier[cms] , identifier[config] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsUgcException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_WAIT_QUEUE_EXCEEDED_0] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsUgcException] operator[SEP] identifier[CmsUgcConstants] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[errMaxQueueLengthExceeded] , identifier[message] operator[SEP] operator[SEP]
}
}
|
@BetaApi
public final Operation setDiskAutoDeleteInstance(
ProjectZoneInstanceName instance, Boolean autoDelete, String deviceName) {
SetDiskAutoDeleteInstanceHttpRequest request =
SetDiskAutoDeleteInstanceHttpRequest.newBuilder()
.setInstance(instance == null ? null : instance.toString())
.setAutoDelete(autoDelete)
.setDeviceName(deviceName)
.build();
return setDiskAutoDeleteInstance(request);
} | class class_name[name] begin[{]
method[setDiskAutoDeleteInstance, return_type[type[Operation]], modifier[final public], parameter[instance, autoDelete, deviceName]] begin[{]
local_variable[type[SetDiskAutoDeleteInstanceHttpRequest], request]
return[call[.setDiskAutoDeleteInstance, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[Operation] identifier[setDiskAutoDeleteInstance] operator[SEP] identifier[ProjectZoneInstanceName] identifier[instance] , identifier[Boolean] identifier[autoDelete] , identifier[String] identifier[deviceName] operator[SEP] {
identifier[SetDiskAutoDeleteInstanceHttpRequest] identifier[request] operator[=] identifier[SetDiskAutoDeleteInstanceHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setInstance] operator[SEP] identifier[instance] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instance] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setAutoDelete] operator[SEP] identifier[autoDelete] operator[SEP] operator[SEP] identifier[setDeviceName] operator[SEP] identifier[deviceName] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[setDiskAutoDeleteInstance] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public CandidateRating getCandidateRating(String candidateId) throws VoteSmartException, VoteSmartErrorException {
return api.query("Rating.getCandidateRating", new ArgMap("candidateId", candidateId), CandidateRating.class );
} | class class_name[name] begin[{]
method[getCandidateRating, return_type[type[CandidateRating]], modifier[public], parameter[candidateId]] begin[{]
return[call[api.query, parameter[literal["Rating.getCandidateRating"], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="candidateId"), MemberReference(member=candidateId, 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=ArgMap, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CandidateRating, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[CandidateRating] identifier[getCandidateRating] operator[SEP] identifier[String] identifier[candidateId] operator[SEP] Keyword[throws] identifier[VoteSmartException] , identifier[VoteSmartErrorException] {
Keyword[return] identifier[api] operator[SEP] identifier[query] operator[SEP] literal[String] , Keyword[new] identifier[ArgMap] operator[SEP] literal[String] , identifier[candidateId] operator[SEP] , identifier[CandidateRating] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static base_responses delete(nitro_service client, String filename[]) throws Exception {
base_responses result = null;
if (filename != null && filename.length > 0) {
systembackup deleteresources[] = new systembackup[filename.length];
for (int i=0;i<filename.length;i++){
deleteresources[i] = new systembackup();
deleteresources[i].filename = filename[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | class class_name[name] begin[{]
method[delete, return_type[type[base_responses]], modifier[public static], parameter[client, filename]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.filename], !=, literal[null]], &&, binary_operation[member[filename.length], >, literal[0]]]] begin[{]
local_variable[type[systembackup], deleteresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=systembackup, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=filename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=filename, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.result], call[.delete_bulk_request, parameter[member[.client], member[.deleteresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_responses] identifier[delete] operator[SEP] identifier[nitro_service] identifier[client] , identifier[String] identifier[filename] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[filename] operator[!=] Other[null] operator[&&] identifier[filename] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[systembackup] identifier[deleteresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[systembackup] operator[SEP] identifier[filename] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[filename] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[systembackup] operator[SEP] operator[SEP] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[filename] operator[=] identifier[filename] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[delete_bulk_request] operator[SEP] identifier[client] , identifier[deleteresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public ManParameter parseParams(List<String> input, int columns) {
out.add(argPad+ManParserUtil.convertStringToAnsi(input.get(0)));
input.remove(0);
if(!input.isEmpty()) {
StringBuilder builder = new StringBuilder();
for(String in : input) {
if(in.trim().length() > 0)
builder.append(in.trim()).append(' ');
}
if(builder.length() > 0) {
for(String s : Parser.splitBySizeKeepWords(builder.toString(), columns - textPad.length())) {
out.add(textPad+ManParserUtil.convertStringToAnsi(s));
}
}
//add an empty line at the bottom to create a line separator between params
if(out.size() > 0)
out.add(" ");
}
return this;
} | class class_name[name] begin[{]
method[parseParams, return_type[type[ManParameter]], modifier[public], parameter[input, columns]] begin[{]
call[out.add, parameter[binary_operation[member[.argPad], +, call[ManParserUtil.convertStringToAnsi, parameter[call[input.get, parameter[literal[0]]]]]]]]
call[input.remove, parameter[literal[0]]]
if[call[input.isEmpty, parameter[]]] begin[{]
local_variable[type[StringBuilder], builder]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=in)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[binary_operation[call[builder.length, parameter[]], >, literal[0]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=textPad, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertStringToAnsi, postfix_operators=[], prefix_operators=[], qualifier=ManParserUtil, selectors=[], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), BinaryOperation(operandl=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=textPad, selectors=[], type_arguments=None), operator=-)], member=splitBySizeKeepWords, postfix_operators=[], prefix_operators=[], qualifier=Parser, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[out.size, parameter[]], >, literal[0]]] begin[{]
call[out.add, parameter[literal[" "]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ManParameter] identifier[parseParams] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[input] , Keyword[int] identifier[columns] operator[SEP] {
identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[argPad] operator[+] identifier[ManParserUtil] operator[SEP] identifier[convertStringToAnsi] operator[SEP] identifier[input] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[input] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[in] operator[:] identifier[input] operator[SEP] {
Keyword[if] operator[SEP] identifier[in] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[in] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[builder] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[Parser] operator[SEP] identifier[splitBySizeKeepWords] operator[SEP] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[columns] operator[-] identifier[textPad] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[textPad] operator[+] identifier[ManParserUtil] operator[SEP] identifier[convertStringToAnsi] operator[SEP] identifier[s] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[out] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[out] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public String getString(final int index) {
try {
return statement.getString(index);
} catch (SQLException sex) {
throw newGetParamError(index, sex);
}
} | class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[index]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=statement, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newGetParamError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=sex, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[getString] operator[SEP] Keyword[final] Keyword[int] identifier[index] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[statement] operator[SEP] identifier[getString] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[sex] operator[SEP] {
Keyword[throw] identifier[newGetParamError] operator[SEP] identifier[index] , identifier[sex] operator[SEP] operator[SEP]
}
}
|
@Override
public String lastId(final RootDocument rootDocument) {
return lastId(mongoTemplate, FamilyDocumentMongo.class,
rootDocument.getFilename(), "F");
} | class class_name[name] begin[{]
method[lastId, return_type[type[String]], modifier[public], parameter[rootDocument]] begin[{]
return[call[.lastId, parameter[member[.mongoTemplate], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FamilyDocumentMongo, sub_type=None)), call[rootDocument.getFilename, parameter[]], literal["F"]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[lastId] operator[SEP] Keyword[final] identifier[RootDocument] identifier[rootDocument] operator[SEP] {
Keyword[return] identifier[lastId] operator[SEP] identifier[mongoTemplate] , identifier[FamilyDocumentMongo] operator[SEP] Keyword[class] , identifier[rootDocument] operator[SEP] identifier[getFilename] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public void script(final Tag tag, final CharSequence body) {
if (!insideConditionalComment) {
String src = Util.toString(tag.getAttributeValue("src"));
if (src == null) {
super.script(tag, body);
return;
}
if (jsBundleAction.acceptLink(src)) {
String link = jsBundleAction.processLink(src);
if (link != null) {
tag.setAttributeValue("src", link);
super.script(tag, body);
}
return;
}
}
super.script(tag, body);
} | class class_name[name] begin[{]
method[script, return_type[void], modifier[public], parameter[tag, body]] begin[{]
if[member[.insideConditionalComment]] begin[{]
local_variable[type[String], src]
if[binary_operation[member[.src], ==, literal[null]]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=script, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
return[None]
else begin[{]
None
end[}]
if[call[jsBundleAction.acceptLink, parameter[member[.src]]]] begin[{]
local_variable[type[String], link]
if[binary_operation[member[.link], !=, literal[null]]] begin[{]
call[tag.setAttributeValue, parameter[literal["src"], member[.link]]]
SuperMethodInvocation(arguments=[MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=script, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=script, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[script] operator[SEP] Keyword[final] identifier[Tag] identifier[tag] , Keyword[final] identifier[CharSequence] identifier[body] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[insideConditionalComment] operator[SEP] {
identifier[String] identifier[src] operator[=] identifier[Util] operator[SEP] identifier[toString] operator[SEP] identifier[tag] operator[SEP] identifier[getAttributeValue] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[src] operator[==] Other[null] operator[SEP] {
Keyword[super] operator[SEP] identifier[script] operator[SEP] identifier[tag] , identifier[body] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jsBundleAction] operator[SEP] identifier[acceptLink] operator[SEP] identifier[src] operator[SEP] operator[SEP] {
identifier[String] identifier[link] operator[=] identifier[jsBundleAction] operator[SEP] identifier[processLink] operator[SEP] identifier[src] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[link] operator[!=] Other[null] operator[SEP] {
identifier[tag] operator[SEP] identifier[setAttributeValue] operator[SEP] literal[String] , identifier[link] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[script] operator[SEP] identifier[tag] , identifier[body] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
}
Keyword[super] operator[SEP] identifier[script] operator[SEP] identifier[tag] , identifier[body] operator[SEP] operator[SEP]
}
|
public static String getRevisionIdSuffix(String revId) {
validateRevisionId(revId);
int dashPos = revId.indexOf("-");
if (dashPos >= 0) {
return revId.substring(dashPos + 1);
} else {
throw new IllegalStateException("The revId id should be valid: " + revId);
}
} | class class_name[name] begin[{]
method[getRevisionIdSuffix, return_type[type[String]], modifier[public static], parameter[revId]] begin[{]
call[.validateRevisionId, parameter[member[.revId]]]
local_variable[type[int], dashPos]
if[binary_operation[member[.dashPos], >=, literal[0]]] begin[{]
return[call[revId.substring, parameter[binary_operation[member[.dashPos], +, literal[1]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The revId id should be valid: "), operandr=MemberReference(member=revId, 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=IllegalStateException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getRevisionIdSuffix] operator[SEP] identifier[String] identifier[revId] operator[SEP] {
identifier[validateRevisionId] operator[SEP] identifier[revId] operator[SEP] operator[SEP] Keyword[int] identifier[dashPos] operator[=] identifier[revId] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dashPos] operator[>=] Other[0] operator[SEP] {
Keyword[return] identifier[revId] operator[SEP] identifier[substring] operator[SEP] identifier[dashPos] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[revId] operator[SEP] operator[SEP]
}
}
|
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.GCHST__XPOS:
setXPOS((Integer)newValue);
return;
case AfplibPackage.GCHST__YPOS:
setYPOS((Integer)newValue);
return;
case AfplibPackage.GCHST__CP:
setCP((String)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=GCHST__XPOS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setXPOS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCHST__YPOS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setYPOS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCHST__CP, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=setCP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCHST__XPOS] operator[:] identifier[setXPOS] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCHST__YPOS] operator[:] identifier[setYPOS] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCHST__CP] operator[:] identifier[setCP] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
public void run() {
AbstractKVStorable[] linkData = bucket.getBackend(); // get all LinkData
long startTime = System.nanoTime(); // remember the, time when synchronizing is started (for logging)
log.debug("Start to synchronize {} objects.", linkData.length);
try {
String filename = buffer.bucketContainer.getHashFunction().getFilename(bucket.getBucketId());
String directoryName = buffer.getPathToDbFiles();
Synchronizer<Data> synchronizer = synchronizerFactory
.createSynchronizer(directoryName + "/" + filename, gp);
synchronizer.upsert(linkData); // start synchronizing
actualProcessingBuckets.remove(bucket);
freeMemory(bucket);
synchronizer.close();
log.debug("Synchronized {} objects in {} ms.", linkData.length, ((System.nanoTime() - startTime) / 1e6));
/* update messages */
buffer.sumUpInserted(synchronizer.getNumberOfInsertedEntries());
buffer.sumUpUpdated(synchronizer.getNumberOfUpdatedEntries());
} catch (Exception ex) {
log.error("An error occurred during synchronizing. Synchronizing thread stopped! Some data was lost", ex);
freeMemory(bucket);
actualProcessingBuckets.remove(bucket);
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[AbstractKVStorable], linkData]
local_variable[type[long], startTime]
call[log.debug, parameter[literal["Start to synchronize {} objects."], member[linkData.length]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHashFunction, postfix_operators=[], prefix_operators=[], qualifier=buffer.bucketContainer, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBucketId, postfix_operators=[], prefix_operators=[], qualifier=bucket, selectors=[], type_arguments=None)], member=getFilename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=filename)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPathToDbFiles, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), name=directoryName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=directoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=gp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSynchronizer, postfix_operators=[], prefix_operators=[], qualifier=synchronizerFactory, selectors=[], type_arguments=None), name=synchronizer)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Data, sub_type=None))], dimensions=[], name=Synchronizer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=linkData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=upsert, postfix_operators=[], prefix_operators=[], qualifier=synchronizer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=actualProcessingBuckets, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=freeMemory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=synchronizer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Synchronized {} objects in {} ms."), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=linkData, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=nanoTime, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=startTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1e6), operator=/)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNumberOfInsertedEntries, postfix_operators=[], prefix_operators=[], qualifier=synchronizer, selectors=[], type_arguments=None)], member=sumUpInserted, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNumberOfUpdatedEntries, postfix_operators=[], prefix_operators=[], qualifier=synchronizer, selectors=[], type_arguments=None)], member=sumUpUpdated, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An error occurred during synchronizing. Synchronizing thread stopped! Some data was lost"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=freeMemory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=actualProcessingBuckets, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[AbstractKVStorable] operator[SEP] operator[SEP] identifier[linkData] operator[=] identifier[bucket] operator[SEP] identifier[getBackend] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[startTime] operator[=] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[linkData] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[try] {
identifier[String] identifier[filename] operator[=] identifier[buffer] operator[SEP] identifier[bucketContainer] operator[SEP] identifier[getHashFunction] operator[SEP] operator[SEP] operator[SEP] identifier[getFilename] operator[SEP] identifier[bucket] operator[SEP] identifier[getBucketId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[directoryName] operator[=] identifier[buffer] operator[SEP] identifier[getPathToDbFiles] operator[SEP] operator[SEP] operator[SEP] identifier[Synchronizer] operator[<] identifier[Data] operator[>] identifier[synchronizer] operator[=] identifier[synchronizerFactory] operator[SEP] identifier[createSynchronizer] operator[SEP] identifier[directoryName] operator[+] literal[String] operator[+] identifier[filename] , identifier[gp] operator[SEP] operator[SEP] identifier[synchronizer] operator[SEP] identifier[upsert] operator[SEP] identifier[linkData] operator[SEP] operator[SEP] identifier[actualProcessingBuckets] operator[SEP] identifier[remove] operator[SEP] identifier[bucket] operator[SEP] operator[SEP] identifier[freeMemory] operator[SEP] identifier[bucket] operator[SEP] operator[SEP] identifier[synchronizer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[linkData] operator[SEP] identifier[length] , operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[-] identifier[startTime] operator[SEP] operator[/] literal[Float] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[sumUpInserted] operator[SEP] identifier[synchronizer] operator[SEP] identifier[getNumberOfInsertedEntries] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[sumUpUpdated] operator[SEP] identifier[synchronizer] operator[SEP] identifier[getNumberOfUpdatedEntries] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP] identifier[freeMemory] operator[SEP] identifier[bucket] operator[SEP] operator[SEP] identifier[actualProcessingBuckets] operator[SEP] identifier[remove] operator[SEP] identifier[bucket] operator[SEP] operator[SEP]
}
}
|
public static Predicate<RepositoryConfiguration> withExternalScmRepoUrl(String externalScmRepoUrl) {
String urlStripped = StringUtils.stripSuffix(UrlUtils.keepHostAndPathOnly(externalScmRepoUrl), ".git");
return (root, query, cb) -> cb.equal(root.get(RepositoryConfiguration_.externalUrlNormalized), urlStripped);
} | class class_name[name] begin[{]
method[withExternalScmRepoUrl, return_type[type[Predicate]], modifier[public static], parameter[externalScmRepoUrl]] begin[{]
local_variable[type[String], urlStripped]
return[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=externalUrlNormalized, postfix_operators=[], prefix_operators=[], qualifier=RepositoryConfiguration_, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=root, selectors=[], type_arguments=None), MemberReference(member=urlStripped, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal, postfix_operators=[], prefix_operators=[], qualifier=cb, selectors=[], type_arguments=None), parameters=[InferredFormalParameter(name=root), InferredFormalParameter(name=query), InferredFormalParameter(name=cb)])]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Predicate] operator[<] identifier[RepositoryConfiguration] operator[>] identifier[withExternalScmRepoUrl] operator[SEP] identifier[String] identifier[externalScmRepoUrl] operator[SEP] {
identifier[String] identifier[urlStripped] operator[=] identifier[StringUtils] operator[SEP] identifier[stripSuffix] operator[SEP] identifier[UrlUtils] operator[SEP] identifier[keepHostAndPathOnly] operator[SEP] identifier[externalScmRepoUrl] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[root] , identifier[query] , identifier[cb] operator[SEP] operator[->] identifier[cb] operator[SEP] identifier[equal] operator[SEP] identifier[root] operator[SEP] identifier[get] operator[SEP] identifier[RepositoryConfiguration_] operator[SEP] identifier[externalUrlNormalized] operator[SEP] , identifier[urlStripped] operator[SEP] operator[SEP]
}
|
public long skip(final long n) throws IOException {
if (remaining == 0) {
startChunk();
}
if (remaining < 1) {
return 0;
}
final long toSkip = n < remaining ? n : remaining;
final long ret = input.skip(toSkip);
this.remaining = remaining - (int) ret;
return ret;
} | class class_name[name] begin[{]
method[skip, return_type[type[long]], modifier[public], parameter[n]] begin[{]
if[binary_operation[member[.remaining], ==, literal[0]]] begin[{]
call[.startChunk, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.remaining], <, literal[1]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[long], toSkip]
local_variable[type[long], ret]
assign[THIS[member[None.remaining]], binary_operation[member[.remaining], -, Cast(expression=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[skip] operator[SEP] Keyword[final] Keyword[long] identifier[n] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[remaining] operator[==] Other[0] operator[SEP] {
identifier[startChunk] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[remaining] operator[<] Other[1] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[final] Keyword[long] identifier[toSkip] operator[=] identifier[n] operator[<] identifier[remaining] operator[?] identifier[n] operator[:] identifier[remaining] operator[SEP] Keyword[final] Keyword[long] identifier[ret] operator[=] identifier[input] operator[SEP] identifier[skip] operator[SEP] identifier[toSkip] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[remaining] operator[=] identifier[remaining] operator[-] operator[SEP] Keyword[int] operator[SEP] identifier[ret] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public static Throwable unwrap(Throwable t) {
for (;;) {
if (t == null)
throw new NullPointerException();
if (t instanceof java.util.concurrent.ExecutionException)
t = t.getCause();
else if (t instanceof java.lang.reflect.InvocationTargetException)
t = t.getCause();
else if (t.getClass().equals(RuntimeException.class) && t.getCause() != null)
t = t.getCause();
else
return t;
}
} | class class_name[name] begin[{]
method[unwrap, return_type[type[Throwable]], modifier[public static], parameter[t]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=None, dimensions=None, name=concurrent, sub_type=ReferenceType(arguments=None, dimensions=None, name=ExecutionException, sub_type=None)))), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=reflect, sub_type=ReferenceType(arguments=None, dimensions=None, name=InvocationTargetException, sub_type=None)))), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None))], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=ReturnStatement(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)), label=None))]), control=ForControl(condition=None, init=None, update=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Throwable] identifier[unwrap] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[concurrent] operator[SEP] identifier[ExecutionException] operator[SEP] identifier[t] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[reflect] operator[SEP] identifier[InvocationTargetException] operator[SEP] identifier[t] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[RuntimeException] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[t] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[t] operator[SEP]
}
}
|
@NonNull
public static PaymentIntentParams createConfirmPaymentIntentWithSourceIdParams(
@Nullable String sourceId,
@NonNull String clientSecret,
@NonNull String returnUrl,
boolean savePaymentMethod) {
return new PaymentIntentParams()
.setSourceId(sourceId)
.setClientSecret(clientSecret)
.setReturnUrl(returnUrl)
.setSavePaymentMethod(savePaymentMethod);
} | class class_name[name] begin[{]
method[createConfirmPaymentIntentWithSourceIdParams, return_type[type[PaymentIntentParams]], modifier[public static], parameter[sourceId, clientSecret, returnUrl, savePaymentMethod]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=sourceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSourceId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=clientSecret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setClientSecret, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=returnUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setReturnUrl, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=savePaymentMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSavePaymentMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PaymentIntentParams, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] Keyword[static] identifier[PaymentIntentParams] identifier[createConfirmPaymentIntentWithSourceIdParams] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[sourceId] , annotation[@] identifier[NonNull] identifier[String] identifier[clientSecret] , annotation[@] identifier[NonNull] identifier[String] identifier[returnUrl] , Keyword[boolean] identifier[savePaymentMethod] operator[SEP] {
Keyword[return] Keyword[new] identifier[PaymentIntentParams] operator[SEP] operator[SEP] operator[SEP] identifier[setSourceId] operator[SEP] identifier[sourceId] operator[SEP] operator[SEP] identifier[setClientSecret] operator[SEP] identifier[clientSecret] operator[SEP] operator[SEP] identifier[setReturnUrl] operator[SEP] identifier[returnUrl] operator[SEP] operator[SEP] identifier[setSavePaymentMethod] operator[SEP] identifier[savePaymentMethod] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.