code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static <V> Fiber<V> unparkSerialized(byte[] serFiber, FiberScheduler scheduler) {
return Fiber.unparkSerialized(serFiber, scheduler);
} | class class_name[name] begin[{]
method[unparkSerialized, return_type[type[Fiber]], modifier[public static], parameter[serFiber, scheduler]] begin[{]
return[call[Fiber.unparkSerialized, parameter[member[.serFiber], member[.scheduler]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] operator[>] identifier[Fiber] operator[<] identifier[V] operator[>] identifier[unparkSerialized] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[serFiber] , identifier[FiberScheduler] identifier[scheduler] operator[SEP] {
Keyword[return] identifier[Fiber] operator[SEP] identifier[unparkSerialized] operator[SEP] identifier[serFiber] , identifier[scheduler] operator[SEP] operator[SEP]
}
|
public GBIMGRES createGBIMGRESFromString(EDataType eDataType, String initialValue) {
GBIMGRES result = GBIMGRES.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createGBIMGRESFromString, return_type[type[GBIMGRES]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[GBIMGRES], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[GBIMGRES] identifier[createGBIMGRESFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[GBIMGRES] identifier[result] operator[=] identifier[GBIMGRES] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public void remove(String name)
throws IOException, IllegalArgumentException {
checkWritable();
final FatLfnDirectoryEntry entry = getEntry(name);
if (entry == null) return;
unlinkEntry(entry);
final ClusterChain cc = new ClusterChain(
fat, entry.realEntry.getStartCluster(), false);
cc.setChainLength(0);
updateLFN();
} | class class_name[name] begin[{]
method[remove, return_type[void], modifier[public], parameter[name]] begin[{]
call[.checkWritable, parameter[]]
local_variable[type[FatLfnDirectoryEntry], entry]
if[binary_operation[member[.entry], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.unlinkEntry, parameter[member[.entry]]]
local_variable[type[ClusterChain], cc]
call[cc.setChainLength, parameter[literal[0]]]
call[.updateLFN, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[remove] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[IOException] , identifier[IllegalArgumentException] {
identifier[checkWritable] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[FatLfnDirectoryEntry] identifier[entry] operator[=] identifier[getEntry] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[unlinkEntry] operator[SEP] identifier[entry] operator[SEP] operator[SEP] Keyword[final] identifier[ClusterChain] identifier[cc] operator[=] Keyword[new] identifier[ClusterChain] operator[SEP] identifier[fat] , identifier[entry] operator[SEP] identifier[realEntry] operator[SEP] identifier[getStartCluster] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[cc] operator[SEP] identifier[setChainLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[updateLFN] operator[SEP] operator[SEP] operator[SEP]
}
|
public String[] split(String str, String regex, int limit) {
return str.split(regex, limit);
} | class class_name[name] begin[{]
method[split, return_type[type[String]], modifier[public], parameter[str, regex, limit]] begin[{]
return[call[str.split, parameter[member[.regex], member[.limit]]]]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[String] identifier[str] , identifier[String] identifier[regex] , Keyword[int] identifier[limit] operator[SEP] {
Keyword[return] identifier[str] operator[SEP] identifier[split] operator[SEP] identifier[regex] , identifier[limit] operator[SEP] operator[SEP]
}
|
@Override
public Collection duplicate(boolean deepCopy) {
new ArrayImpl().duplicate(deepCopy);
return new ListAsArray((List) Duplicator.duplicate(list, deepCopy));
} | class class_name[name] begin[{]
method[duplicate, return_type[type[Collection]], modifier[public], parameter[deepCopy]] begin[{]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=deepCopy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=duplicate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ArrayImpl, sub_type=None))
return[ClassCreator(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=deepCopy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=duplicate, postfix_operators=[], prefix_operators=[], qualifier=Duplicator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ListAsArray, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Collection] identifier[duplicate] operator[SEP] Keyword[boolean] identifier[deepCopy] operator[SEP] {
Keyword[new] identifier[ArrayImpl] operator[SEP] operator[SEP] operator[SEP] identifier[duplicate] operator[SEP] identifier[deepCopy] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ListAsArray] operator[SEP] operator[SEP] identifier[List] operator[SEP] identifier[Duplicator] operator[SEP] identifier[duplicate] operator[SEP] identifier[list] , identifier[deepCopy] operator[SEP] operator[SEP] operator[SEP]
}
|
private static <T> List<T> unmodifiableList(List<T> list) {
if (list == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(list);
} | class class_name[name] begin[{]
method[unmodifiableList, return_type[type[List]], modifier[private static], parameter[list]] begin[{]
if[binary_operation[member[.list], ==, literal[null]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
return[call[Collections.unmodifiableList, parameter[member[.list]]]]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[unmodifiableList] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[SEP] {
Keyword[if] operator[SEP] identifier[list] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[list] operator[SEP] operator[SEP]
}
|
public BaseDescr declare( PackageDescrBuilder pkg ) throws RecognitionException {
BaseDescr declaration = null;
try {
DeclareDescrBuilder declare = helper.start( pkg,
DeclareDescrBuilder.class,
null );
// 'declare'
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.DECLARE,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
if ( helper.validateIdentifierKey( DroolsSoftKeywords.ENTRY ) ) {
// entry point declaration
declaration = entryPointDeclaration( declare );
} else if( helper.validateIdentifierKey( DroolsSoftKeywords.WINDOW ) ) {
// window declaration
declaration = windowDeclaration( declare );
} else if ( helper.validateIdentifierKey( DroolsSoftKeywords.TRAIT ) ) {
// trait type declaration
// 'trait'
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.TRAIT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
declaration = typeDeclaration( declare, true );
} else if ( helper.validateIdentifierKey( DroolsSoftKeywords.ENUM ) ) {
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.ENUM,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
declaration = enumDeclaration( declare );
} else {
// class type declaration
declaration = typeDeclaration( declare, false );
}
} catch ( RecognitionException re ) {
reportError( re );
}
return declaration;
} | class class_name[name] begin[{]
method[declare, return_type[type[BaseDescr]], modifier[public], parameter[pkg]] begin[{]
local_variable[type[BaseDescr], declaration]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pkg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeclareDescrBuilder, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=start, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), name=declare)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DeclareDescrBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL5Lexer, selectors=[]), MemberReference(member=DECLARE, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=KEYWORD, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ENTRY, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=WINDOW, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TRAIT, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ENUM, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=declare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=typeDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL5Lexer, selectors=[]), MemberReference(member=ENUM, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=KEYWORD, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=declare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=enumDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL5Lexer, selectors=[]), MemberReference(member=TRAIT, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=KEYWORD, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=declare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=typeDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=declare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=windowDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=declaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=declare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=entryPointDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=None, label=None, resources=None)
return[member[.declaration]]
end[}]
END[}] | Keyword[public] identifier[BaseDescr] identifier[declare] operator[SEP] identifier[PackageDescrBuilder] identifier[pkg] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[BaseDescr] identifier[declaration] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[DeclareDescrBuilder] identifier[declare] operator[=] identifier[helper] operator[SEP] identifier[start] operator[SEP] identifier[pkg] , identifier[DeclareDescrBuilder] operator[SEP] Keyword[class] , Other[null] operator[SEP] operator[SEP] identifier[match] operator[SEP] identifier[input] , identifier[DRL5Lexer] operator[SEP] identifier[ID] , identifier[DroolsSoftKeywords] operator[SEP] identifier[DECLARE] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[KEYWORD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[ENTRY] operator[SEP] operator[SEP] {
identifier[declaration] operator[=] identifier[entryPointDeclaration] operator[SEP] identifier[declare] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[WINDOW] operator[SEP] operator[SEP] {
identifier[declaration] operator[=] identifier[windowDeclaration] operator[SEP] identifier[declare] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[TRAIT] operator[SEP] operator[SEP] {
identifier[match] operator[SEP] identifier[input] , identifier[DRL5Lexer] operator[SEP] identifier[ID] , identifier[DroolsSoftKeywords] operator[SEP] identifier[TRAIT] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[KEYWORD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[declaration] operator[=] identifier[typeDeclaration] operator[SEP] identifier[declare] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[ENUM] operator[SEP] operator[SEP] {
identifier[match] operator[SEP] identifier[input] , identifier[DRL5Lexer] operator[SEP] identifier[ID] , identifier[DroolsSoftKeywords] operator[SEP] identifier[ENUM] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[KEYWORD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[declaration] operator[=] identifier[enumDeclaration] operator[SEP] identifier[declare] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[declaration] operator[=] identifier[typeDeclaration] operator[SEP] identifier[declare] , literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP]
}
Keyword[return] identifier[declaration] operator[SEP]
}
|
public static void setValue(Object target, String dPath, Object value) {
setValue(target, dPath, value, false);
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[public static], parameter[target, dPath, value]] begin[{]
call[.setValue, parameter[member[.target], member[.dPath], member[.value], literal[false]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setValue] operator[SEP] identifier[Object] identifier[target] , identifier[String] identifier[dPath] , identifier[Object] identifier[value] operator[SEP] {
identifier[setValue] operator[SEP] identifier[target] , identifier[dPath] , identifier[value] , literal[boolean] operator[SEP] operator[SEP]
}
|
public float getHalfWave() throws IOException
{
while (true)
{
int sample = getSample();
if (frequencyCounter.update(sample))
{
return frequencyCounter.getFrequency();
}
}
} | class class_name[name] begin[{]
method[getHalfWave, return_type[type[float]], modifier[public], parameter[]] begin[{]
while[literal[true]] begin[{]
local_variable[type[int], sample]
if[call[frequencyCounter.update, parameter[member[.sample]]]] begin[{]
return[call[frequencyCounter.getFrequency, parameter[]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[float] identifier[getHalfWave] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[sample] operator[=] identifier[getSample] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[frequencyCounter] operator[SEP] identifier[update] operator[SEP] identifier[sample] operator[SEP] operator[SEP] {
Keyword[return] identifier[frequencyCounter] operator[SEP] identifier[getFrequency] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void handleArgNice(final Deque<String> args) {
final String value = args.pop();
if (value == null) {
throw new BuildException("You must supply a niceness value (1-10) after the --nice option");
}
try {
threadPriority = Integer.decode(value);
} catch (final NumberFormatException e) {
throw new BuildException("Unrecognized niceness value: " + value);
}
if (threadPriority < Thread.MIN_PRIORITY || threadPriority > Thread.MAX_PRIORITY) {
throw new BuildException("Niceness value is out of the range 1-10");
}
} | class class_name[name] begin[{]
method[handleArgNice, return_type[void], modifier[private], parameter[args]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You must supply a niceness value (1-10) after the --nice option")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BuildException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=threadPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unrecognized niceness value: "), operandr=MemberReference(member=value, 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=BuildException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
if[binary_operation[binary_operation[member[.threadPriority], <, member[Thread.MIN_PRIORITY]], ||, binary_operation[member[.threadPriority], >, member[Thread.MAX_PRIORITY]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Niceness value is out of the range 1-10")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BuildException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleArgNice] operator[SEP] Keyword[final] identifier[Deque] operator[<] identifier[String] operator[>] identifier[args] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[args] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BuildException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[threadPriority] operator[=] identifier[Integer] operator[SEP] identifier[decode] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BuildException] operator[SEP] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[threadPriority] operator[<] identifier[Thread] operator[SEP] identifier[MIN_PRIORITY] operator[||] identifier[threadPriority] operator[>] identifier[Thread] operator[SEP] identifier[MAX_PRIORITY] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BuildException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
@Override
public String getPath() {
// We need to URL encode '+'s to work around an S3 bug
// (Cf. https://forums.aws.amazon.com/thread.jspa?threadID=55746)
return PAIRTREE_ROOT + PATH_SEP + PairtreeUtils.mapToPtPath(myID).replace(UNENCODED_PLUS, ENCODED_PLUS) +
PATH_SEP + PairtreeUtils.encodeID(myID).replace(UNENCODED_PLUS, ENCODED_PLUS);
} | class class_name[name] begin[{]
method[getPath, return_type[type[String]], modifier[public], parameter[]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.PAIRTREE_ROOT], +, member[.PATH_SEP]], +, call[PairtreeUtils.mapToPtPath, parameter[member[.myID]]]], +, member[.PATH_SEP]], +, call[PairtreeUtils.encodeID, parameter[member[.myID]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getPath] operator[SEP] operator[SEP] {
Keyword[return] identifier[PAIRTREE_ROOT] operator[+] identifier[PATH_SEP] operator[+] identifier[PairtreeUtils] operator[SEP] identifier[mapToPtPath] operator[SEP] identifier[myID] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[UNENCODED_PLUS] , identifier[ENCODED_PLUS] operator[SEP] operator[+] identifier[PATH_SEP] operator[+] identifier[PairtreeUtils] operator[SEP] identifier[encodeID] operator[SEP] identifier[myID] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[UNENCODED_PLUS] , identifier[ENCODED_PLUS] operator[SEP] operator[SEP]
}
|
public INDArray getWordVectorMatrixNormalized(String word) {
INDArray r = getWordVectorMatrix(word);
if (r == null)
return null;
return r.div(Nd4j.getBlasWrapper().nrm2(r));
} | class class_name[name] begin[{]
method[getWordVectorMatrixNormalized, return_type[type[INDArray]], modifier[public], parameter[word]] begin[{]
local_variable[type[INDArray], r]
if[binary_operation[member[.r], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[r.div, parameter[call[Nd4j.getBlasWrapper, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[INDArray] identifier[getWordVectorMatrixNormalized] operator[SEP] identifier[String] identifier[word] operator[SEP] {
identifier[INDArray] identifier[r] operator[=] identifier[getWordVectorMatrix] operator[SEP] identifier[word] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[r] operator[SEP] identifier[div] operator[SEP] identifier[Nd4j] operator[SEP] identifier[getBlasWrapper] operator[SEP] operator[SEP] operator[SEP] identifier[nrm2] operator[SEP] identifier[r] operator[SEP] operator[SEP] operator[SEP]
}
|
public Date getPublishDateTime() {
if (getPublishDate() == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(getPublishDate());
cal.set(Calendar.HOUR, getPublishHour());
cal.set(Calendar.MINUTE, getPublishMinute());
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.AM_PM, getPublishAmPm());
return cal.getTime();
} | class class_name[name] begin[{]
method[getPublishDateTime, return_type[type[Date]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[.getPublishDate, parameter[]], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Calendar], cal]
call[cal.setTime, parameter[call[.getPublishDate, parameter[]]]]
call[cal.set, parameter[member[Calendar.HOUR], call[.getPublishHour, parameter[]]]]
call[cal.set, parameter[member[Calendar.MINUTE], call[.getPublishMinute, parameter[]]]]
call[cal.set, parameter[member[Calendar.SECOND], literal[0]]]
call[cal.set, parameter[member[Calendar.MILLISECOND], literal[0]]]
call[cal.set, parameter[member[Calendar.AM_PM], call[.getPublishAmPm, parameter[]]]]
return[call[cal.getTime, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[Date] identifier[getPublishDateTime] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getPublishDate] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Calendar] identifier[cal] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[setTime] operator[SEP] identifier[getPublishDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR] , identifier[getPublishHour] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , identifier[getPublishMinute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[AM_PM] , identifier[getPublishAmPm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cal] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
|
private void keys(RedBlackTreeNode<Key, Value> x, Queue<Key> queue, Key lo, Key hi) {
if (x == null)
return;
int cmplo = lo.compareTo(x.getKey());
int cmphi = hi.compareTo(x.getKey());
if (cmplo < 0)
keys(x.getLeft(), queue, lo, hi);
if (cmplo <= 0 && cmphi >= 0)
queue.offer(x.getKey());
if (cmphi > 0)
keys(x.getRight(), queue, lo, hi);
} | class class_name[name] begin[{]
method[keys, return_type[void], modifier[private], parameter[x, queue, lo, hi]] begin[{]
if[binary_operation[member[.x], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], cmplo]
local_variable[type[int], cmphi]
if[binary_operation[member[.cmplo], <, literal[0]]] begin[{]
call[.keys, parameter[call[x.getLeft, parameter[]], member[.queue], member[.lo], member[.hi]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.cmplo], <=, literal[0]], &&, binary_operation[member[.cmphi], >=, literal[0]]]] begin[{]
call[queue.offer, parameter[call[x.getKey, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.cmphi], >, literal[0]]] begin[{]
call[.keys, parameter[call[x.getRight, parameter[]], member[.queue], member[.lo], member[.hi]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[keys] operator[SEP] identifier[RedBlackTreeNode] operator[<] identifier[Key] , identifier[Value] operator[>] identifier[x] , identifier[Queue] operator[<] identifier[Key] operator[>] identifier[queue] , identifier[Key] identifier[lo] , identifier[Key] identifier[hi] operator[SEP] {
Keyword[if] operator[SEP] identifier[x] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] Keyword[int] identifier[cmplo] operator[=] identifier[lo] operator[SEP] identifier[compareTo] operator[SEP] identifier[x] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[cmphi] operator[=] identifier[hi] operator[SEP] identifier[compareTo] operator[SEP] identifier[x] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmplo] operator[<] Other[0] operator[SEP] identifier[keys] operator[SEP] identifier[x] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] , identifier[queue] , identifier[lo] , identifier[hi] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmplo] operator[<=] Other[0] operator[&&] identifier[cmphi] operator[>=] Other[0] operator[SEP] identifier[queue] operator[SEP] identifier[offer] operator[SEP] identifier[x] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmphi] operator[>] Other[0] operator[SEP] identifier[keys] operator[SEP] identifier[x] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] , identifier[queue] , identifier[lo] , identifier[hi] operator[SEP] operator[SEP]
}
|
@Override
public Container getEnclosingContainer() {
com.ibm.wsspi.artifact.ArtifactContainer parent = delegate.getEnclosingContainer();
if (parent != null) {
//we are an entry, and will always have an owning container..
//we dont need to worry about fake root transitions here.
return new InterpretedContainerImpl(delegate.getEnclosingContainer(), root, rootOverlay, factoryHolder, structureHelper, structureHelperLocalRootDelegate);
} else
return null;
} | class class_name[name] begin[{]
method[getEnclosingContainer, return_type[type[Container]], modifier[public], parameter[]] begin[{]
local_variable[type[com], parent]
if[binary_operation[member[.parent], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getEnclosingContainer, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), MemberReference(member=root, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rootOverlay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=factoryHolder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=structureHelper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=structureHelperLocalRootDelegate, 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=InterpretedContainerImpl, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Container] identifier[getEnclosingContainer] operator[SEP] operator[SEP] {
identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[wsspi] operator[SEP] identifier[artifact] operator[SEP] identifier[ArtifactContainer] identifier[parent] operator[=] identifier[delegate] operator[SEP] identifier[getEnclosingContainer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[InterpretedContainerImpl] operator[SEP] identifier[delegate] operator[SEP] identifier[getEnclosingContainer] operator[SEP] operator[SEP] , identifier[root] , identifier[rootOverlay] , identifier[factoryHolder] , identifier[structureHelper] , identifier[structureHelperLocalRootDelegate] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[return] Other[null] operator[SEP]
}
|
public int getColumnIndex(String columnName) {
Integer index = nameToIndex.get(columnName);
if (index == null) {
throw new GeoPackageException("Column does not exist in table '"
+ tableName + "', column: " + columnName);
}
return index;
} | class class_name[name] begin[{]
method[getColumnIndex, return_type[type[int]], modifier[public], parameter[columnName]] begin[{]
local_variable[type[Integer], index]
if[binary_operation[member[.index], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Column does not exist in table '"), operandr=MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="', column: "), operator=+), operandr=MemberReference(member=columnName, 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=GeoPackageException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.index]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getColumnIndex] operator[SEP] identifier[String] identifier[columnName] operator[SEP] {
identifier[Integer] identifier[index] operator[=] identifier[nameToIndex] operator[SEP] identifier[get] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[tableName] operator[+] literal[String] operator[+] identifier[columnName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[index] operator[SEP]
}
|
public void unregister(ExecutionVertexID vertexId, Task task) {
final Environment environment = task.getEnvironment();
// destroy and remove OUTPUT channels from registered channels and cache
for (ChannelID id : environment.getOutputChannelIDs()) {
Channel channel = this.channels.remove(id);
if (channel != null) {
channel.destroy();
}
this.receiverCache.remove(channel);
}
// destroy and remove INPUT channels from registered channels and cache
for (ChannelID id : environment.getInputChannelIDs()) {
Channel channel = this.channels.remove(id);
if (channel != null) {
channel.destroy();
}
this.receiverCache.remove(channel);
}
// clear and remove INPUT side buffer pools
for (GateID id : environment.getInputGateIDs()) {
LocalBufferPoolOwner bufferPool = this.localBuffersPools.remove(id);
if (bufferPool != null) {
bufferPool.clearLocalBufferPool();
}
}
// clear and remove OUTPUT side buffer pool
LocalBufferPoolOwner bufferPool = this.localBuffersPools.remove(vertexId);
if (bufferPool != null) {
bufferPool.clearLocalBufferPool();
}
// the number of channels per buffers has changed after unregistering the task
// => redistribute the number of designated buffers of the registered local buffer pools
redistributeBuffers();
} | class class_name[name] begin[{]
method[unregister, return_type[void], modifier[public], parameter[vertexId, task]] begin[{]
local_variable[type[Environment], environment]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=channels, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=channel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=receiverCache, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getOutputChannelIDs, postfix_operators=[], prefix_operators=[], qualifier=environment, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelID, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=channels, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=channel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=receiverCache, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInputChannelIDs, postfix_operators=[], prefix_operators=[], qualifier=environment, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelID, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=localBuffersPools, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=bufferPool)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocalBufferPoolOwner, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bufferPool, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearLocalBufferPool, postfix_operators=[], prefix_operators=[], qualifier=bufferPool, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInputGateIDs, postfix_operators=[], prefix_operators=[], qualifier=environment, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GateID, sub_type=None))), label=None)
local_variable[type[LocalBufferPoolOwner], bufferPool]
if[binary_operation[member[.bufferPool], !=, literal[null]]] begin[{]
call[bufferPool.clearLocalBufferPool, parameter[]]
else begin[{]
None
end[}]
call[.redistributeBuffers, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[unregister] operator[SEP] identifier[ExecutionVertexID] identifier[vertexId] , identifier[Task] identifier[task] operator[SEP] {
Keyword[final] identifier[Environment] identifier[environment] operator[=] identifier[task] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ChannelID] identifier[id] operator[:] identifier[environment] operator[SEP] identifier[getOutputChannelIDs] operator[SEP] operator[SEP] operator[SEP] {
identifier[Channel] identifier[channel] operator[=] Keyword[this] operator[SEP] identifier[channels] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[channel] operator[!=] Other[null] operator[SEP] {
identifier[channel] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[receiverCache] operator[SEP] identifier[remove] operator[SEP] identifier[channel] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ChannelID] identifier[id] operator[:] identifier[environment] operator[SEP] identifier[getInputChannelIDs] operator[SEP] operator[SEP] operator[SEP] {
identifier[Channel] identifier[channel] operator[=] Keyword[this] operator[SEP] identifier[channels] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[channel] operator[!=] Other[null] operator[SEP] {
identifier[channel] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[receiverCache] operator[SEP] identifier[remove] operator[SEP] identifier[channel] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[GateID] identifier[id] operator[:] identifier[environment] operator[SEP] identifier[getInputGateIDs] operator[SEP] operator[SEP] operator[SEP] {
identifier[LocalBufferPoolOwner] identifier[bufferPool] operator[=] Keyword[this] operator[SEP] identifier[localBuffersPools] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bufferPool] operator[!=] Other[null] operator[SEP] {
identifier[bufferPool] operator[SEP] identifier[clearLocalBufferPool] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[LocalBufferPoolOwner] identifier[bufferPool] operator[=] Keyword[this] operator[SEP] identifier[localBuffersPools] operator[SEP] identifier[remove] operator[SEP] identifier[vertexId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bufferPool] operator[!=] Other[null] operator[SEP] {
identifier[bufferPool] operator[SEP] identifier[clearLocalBufferPool] operator[SEP] operator[SEP] operator[SEP]
}
identifier[redistributeBuffers] operator[SEP] operator[SEP] operator[SEP]
}
|
private final static Func1<WatchEvent<?>, Boolean> onlyRelatedTo(final File file) {
return new Func1<WatchEvent<?>, Boolean>() {
@Override
public Boolean call(WatchEvent<?> event) {
final boolean ok;
if (file.isDirectory())
ok = true;
else if (StandardWatchEventKinds.OVERFLOW.equals(event.kind()))
ok = true;
else {
Object context = event.context();
if (context != null && context instanceof Path) {
Path p = (Path) context;
Path basePath = getBasePath(file);
File pFile = new File(basePath.toFile(), p.toString());
ok = pFile.getAbsolutePath().equals(file.getAbsolutePath());
} else
ok = false;
}
return ok;
}
};
} | class class_name[name] begin[{]
method[onlyRelatedTo, return_type[type[Func1]], modifier[final private static], parameter[file]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=ok)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=kind, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=StandardWatchEventKinds.OVERFLOW, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=context, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), name=context)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None), operator=instanceof), operator=&&), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None)), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBasePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=basePath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toFile, postfix_operators=[], prefix_operators=[], qualifier=basePath, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=pFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=pFile, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]))]), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), ReturnStatement(expression=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=WatchEvent, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=WatchEvent, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], dimensions=None, name=Func1, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[final] Keyword[static] identifier[Func1] operator[<] identifier[WatchEvent] operator[<] operator[?] operator[>] , identifier[Boolean] operator[>] identifier[onlyRelatedTo] operator[SEP] Keyword[final] identifier[File] identifier[file] operator[SEP] {
Keyword[return] Keyword[new] identifier[Func1] operator[<] identifier[WatchEvent] operator[<] operator[?] operator[>] , identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[call] operator[SEP] identifier[WatchEvent] operator[<] operator[?] operator[>] identifier[event] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[ok] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] identifier[ok] operator[=] literal[boolean] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[StandardWatchEventKinds] operator[SEP] identifier[OVERFLOW] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[kind] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ok] operator[=] literal[boolean] operator[SEP] Keyword[else] {
identifier[Object] identifier[context] operator[=] identifier[event] operator[SEP] identifier[context] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[context] operator[!=] Other[null] operator[&&] identifier[context] Keyword[instanceof] identifier[Path] operator[SEP] {
identifier[Path] identifier[p] operator[=] operator[SEP] identifier[Path] operator[SEP] identifier[context] operator[SEP] identifier[Path] identifier[basePath] operator[=] identifier[getBasePath] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[File] identifier[pFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[basePath] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] , identifier[p] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ok] operator[=] identifier[pFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] identifier[ok] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[ok] operator[SEP]
}
} operator[SEP]
}
|
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(crawlingInfoId);
sb.append(dm).append(createdTime);
sb.append(dm).append(key);
sb.append(dm).append(value);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
sb.insert(0, "{").append("}");
return sb.toString();
} | class class_name[name] begin[{]
method[doBuildColumnString, return_type[type[String]], modifier[protected], parameter[dm]] begin[{]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[member[.dm]]]
call[sb.append, parameter[member[.dm]]]
call[sb.append, parameter[member[.dm]]]
call[sb.append, parameter[member[.dm]]]
if[binary_operation[call[sb.length, parameter[]], >, call[dm.length, parameter[]]]] begin[{]
call[sb.delete, parameter[literal[0], call[dm.length, parameter[]]]]
else begin[{]
None
end[}]
call[sb.insert, parameter[literal[0], literal["{"]]]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[String] identifier[doBuildColumnString] operator[SEP] identifier[String] identifier[dm] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[dm] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[crawlingInfoId] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[dm] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[createdTime] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[dm] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[dm] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] identifier[dm] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[delete] operator[SEP] Other[0] , identifier[dm] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[insert] operator[SEP] Other[0] , literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
void e(String message, Object... args) {
messenger.printMessage(ERROR, formatString(message, args));
} | class class_name[name] begin[{]
method[e, return_type[void], modifier[default], parameter[message, args]] begin[{]
call[messenger.printMessage, parameter[member[.ERROR], call[.formatString, parameter[member[.message], member[.args]]]]]
end[}]
END[}] | Keyword[void] identifier[e] operator[SEP] identifier[String] identifier[message] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[messenger] operator[SEP] identifier[printMessage] operator[SEP] identifier[ERROR] , identifier[formatString] operator[SEP] identifier[message] , identifier[args] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public List<String> parameterMultipleValues(String name) {
return request.params().getAll(name);
} | class class_name[name] begin[{]
method[parameterMultipleValues, return_type[type[List]], modifier[public], parameter[name]] begin[{]
return[call[request.params, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[parameterMultipleValues] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[return] identifier[request] operator[SEP] identifier[params] operator[SEP] operator[SEP] operator[SEP] identifier[getAll] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
|
public void marshall(DeleteMountTargetRequest deleteMountTargetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteMountTargetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteMountTargetRequest.getMountTargetId(), MOUNTTARGETID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[deleteMountTargetRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteMountTargetRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMountTargetId, postfix_operators=[], prefix_operators=[], qualifier=deleteMountTargetRequest, selectors=[], type_arguments=None), MemberReference(member=MOUNTTARGETID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DeleteMountTargetRequest] identifier[deleteMountTargetRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteMountTargetRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deleteMountTargetRequest] operator[SEP] identifier[getMountTargetId] operator[SEP] operator[SEP] , identifier[MOUNTTARGETID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
} | class class_name[name] begin[{]
method[submitBonus, return_type[type[JSONObject]], modifier[public], parameter[teamReference, params]] begin[{]
return[call[oClient.post, parameter[binary_operation[binary_operation[literal["/hr/v2/teams/"], +, member[.teamReference]], +, literal["/adjustments"]], member[.params]]]]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[submitBonus] operator[SEP] identifier[String] identifier[teamReference] , identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[return] identifier[oClient] operator[SEP] identifier[post] operator[SEP] literal[String] operator[+] identifier[teamReference] operator[+] literal[String] , identifier[params] operator[SEP] operator[SEP]
}
|
public Order placeOrder(OrderParams orderParams, String variety) throws KiteException, JSONException, IOException {
String url = routes.get("orders.place").replace(":variety", variety);
Map<String, Object> params = new HashMap<>();
if(orderParams.exchange != null) params.put("exchange", orderParams.exchange);
if(orderParams.tradingsymbol != null) params.put("tradingsymbol", orderParams.tradingsymbol);
if(orderParams.transactionType != null) params.put("transaction_type", orderParams.transactionType);
if(orderParams.quantity != null) params.put("quantity", orderParams.quantity);
if(orderParams.price != null) params.put("price", orderParams.price);
if(orderParams.product != null) params.put("product", orderParams.product);
if(orderParams.orderType != null) params.put("order_type", orderParams.orderType);
if(orderParams.validity != null) params.put("validity", orderParams.validity);
if(orderParams.disclosedQuantity != null) params.put("disclosed_quantity", orderParams.disclosedQuantity);
if(orderParams.triggerPrice != null) params.put("trigger_price", orderParams.triggerPrice);
if(orderParams.squareoff != null) params.put("squareoff", orderParams.squareoff);
if(orderParams.stoploss != null) params.put("stoploss", orderParams.stoploss);
if(orderParams.trailingStoploss != null) params.put("trailing_stoploss", orderParams.trailingStoploss);
if(orderParams.tag != null) params.put("tag", orderParams.tag);
JSONObject jsonObject = new KiteRequestHandler(proxy).postRequest(url, params, apiKey, accessToken);
Order order = new Order();
order.orderId = jsonObject.getJSONObject("data").getString("order_id");
return order;
} | class class_name[name] begin[{]
method[placeOrder, return_type[type[Order]], modifier[public], parameter[orderParams, variety]] begin[{]
local_variable[type[String], url]
local_variable[type[Map], params]
if[binary_operation[member[orderParams.exchange], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["exchange"], member[orderParams.exchange]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.tradingsymbol], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["tradingsymbol"], member[orderParams.tradingsymbol]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.transactionType], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["transaction_type"], member[orderParams.transactionType]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.quantity], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["quantity"], member[orderParams.quantity]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.price], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["price"], member[orderParams.price]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.product], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["product"], member[orderParams.product]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.orderType], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["order_type"], member[orderParams.orderType]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.validity], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["validity"], member[orderParams.validity]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.disclosedQuantity], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["disclosed_quantity"], member[orderParams.disclosedQuantity]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.triggerPrice], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["trigger_price"], member[orderParams.triggerPrice]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.squareoff], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["squareoff"], member[orderParams.squareoff]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.stoploss], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["stoploss"], member[orderParams.stoploss]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.trailingStoploss], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["trailing_stoploss"], member[orderParams.trailingStoploss]]]
else begin[{]
None
end[}]
if[binary_operation[member[orderParams.tag], !=, literal[null]]] begin[{]
call[params.put, parameter[literal["tag"], member[orderParams.tag]]]
else begin[{]
None
end[}]
local_variable[type[JSONObject], jsonObject]
local_variable[type[Order], order]
assign[member[order.orderId], call[jsonObject.getJSONObject, parameter[literal["data"]]]]
return[member[.order]]
end[}]
END[}] | Keyword[public] identifier[Order] identifier[placeOrder] operator[SEP] identifier[OrderParams] identifier[orderParams] , identifier[String] identifier[variety] operator[SEP] Keyword[throws] identifier[KiteException] , identifier[JSONException] , identifier[IOException] {
identifier[String] identifier[url] operator[=] identifier[routes] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[variety] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[exchange] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[exchange] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[tradingsymbol] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[tradingsymbol] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[transactionType] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[transactionType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[quantity] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[quantity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[price] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[price] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[product] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[product] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[orderType] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[orderType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[validity] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[validity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[disclosedQuantity] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[disclosedQuantity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[triggerPrice] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[triggerPrice] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[squareoff] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[squareoff] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[stoploss] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[stoploss] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[trailingStoploss] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[trailingStoploss] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderParams] operator[SEP] identifier[tag] operator[!=] Other[null] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[orderParams] operator[SEP] identifier[tag] operator[SEP] operator[SEP] identifier[JSONObject] identifier[jsonObject] operator[=] Keyword[new] identifier[KiteRequestHandler] operator[SEP] identifier[proxy] operator[SEP] operator[SEP] identifier[postRequest] operator[SEP] identifier[url] , identifier[params] , identifier[apiKey] , identifier[accessToken] operator[SEP] operator[SEP] identifier[Order] identifier[order] operator[=] Keyword[new] identifier[Order] operator[SEP] operator[SEP] operator[SEP] identifier[order] operator[SEP] identifier[orderId] operator[=] identifier[jsonObject] operator[SEP] identifier[getJSONObject] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[order] operator[SEP]
}
|
public SelectStep value(String value) {
return new SelectStep(element, value, SelectStep.OptionSelectorType.VALUE);
} | class class_name[name] begin[{]
method[value, return_type[type[SelectStep]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=VALUE, postfix_operators=[], prefix_operators=[], qualifier=SelectStep.OptionSelectorType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SelectStep, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[SelectStep] identifier[value] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SelectStep] operator[SEP] identifier[element] , identifier[value] , identifier[SelectStep] operator[SEP] identifier[OptionSelectorType] operator[SEP] identifier[VALUE] operator[SEP] operator[SEP]
}
|
private Entry mergeLists(Entry a, Entry b) {
if (a == null) return b;
if (b == null) return a;
// splice the two circular lists together like a Mobius strip
final Entry aOldNext = a.next;
a.next = b.next;
a.next.previous = a;
b.next = aOldNext;
b.next.previous = b;
return comparator.compare(a.priority, b.priority) < 0 ? a : b;
} | class class_name[name] begin[{]
method[mergeLists, return_type[type[Entry]], modifier[private], parameter[a, b]] begin[{]
if[binary_operation[member[.a], ==, literal[null]]] begin[{]
return[member[.b]]
else begin[{]
None
end[}]
if[binary_operation[member[.b], ==, literal[null]]] begin[{]
return[member[.a]]
else begin[{]
None
end[}]
local_variable[type[Entry], aOldNext]
assign[member[a.next], member[b.next]]
assign[member[a.next.previous], member[.a]]
assign[member[b.next], member[.aOldNext]]
assign[member[b.next.previous], member[.b]]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=priority, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), MemberReference(member=priority, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=comparator, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[private] identifier[Entry] identifier[mergeLists] operator[SEP] identifier[Entry] identifier[a] , identifier[Entry] identifier[b] operator[SEP] {
Keyword[if] operator[SEP] identifier[a] operator[==] Other[null] operator[SEP] Keyword[return] identifier[b] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[==] Other[null] operator[SEP] Keyword[return] identifier[a] operator[SEP] Keyword[final] identifier[Entry] identifier[aOldNext] operator[=] identifier[a] operator[SEP] identifier[next] operator[SEP] identifier[a] operator[SEP] identifier[next] operator[=] identifier[b] operator[SEP] identifier[next] operator[SEP] identifier[a] operator[SEP] identifier[next] operator[SEP] identifier[previous] operator[=] identifier[a] operator[SEP] identifier[b] operator[SEP] identifier[next] operator[=] identifier[aOldNext] operator[SEP] identifier[b] operator[SEP] identifier[next] operator[SEP] identifier[previous] operator[=] identifier[b] operator[SEP] Keyword[return] identifier[comparator] operator[SEP] identifier[compare] operator[SEP] identifier[a] operator[SEP] identifier[priority] , identifier[b] operator[SEP] identifier[priority] operator[SEP] operator[<] Other[0] operator[?] identifier[a] operator[:] identifier[b] operator[SEP]
}
|
public static <T> ComposableFuture<T> buildLazy(final Producer<T> producer) {
return LazyComposableFuture.build(producer);
} | class class_name[name] begin[{]
method[buildLazy, return_type[type[ComposableFuture]], modifier[public static], parameter[producer]] begin[{]
return[call[LazyComposableFuture.build, parameter[member[.producer]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[ComposableFuture] operator[<] identifier[T] operator[>] identifier[buildLazy] operator[SEP] Keyword[final] identifier[Producer] operator[<] identifier[T] operator[>] identifier[producer] operator[SEP] {
Keyword[return] identifier[LazyComposableFuture] operator[SEP] identifier[build] operator[SEP] identifier[producer] operator[SEP] operator[SEP]
}
|
public static @Nullable GrailsWebRequest lookup() {
GrailsWebRequest webRequest = null;
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes instanceof GrailsWebRequest) {
webRequest = (GrailsWebRequest) requestAttributes;
}
return webRequest;
} | class class_name[name] begin[{]
method[lookup, return_type[type[GrailsWebRequest]], modifier[public static], parameter[]] begin[{]
local_variable[type[GrailsWebRequest], webRequest]
local_variable[type[RequestAttributes], requestAttributes]
if[binary_operation[member[.requestAttributes], instanceof, type[GrailsWebRequest]]] begin[{]
assign[member[.webRequest], Cast(expression=MemberReference(member=requestAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrailsWebRequest, sub_type=None))]
else begin[{]
None
end[}]
return[member[.webRequest]]
end[}]
END[}] | Keyword[public] Keyword[static] annotation[@] identifier[Nullable] identifier[GrailsWebRequest] identifier[lookup] operator[SEP] operator[SEP] {
identifier[GrailsWebRequest] identifier[webRequest] operator[=] Other[null] operator[SEP] identifier[RequestAttributes] identifier[requestAttributes] operator[=] identifier[RequestContextHolder] operator[SEP] identifier[getRequestAttributes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[requestAttributes] Keyword[instanceof] identifier[GrailsWebRequest] operator[SEP] {
identifier[webRequest] operator[=] operator[SEP] identifier[GrailsWebRequest] operator[SEP] identifier[requestAttributes] operator[SEP]
}
Keyword[return] identifier[webRequest] operator[SEP]
}
|
public static Observable<Intent> fromLocalBroadcast(
Context context,
IntentFilter intentFilter) {
LocalBroadcastRegistrar localBroadcastRegistrar = new LocalBroadcastRegistrar(
intentFilter,
LocalBroadcastManager.getInstance(context));
return createBroadcastObservable(localBroadcastRegistrar, NO_OP_ORDERED_BROADCAST_STRATEGY);
} | class class_name[name] begin[{]
method[fromLocalBroadcast, return_type[type[Observable]], modifier[public static], parameter[context, intentFilter]] begin[{]
local_variable[type[LocalBroadcastRegistrar], localBroadcastRegistrar]
return[call[.createBroadcastObservable, parameter[member[.localBroadcastRegistrar], member[.NO_OP_ORDERED_BROADCAST_STRATEGY]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Observable] operator[<] identifier[Intent] operator[>] identifier[fromLocalBroadcast] operator[SEP] identifier[Context] identifier[context] , identifier[IntentFilter] identifier[intentFilter] operator[SEP] {
identifier[LocalBroadcastRegistrar] identifier[localBroadcastRegistrar] operator[=] Keyword[new] identifier[LocalBroadcastRegistrar] operator[SEP] identifier[intentFilter] , identifier[LocalBroadcastManager] operator[SEP] identifier[getInstance] operator[SEP] identifier[context] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[createBroadcastObservable] operator[SEP] identifier[localBroadcastRegistrar] , identifier[NO_OP_ORDERED_BROADCAST_STRATEGY] operator[SEP] operator[SEP]
}
|
public boolean hasInDoubtItems()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "hasInDoubtItems");
SibTr.exit(tc, "hasInDoubtItems", new Boolean(_inDoubt));
}
return _inDoubt;
} | class class_name[name] begin[{]
method[hasInDoubtItems, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["hasInDoubtItems"]]]
call[SibTr.exit, parameter[member[.tc], literal["hasInDoubtItems"], ClassCreator(arguments=[MemberReference(member=_inDoubt, 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=Boolean, sub_type=None))]]
else begin[{]
None
end[}]
return[member[._inDoubt]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[hasInDoubtItems] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Boolean] operator[SEP] identifier[_inDoubt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_inDoubt] operator[SEP]
}
|
@Override
public void end(Xid xid, int flags) throws XAException {
synchronized(cpoXaStateMap) {
CpoXaState<T> cpoXaState = cpoXaStateMap.getXidStateMap().get(xid);
if (cpoXaState == null)
throw CpoXaError.createXAException(CpoXaError.XAER_NOTA, "Unknown XID");
// has this already been ended
if (cpoXaState.getAssociation()==CpoXaState.XA_UNASSOCIATED)
throw CpoXaError.createXAException(CpoXaError.XAER_PROTO, "Cannot End an Unassociated XID");
switch(flags) {
case TMSUSPEND:
// You can only suspend an associated transaction
if (cpoXaState.getAssociation()==CpoXaState.XA_ASSOCIATED) {
cpoXaStateMap.getXaResourceMap().remove(cpoXaState.getAssignedResourceManager());
cpoXaState.setAssociation(CpoXaState.XA_SUSPENDED);
cpoXaState.setAssignedResourceManager(null);
} else {
throw CpoXaError.createXAException(CpoXaError.XAER_PROTO, "You can only suspend an associated XID");
}
break;
//you can fail or succeed an associated or suspended trx
case TMFAIL:
// mark transaction as failed
cpoXaStateMap.getXaResourceMap().remove(cpoXaState.getAssignedResourceManager());
cpoXaState.setAssociation(CpoXaState.XA_UNASSOCIATED);
cpoXaState.setAssignedResourceManager(null);
cpoXaState.setSuccess(cpoXaState.isSuccess()&&false);
break;
case TMSUCCESS:
// mark transaction as success
cpoXaStateMap.getXaResourceMap().remove(cpoXaState.getAssignedResourceManager());
cpoXaState.setAssociation(CpoXaState.XA_UNASSOCIATED);
cpoXaState.setAssignedResourceManager(null);
cpoXaState.setSuccess(cpoXaState.isSuccess()&&true);
break;
default:
throw CpoXaError.createXAException(CpoXaError.XAER_INVAL, "Invalid flag for end()");
}
}
} | class class_name[name] begin[{]
method[end, return_type[void], modifier[public], parameter[xid, flags]] begin[{]
SYNCHRONIZED[member[.cpoXaStateMap]] BEGIN[{]
local_variable[type[CpoXaState], cpoXaState]
if[binary_operation[member[.cpoXaState], ==, literal[null]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=XAER_NOTA, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown XID")], member=createXAException, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[cpoXaState.getAssociation, parameter[]], ==, member[CpoXaState.XA_UNASSOCIATED]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=XAER_PROTO, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot End an Unassociated XID")], member=createXAException, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['TMSUSPEND'], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAssociation, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), operandr=MemberReference(member=XA_ASSOCIATED, postfix_operators=[], prefix_operators=[], qualifier=CpoXaState, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=XAER_PROTO, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You can only suspend an associated XID")], member=createXAException, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getXaResourceMap, postfix_operators=[], prefix_operators=[], qualifier=cpoXaStateMap, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None)], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XA_SUSPENDED, postfix_operators=[], prefix_operators=[], qualifier=CpoXaState, selectors=[])], member=setAssociation, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TMFAIL'], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getXaResourceMap, postfix_operators=[], prefix_operators=[], qualifier=cpoXaStateMap, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None)], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XA_UNASSOCIATED, postfix_operators=[], prefix_operators=[], qualifier=CpoXaState, selectors=[])], member=setAssociation, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), operator=&&)], member=setSuccess, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TMSUCCESS'], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getXaResourceMap, postfix_operators=[], prefix_operators=[], qualifier=cpoXaStateMap, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None)], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XA_UNASSOCIATED, postfix_operators=[], prefix_operators=[], qualifier=CpoXaState, selectors=[])], member=setAssociation, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setAssignedResourceManager, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), operator=&&)], member=setSuccess, postfix_operators=[], prefix_operators=[], qualifier=cpoXaState, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=XAER_INVAL, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid flag for end()")], member=createXAException, postfix_operators=[], prefix_operators=[], qualifier=CpoXaError, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
END[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[end] operator[SEP] identifier[Xid] identifier[xid] , Keyword[int] identifier[flags] operator[SEP] Keyword[throws] identifier[XAException] {
Keyword[synchronized] operator[SEP] identifier[cpoXaStateMap] operator[SEP] {
identifier[CpoXaState] operator[<] identifier[T] operator[>] identifier[cpoXaState] operator[=] identifier[cpoXaStateMap] operator[SEP] identifier[getXidStateMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[xid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cpoXaState] operator[==] Other[null] operator[SEP] Keyword[throw] identifier[CpoXaError] operator[SEP] identifier[createXAException] operator[SEP] identifier[CpoXaError] operator[SEP] identifier[XAER_NOTA] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[getAssociation] operator[SEP] operator[SEP] operator[==] identifier[CpoXaState] operator[SEP] identifier[XA_UNASSOCIATED] operator[SEP] Keyword[throw] identifier[CpoXaError] operator[SEP] identifier[createXAException] operator[SEP] identifier[CpoXaError] operator[SEP] identifier[XAER_PROTO] , literal[String] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[flags] operator[SEP] {
Keyword[case] identifier[TMSUSPEND] operator[:] Keyword[if] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[getAssociation] operator[SEP] operator[SEP] operator[==] identifier[CpoXaState] operator[SEP] identifier[XA_ASSOCIATED] operator[SEP] {
identifier[cpoXaStateMap] operator[SEP] identifier[getXaResourceMap] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[getAssignedResourceManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssociation] operator[SEP] identifier[CpoXaState] operator[SEP] identifier[XA_SUSPENDED] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssignedResourceManager] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[CpoXaError] operator[SEP] identifier[createXAException] operator[SEP] identifier[CpoXaError] operator[SEP] identifier[XAER_PROTO] , literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TMFAIL] operator[:] identifier[cpoXaStateMap] operator[SEP] identifier[getXaResourceMap] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[getAssignedResourceManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssociation] operator[SEP] identifier[CpoXaState] operator[SEP] identifier[XA_UNASSOCIATED] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssignedResourceManager] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setSuccess] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[&&] literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[TMSUCCESS] operator[:] identifier[cpoXaStateMap] operator[SEP] identifier[getXaResourceMap] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[getAssignedResourceManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssociation] operator[SEP] identifier[CpoXaState] operator[SEP] identifier[XA_UNASSOCIATED] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setAssignedResourceManager] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[setSuccess] operator[SEP] identifier[cpoXaState] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[&&] literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] identifier[CpoXaError] operator[SEP] identifier[createXAException] operator[SEP] identifier[CpoXaError] operator[SEP] identifier[XAER_INVAL] , literal[String] operator[SEP] operator[SEP]
}
}
}
|
@Override
public final Object fromBytes(Class targetClass, byte[] bytes)
{
try
{
if (bytes == null)
{
return null;
}
if (targetClass != null && targetClass.equals(byte[].class))
{
return bytes;
}
ObjectInputStream ois;
ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
Object o = ois.readObject();
ois.close();
return o;
}
catch (IOException e)
{
log.error("IO exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
catch (ClassNotFoundException e)
{
log.error("Class not found exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
} | class class_name[name] begin[{]
method[fromBytes, return_type[type[Object]], modifier[final public], parameter[targetClass, bytes]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=targetClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=byte))], member=equals, postfix_operators=[], prefix_operators=[], qualifier=targetClass, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=ois)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectInputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ois, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayInputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectInputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=ois, selectors=[], type_arguments=None), name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=ois, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IO exception, Caused by {}."), 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=PropertyAccessException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Class not found exception, Caused by {}."), 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=PropertyAccessException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[Object] identifier[fromBytes] operator[SEP] identifier[Class] identifier[targetClass] , Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[bytes] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetClass] operator[!=] Other[null] operator[&&] identifier[targetClass] operator[SEP] identifier[equals] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] identifier[bytes] operator[SEP]
}
identifier[ObjectInputStream] identifier[ois] operator[SEP] identifier[ois] operator[=] Keyword[new] identifier[ObjectInputStream] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[o] operator[=] identifier[ois] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[ois] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[o] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[PropertyAccessException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[PropertyAccessException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
@Nonnull
public MindMapPanel lock() {
if (this.panelLocker != null) {
this.panelLocker.lock();
if (this.isDisposed()) {
this.panelLocker.unlock();
throw new IllegalStateException("Mind map has been already disposed!");
}
}
return this;
} | class class_name[name] begin[{]
method[lock, return_type[type[MindMapPanel]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.panelLocker]], !=, literal[null]]] begin[{]
THIS[member[None.panelLocker]call[None.lock, parameter[]]]
if[THIS[call[None.isDisposed, parameter[]]]] begin[{]
THIS[member[None.panelLocker]call[None.unlock, parameter[]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Mind map has been already disposed!")], 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[}]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[MindMapPanel] identifier[lock] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[panelLocker] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[panelLocker] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isDisposed] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[panelLocker] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public boolean setAttributes(Map<String, Object> values) {
int successes = 0;
if (values != null) {
beginUpdate();
try {
for (Map.Entry<String, Object> entry : values.entrySet()) {
if (setAttribute(entry.getKey(), entry.getValue())) {
successes++;
}
}
} finally {
endUpdate();
}
}
// expect every value to have been added
return (successes == values.size());
} | class class_name[name] begin[{]
method[setAttributes, return_type[type[boolean]], modifier[public], parameter[values]] begin[{]
local_variable[type[int], successes]
if[binary_operation[member[.values], !=, literal[null]]] begin[{]
call[.beginUpdate, parameter[]]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=setAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=successes, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], 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=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=endUpdate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[binary_operation[member[.successes], ==, call[values.size, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[setAttributes] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[values] operator[SEP] {
Keyword[int] identifier[successes] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[!=] Other[null] operator[SEP] {
identifier[beginUpdate] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entry] operator[:] identifier[values] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[setAttribute] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[successes] operator[++] operator[SEP]
}
}
}
Keyword[finally] {
identifier[endUpdate] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] operator[SEP] identifier[successes] operator[==] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void writeProjectExtendedAttributes(Project project)
{
Project.ExtendedAttributes attributes = m_factory.createProjectExtendedAttributes();
project.setExtendedAttributes(attributes);
List<Project.ExtendedAttributes.ExtendedAttribute> list = attributes.getExtendedAttribute();
Set<FieldType> customFields = new HashSet<FieldType>();
for (CustomField customField : m_projectFile.getCustomFields())
{
FieldType fieldType = customField.getFieldType();
if (fieldType != null)
{
customFields.add(fieldType);
}
}
customFields.addAll(m_extendedAttributesInUse);
List<FieldType> customFieldsList = new ArrayList<FieldType>();
customFieldsList.addAll(customFields);
// Sort to ensure consistent order in file
final CustomFieldContainer customFieldContainer = m_projectFile.getCustomFields();
Collections.sort(customFieldsList, new Comparator<FieldType>()
{
@Override public int compare(FieldType o1, FieldType o2)
{
CustomField customField1 = customFieldContainer.getCustomField(o1);
CustomField customField2 = customFieldContainer.getCustomField(o2);
String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
return name1.compareTo(name2);
}
});
for (FieldType fieldType : customFieldsList)
{
Project.ExtendedAttributes.ExtendedAttribute attribute = m_factory.createProjectExtendedAttributesExtendedAttribute();
list.add(attribute);
attribute.setFieldID(String.valueOf(FieldTypeHelper.getFieldID(fieldType)));
attribute.setFieldName(fieldType.getName());
CustomField customField = customFieldContainer.getCustomField(fieldType);
attribute.setAlias(customField.getAlias());
}
} | class class_name[name] begin[{]
method[writeProjectExtendedAttributes, return_type[void], modifier[private], parameter[project]] begin[{]
local_variable[type[Project], attributes]
call[project.setExtendedAttributes, parameter[member[.attributes]]]
local_variable[type[List], list]
local_variable[type[Set], customFields]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFieldType, postfix_operators=[], prefix_operators=[], qualifier=customField, selectors=[], type_arguments=None), name=fieldType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fieldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fieldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=customFields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getCustomFields, postfix_operators=[], prefix_operators=[], qualifier=m_projectFile, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=customField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CustomField, sub_type=None))), label=None)
call[customFields.addAll, parameter[member[.m_extendedAttributesInUse]]]
local_variable[type[List], customFieldsList]
call[customFieldsList.addAll, parameter[member[.customFields]]]
local_variable[type[CustomFieldContainer], customFieldContainer]
call[Collections.sort, parameter[member[.customFieldsList], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCustomField, postfix_operators=[], prefix_operators=[], qualifier=customFieldContainer, selectors=[], type_arguments=None), name=customField1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CustomField, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCustomField, postfix_operators=[], prefix_operators=[], qualifier=customFieldContainer, selectors=[], type_arguments=None), name=customField2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CustomField, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[MethodInvocation(arguments=[], member=getSimpleName, 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="."), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MethodInvocation(arguments=[], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=customField1, selectors=[], type_arguments=None), operator=+), name=name1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[MethodInvocation(arguments=[], member=getSimpleName, 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="."), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MethodInvocation(arguments=[], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=customField2, selectors=[], type_arguments=None), operator=+), name=name2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=name1, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=FieldType, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=FieldType, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FieldType, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=createProjectExtendedAttributesExtendedAttribute, postfix_operators=[], prefix_operators=[], qualifier=m_factory, selectors=[], type_arguments=None), name=attribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Project, sub_type=ReferenceType(arguments=None, dimensions=None, name=ExtendedAttributes, sub_type=ReferenceType(arguments=None, dimensions=None, name=ExtendedAttribute, sub_type=None)))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=fieldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldID, postfix_operators=[], prefix_operators=[], qualifier=FieldTypeHelper, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=setFieldID, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=fieldType, selectors=[], type_arguments=None)], member=setFieldName, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fieldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCustomField, postfix_operators=[], prefix_operators=[], qualifier=customFieldContainer, selectors=[], type_arguments=None), name=customField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CustomField, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=customField, selectors=[], type_arguments=None)], member=setAlias, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=customFieldsList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldType, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeProjectExtendedAttributes] operator[SEP] identifier[Project] identifier[project] operator[SEP] {
identifier[Project] operator[SEP] identifier[ExtendedAttributes] identifier[attributes] operator[=] identifier[m_factory] operator[SEP] identifier[createProjectExtendedAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[project] operator[SEP] identifier[setExtendedAttributes] operator[SEP] identifier[attributes] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Project] operator[SEP] identifier[ExtendedAttributes] operator[SEP] identifier[ExtendedAttribute] operator[>] identifier[list] operator[=] identifier[attributes] operator[SEP] identifier[getExtendedAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[FieldType] operator[>] identifier[customFields] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[FieldType] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CustomField] identifier[customField] operator[:] identifier[m_projectFile] operator[SEP] identifier[getCustomFields] operator[SEP] operator[SEP] operator[SEP] {
identifier[FieldType] identifier[fieldType] operator[=] identifier[customField] operator[SEP] identifier[getFieldType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fieldType] operator[!=] Other[null] operator[SEP] {
identifier[customFields] operator[SEP] identifier[add] operator[SEP] identifier[fieldType] operator[SEP] operator[SEP]
}
}
identifier[customFields] operator[SEP] identifier[addAll] operator[SEP] identifier[m_extendedAttributesInUse] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[FieldType] operator[>] identifier[customFieldsList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[FieldType] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[customFieldsList] operator[SEP] identifier[addAll] operator[SEP] identifier[customFields] operator[SEP] operator[SEP] Keyword[final] identifier[CustomFieldContainer] identifier[customFieldContainer] operator[=] identifier[m_projectFile] operator[SEP] identifier[getCustomFields] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[customFieldsList] , Keyword[new] identifier[Comparator] operator[<] identifier[FieldType] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[FieldType] identifier[o1] , identifier[FieldType] identifier[o2] operator[SEP] {
identifier[CustomField] identifier[customField1] operator[=] identifier[customFieldContainer] operator[SEP] identifier[getCustomField] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[CustomField] identifier[customField2] operator[=] identifier[customFieldContainer] operator[SEP] identifier[getCustomField] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[String] identifier[name1] operator[=] identifier[o1] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[o1] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[customField1] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name2] operator[=] identifier[o2] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[o2] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[customField2] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[name1] operator[SEP] identifier[compareTo] operator[SEP] identifier[name2] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FieldType] identifier[fieldType] operator[:] identifier[customFieldsList] operator[SEP] {
identifier[Project] operator[SEP] identifier[ExtendedAttributes] operator[SEP] identifier[ExtendedAttribute] identifier[attribute] operator[=] identifier[m_factory] operator[SEP] identifier[createProjectExtendedAttributesExtendedAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] identifier[setFieldID] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[FieldTypeHelper] operator[SEP] identifier[getFieldID] operator[SEP] identifier[fieldType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] identifier[setFieldName] operator[SEP] identifier[fieldType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CustomField] identifier[customField] operator[=] identifier[customFieldContainer] operator[SEP] identifier[getCustomField] operator[SEP] identifier[fieldType] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] identifier[setAlias] operator[SEP] identifier[customField] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public alluxio.grpc.CancelPOptionsOrBuilder getOptionsOrBuilder() {
return options_ == null ? alluxio.grpc.CancelPOptions.getDefaultInstance() : options_;
} | class class_name[name] begin[{]
method[getOptionsOrBuilder, return_type[type[alluxio]], modifier[public], parameter[]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=options_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=options_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=getDefaultInstance, postfix_operators=[], prefix_operators=[], qualifier=alluxio.grpc.CancelPOptions, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[CancelPOptionsOrBuilder] identifier[getOptionsOrBuilder] operator[SEP] operator[SEP] {
Keyword[return] identifier[options_] operator[==] Other[null] operator[?] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[CancelPOptions] operator[SEP] identifier[getDefaultInstance] operator[SEP] operator[SEP] operator[:] identifier[options_] operator[SEP]
}
|
public List<String> getEnumOptions() {
String enumOptionsStr = getString(ENUM_OPTIONS);
return enumOptionsStr != null ? asList(enumOptionsStr.split(",")) : emptyList();
} | class class_name[name] begin[{]
method[getEnumOptions, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[String], enumOptionsStr]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=enumOptionsStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[], member=emptyList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=split, postfix_operators=[], prefix_operators=[], qualifier=enumOptionsStr, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getEnumOptions] operator[SEP] operator[SEP] {
identifier[String] identifier[enumOptionsStr] operator[=] identifier[getString] operator[SEP] identifier[ENUM_OPTIONS] operator[SEP] operator[SEP] Keyword[return] identifier[enumOptionsStr] operator[!=] Other[null] operator[?] identifier[asList] operator[SEP] identifier[enumOptionsStr] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[:] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
|
void backupDirs() throws IOException {
File rootDir = sd.getRootDir();
FileSystem localFs = FileSystem.getLocal(conf).getRaw();
NNStorageDirectoryRetentionManager.backupFiles(localFs, rootDir, conf);
} | class class_name[name] begin[{]
method[backupDirs, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[File], rootDir]
local_variable[type[FileSystem], localFs]
call[NNStorageDirectoryRetentionManager.backupFiles, parameter[member[.localFs], member[.rootDir], member[.conf]]]
end[}]
END[}] | Keyword[void] identifier[backupDirs] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] identifier[rootDir] operator[=] identifier[sd] operator[SEP] identifier[getRootDir] operator[SEP] operator[SEP] operator[SEP] identifier[FileSystem] identifier[localFs] operator[=] identifier[FileSystem] operator[SEP] identifier[getLocal] operator[SEP] identifier[conf] operator[SEP] operator[SEP] identifier[getRaw] operator[SEP] operator[SEP] operator[SEP] identifier[NNStorageDirectoryRetentionManager] operator[SEP] identifier[backupFiles] operator[SEP] identifier[localFs] , identifier[rootDir] , identifier[conf] operator[SEP] operator[SEP]
}
|
private int getPressedPointerIndex(MotionEvent event, int i) {
final int count = event.getPointerCount();
final int action = event.getActionMasked();
final int index = event.getActionIndex();
if (action == MotionEvent.ACTION_UP ||
action == MotionEvent.ACTION_POINTER_UP) {
if (i >= index) {
i++;
}
}
return (i < count) ? i : -1;
} | class class_name[name] begin[{]
method[getPressedPointerIndex, return_type[type[int]], modifier[private], parameter[event, i]] begin[{]
local_variable[type[int], count]
local_variable[type[int], action]
local_variable[type[int], index]
if[binary_operation[binary_operation[member[.action], ==, member[MotionEvent.ACTION_UP]], ||, binary_operation[member[.action], ==, member[MotionEvent.ACTION_POINTER_UP]]]] begin[{]
if[binary_operation[member[.i], >=, member[.index]]] begin[{]
member[.i]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), if_true=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[getPressedPointerIndex] operator[SEP] identifier[MotionEvent] identifier[event] , Keyword[int] identifier[i] operator[SEP] {
Keyword[final] Keyword[int] identifier[count] operator[=] identifier[event] operator[SEP] identifier[getPointerCount] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[action] operator[=] identifier[event] operator[SEP] identifier[getActionMasked] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[index] operator[=] identifier[event] operator[SEP] identifier[getActionIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[action] operator[==] identifier[MotionEvent] operator[SEP] identifier[ACTION_UP] operator[||] identifier[action] operator[==] identifier[MotionEvent] operator[SEP] identifier[ACTION_POINTER_UP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>=] identifier[index] operator[SEP] {
identifier[i] operator[++] operator[SEP]
}
}
Keyword[return] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] operator[?] identifier[i] operator[:] operator[-] Other[1] operator[SEP]
}
|
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (context.isNormalServer()) {
ModelNode operationResult;
try {
operationResult = invokeCommand(getEmbeddedCacheManager(context, operation), context, operation);
} catch (Exception e) {
throw new OperationFailedException(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage()), e);
}
if (operationResult != null) {
context.getResult().set(operationResult);
}
}
} | class class_name[name] begin[{]
method[execute, return_type[void], modifier[public], parameter[context, operation]] begin[{]
if[call[context.isNormalServer, parameter[]]] begin[{]
local_variable[type[ModelNode], operationResult]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=operationResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEmbeddedCacheManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invokeCommand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=failedToInvokeOperation, postfix_operators=[], prefix_operators=[], qualifier=MESSAGES, selectors=[], type_arguments=None), 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=OperationFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.operationResult], !=, literal[null]]] begin[{]
call[context.getResult, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] identifier[OperationContext] identifier[context] , identifier[ModelNode] identifier[operation] operator[SEP] Keyword[throws] identifier[OperationFailedException] {
Keyword[if] operator[SEP] identifier[context] operator[SEP] identifier[isNormalServer] operator[SEP] operator[SEP] operator[SEP] {
identifier[ModelNode] identifier[operationResult] operator[SEP] Keyword[try] {
identifier[operationResult] operator[=] identifier[invokeCommand] operator[SEP] identifier[getEmbeddedCacheManager] operator[SEP] identifier[context] , identifier[operation] operator[SEP] , identifier[context] , identifier[operation] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OperationFailedException] operator[SEP] identifier[MESSAGES] operator[SEP] identifier[failedToInvokeOperation] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[operationResult] operator[!=] Other[null] operator[SEP] {
identifier[context] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[operationResult] operator[SEP] operator[SEP]
}
}
}
|
public static <T> Instantiator<T> newInstantiator(Class<T> clazz)
{
final Constructor<T> constructor = getConstructor(clazz);
if(constructor == null)
{
// non-sun jre
if(newInstanceFromObjectInputStream == null)
{
if(objectConstructorId == -1)
throw new RuntimeException("Could not resolve constructor for " + clazz);
return new Android3Instantiator<T>(clazz);
}
return new Android2Instantiator<T>(clazz);
}
return new DefaultInstantiator<T>(constructor);
} | class class_name[name] begin[{]
method[newInstantiator, return_type[type[Instantiator]], modifier[public static], parameter[clazz]] begin[{]
local_variable[type[Constructor], constructor]
if[binary_operation[member[.constructor], ==, literal[null]]] begin[{]
if[binary_operation[member[.newInstanceFromObjectInputStream], ==, literal[null]]] begin[{]
if[binary_operation[member[.objectConstructorId], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not resolve constructor for "), operandr=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Android3Instantiator, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Android2Instantiator, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=constructor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=DefaultInstantiator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Instantiator] operator[<] identifier[T] operator[>] identifier[newInstantiator] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
Keyword[final] identifier[Constructor] operator[<] identifier[T] operator[>] identifier[constructor] operator[=] identifier[getConstructor] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[constructor] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[newInstanceFromObjectInputStream] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[objectConstructorId] operator[==] operator[-] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Android3Instantiator] operator[<] identifier[T] operator[>] operator[SEP] identifier[clazz] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Android2Instantiator] operator[<] identifier[T] operator[>] operator[SEP] identifier[clazz] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[DefaultInstantiator] operator[<] identifier[T] operator[>] operator[SEP] identifier[constructor] operator[SEP] operator[SEP]
}
|
public boolean containsValue (Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = capacity + stashSize; i-- > 0;)
if (keyTable[i] != null && valueTable[i] == null) return true;
} else if (identity) {
for (int i = capacity + stashSize; i-- > 0;)
if (valueTable[i] == value) return true;
} else {
for (int i = capacity + stashSize; i-- > 0;)
if (value.equals(valueTable[i])) return true;
}
return false;
} | class class_name[name] begin[{]
method[containsValue, return_type[type[boolean]], modifier[public], parameter[value, identity]] begin[{]
local_variable[type[V], valueTable]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
local_variable[type[K], keyTable]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=keyTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=valueTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=stashSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
else begin[{]
if[member[.identity]] begin[{]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=valueTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=stashSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
else begin[{]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=valueTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=stashSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
end[}]
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[containsValue] operator[SEP] identifier[Object] identifier[value] , Keyword[boolean] identifier[identity] operator[SEP] {
identifier[V] operator[SEP] operator[SEP] identifier[valueTable] operator[=] Keyword[this] operator[SEP] identifier[valueTable] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[K] operator[SEP] operator[SEP] identifier[keyTable] operator[=] Keyword[this] operator[SEP] identifier[keyTable] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[capacity] operator[+] identifier[stashSize] operator[SEP] identifier[i] operator[--] operator[>] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keyTable] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[null] operator[&&] identifier[valueTable] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[identity] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[capacity] operator[+] identifier[stashSize] operator[SEP] identifier[i] operator[--] operator[>] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[valueTable] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[value] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[capacity] operator[+] identifier[stashSize] operator[SEP] identifier[i] operator[--] operator[>] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[equals] operator[SEP] identifier[valueTable] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Cell<C,T> size (float width, float height) {
size(new FixedValue<C, T>(layout.toolkit, width), new FixedValue<C, T>(layout.toolkit, height));
return this;
} | class class_name[name] begin[{]
method[size, return_type[type[Cell]], modifier[public], parameter[width, height]] begin[{]
call[.size, parameter[ClassCreator(arguments=[MemberReference(member=toolkit, postfix_operators=[], prefix_operators=[], qualifier=layout, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=C, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=FixedValue, sub_type=None)), ClassCreator(arguments=[MemberReference(member=toolkit, postfix_operators=[], prefix_operators=[], qualifier=layout, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=C, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=FixedValue, sub_type=None))]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Cell] operator[<] identifier[C] , identifier[T] operator[>] identifier[size] operator[SEP] Keyword[float] identifier[width] , Keyword[float] identifier[height] operator[SEP] {
identifier[size] operator[SEP] Keyword[new] identifier[FixedValue] operator[<] identifier[C] , identifier[T] operator[>] operator[SEP] identifier[layout] operator[SEP] identifier[toolkit] , identifier[width] operator[SEP] , Keyword[new] identifier[FixedValue] operator[<] identifier[C] , identifier[T] operator[>] operator[SEP] identifier[layout] operator[SEP] identifier[toolkit] , identifier[height] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Observable<FluentModelTImpl> commitAsync() {
if (this.isPostRunMode) {
return Observable.error(new IllegalStateException("commitAsync() cannot be invoked when 'post run' mode is enabled"));
}
final ExternalChildResourceCollectionImpl<FluentModelTImpl, FluentModelT, InnerModelT, ParentImplT, ParentT> self = this;
List<FluentModelTImpl> items = new ArrayList<>();
for (FluentModelTImpl item : this.childCollection.values()) {
items.add(item);
}
final List<Throwable> exceptionsList = Collections.synchronizedList(new ArrayList<Throwable>());
Observable<FluentModelTImpl> deleteStream = Observable.from(items)
.filter(new Func1<FluentModelTImpl, Boolean>() {
@Override
public Boolean call(FluentModelTImpl childResource) {
return childResource.pendingOperation() == ExternalChildResourceImpl.PendingOperation.ToBeRemoved;
}
}).flatMap(new Func1<FluentModelTImpl, Observable<FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(final FluentModelTImpl childResource) {
return childResource.deleteResourceAsync()
.map(new Func1<Void, FluentModelTImpl>() {
@Override
public FluentModelTImpl call(Void response) {
return childResource;
}
}).doOnNext(new Action1<FluentModelTImpl>() {
@Override
public void call(FluentModelTImpl childResource) {
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.None);
self.childCollection.remove(childResource.name());
}
})
.onErrorResumeNext(new Func1<Throwable, Observable<FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(Throwable throwable) {
exceptionsList.add(throwable);
return Observable.empty();
}
});
}
});
Observable<FluentModelTImpl> createStream = Observable.from(items)
.filter(new Func1<FluentModelTImpl, Boolean>() {
@Override
public Boolean call(FluentModelTImpl childResource) {
return childResource.pendingOperation() == ExternalChildResourceImpl.PendingOperation.ToBeCreated;
}
}).flatMap(new Func1<FluentModelTImpl, Observable<FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(final FluentModelTImpl childResource) {
return childResource.createResourceAsync()
.map(new Func1<FluentModelT, FluentModelTImpl>() {
@Override
public FluentModelTImpl call(FluentModelT fluentModelT) {
return childResource;
}
})
.doOnNext(new Action1<FluentModelTImpl>() {
@Override
public void call(FluentModelTImpl fluentModelT) {
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.None);
}
})
.onErrorResumeNext(new Func1<Throwable, Observable<? extends FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(Throwable throwable) {
self.childCollection.remove(childResource.name());
exceptionsList.add(throwable);
return Observable.empty();
}
});
}
});
Observable<FluentModelTImpl> updateStream = Observable.from(items)
.filter(new Func1<FluentModelTImpl, Boolean>() {
@Override
public Boolean call(FluentModelTImpl childResource) {
return childResource.pendingOperation() == ExternalChildResourceImpl.PendingOperation.ToBeUpdated;
}
}).flatMap(new Func1<FluentModelTImpl, Observable<FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(final FluentModelTImpl childResource) {
return childResource.updateResourceAsync()
.map(new Func1<FluentModelT, FluentModelTImpl>() {
@Override
public FluentModelTImpl call(FluentModelT e) {
return childResource;
}
})
.doOnNext(new Action1<FluentModelTImpl>() {
@Override
public void call(FluentModelTImpl childResource) {
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.None);
}
})
.onErrorResumeNext(new Func1<Throwable, Observable<? extends FluentModelTImpl>>() {
@Override
public Observable<FluentModelTImpl> call(Throwable throwable) {
exceptionsList.add(throwable);
return Observable.empty();
}
});
}
});
final PublishSubject<FluentModelTImpl> aggregatedErrorStream = PublishSubject.create();
Observable<FluentModelTImpl> operationsStream = Observable.merge(deleteStream,
createStream,
updateStream).doOnTerminate(new Action0() {
@Override
public void call() {
if (clearAfterCommit()) {
self.childCollection.clear();
}
if (exceptionsList.isEmpty()) {
aggregatedErrorStream.onCompleted();
} else {
aggregatedErrorStream.onError(new CompositeException(exceptionsList));
}
}
});
Observable<FluentModelTImpl> stream = Observable.concat(operationsStream, aggregatedErrorStream);
return stream;
} | class class_name[name] begin[{]
method[commitAsync, return_type[type[Observable]], modifier[public], parameter[]] begin[{]
if[THIS[member[None.isPostRunMode]]] begin[{]
return[call[Observable.error, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="commitAsync() cannot be invoked when 'post run' mode is enabled")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None))]]]
else begin[{]
None
end[}]
local_variable[type[ExternalChildResourceCollectionImpl], self]
local_variable[type[List], items]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=childCollection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FluentModelTImpl, sub_type=None))), label=None)
local_variable[type[List], exceptionsList]
local_variable[type[Observable], deleteStream]
local_variable[type[Observable], createStream]
local_variable[type[Observable], updateStream]
local_variable[type[PublishSubject], aggregatedErrorStream]
local_variable[type[Observable], operationsStream]
local_variable[type[Observable], stream]
return[member[.stream]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[commitAsync] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isPostRunMode] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ExternalChildResourceCollectionImpl] operator[<] identifier[FluentModelTImpl] , identifier[FluentModelT] , identifier[InnerModelT] , identifier[ParentImplT] , identifier[ParentT] operator[>] identifier[self] operator[=] Keyword[this] operator[SEP] identifier[List] operator[<] identifier[FluentModelTImpl] operator[>] identifier[items] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FluentModelTImpl] identifier[item] operator[:] Keyword[this] operator[SEP] identifier[childCollection] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[items] operator[SEP] identifier[add] operator[SEP] identifier[item] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[Throwable] operator[>] identifier[exceptionsList] operator[=] identifier[Collections] operator[SEP] identifier[synchronizedList] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[Throwable] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[deleteStream] operator[=] identifier[Observable] operator[SEP] identifier[from] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[pendingOperation] operator[SEP] operator[SEP] operator[==] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[ToBeRemoved] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] Keyword[final] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[deleteResourceAsync] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Void] , identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[FluentModelTImpl] identifier[call] operator[SEP] identifier[Void] identifier[response] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[doOnNext] operator[SEP] Keyword[new] identifier[Action1] operator[<] identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
identifier[childResource] operator[SEP] identifier[setPendingOperation] operator[SEP] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[None] operator[SEP] operator[SEP] identifier[self] operator[SEP] identifier[childCollection] operator[SEP] identifier[remove] operator[SEP] identifier[childResource] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[onErrorResumeNext] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Throwable] , identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
identifier[exceptionsList] operator[SEP] identifier[add] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[createStream] operator[=] identifier[Observable] operator[SEP] identifier[from] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[pendingOperation] operator[SEP] operator[SEP] operator[==] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[ToBeCreated] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] Keyword[final] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[createResourceAsync] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelT] , identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[FluentModelTImpl] identifier[call] operator[SEP] identifier[FluentModelT] identifier[fluentModelT] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[doOnNext] operator[SEP] Keyword[new] identifier[Action1] operator[<] identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[fluentModelT] operator[SEP] {
identifier[childResource] operator[SEP] identifier[setPendingOperation] operator[SEP] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[None] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[onErrorResumeNext] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Throwable] , identifier[Observable] operator[<] operator[?] Keyword[extends] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
identifier[self] operator[SEP] identifier[childCollection] operator[SEP] identifier[remove] operator[SEP] identifier[childResource] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[exceptionsList] operator[SEP] identifier[add] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[updateStream] operator[=] identifier[Observable] operator[SEP] identifier[from] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[pendingOperation] operator[SEP] operator[SEP] operator[==] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[ToBeUpdated] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelTImpl] , identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] Keyword[final] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP] identifier[updateResourceAsync] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[FluentModelT] , identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[FluentModelTImpl] identifier[call] operator[SEP] identifier[FluentModelT] identifier[e] operator[SEP] {
Keyword[return] identifier[childResource] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[doOnNext] operator[SEP] Keyword[new] identifier[Action1] operator[<] identifier[FluentModelTImpl] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] identifier[FluentModelTImpl] identifier[childResource] operator[SEP] {
identifier[childResource] operator[SEP] identifier[setPendingOperation] operator[SEP] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[None] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[onErrorResumeNext] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Throwable] , identifier[Observable] operator[<] operator[?] Keyword[extends] identifier[FluentModelTImpl] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[call] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
identifier[exceptionsList] operator[SEP] identifier[add] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[final] identifier[PublishSubject] operator[<] identifier[FluentModelTImpl] operator[>] identifier[aggregatedErrorStream] operator[=] identifier[PublishSubject] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[operationsStream] operator[=] identifier[Observable] operator[SEP] identifier[merge] operator[SEP] identifier[deleteStream] , identifier[createStream] , identifier[updateStream] operator[SEP] operator[SEP] identifier[doOnTerminate] operator[SEP] Keyword[new] identifier[Action0] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[clearAfterCommit] operator[SEP] operator[SEP] operator[SEP] {
identifier[self] operator[SEP] identifier[childCollection] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[exceptionsList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[aggregatedErrorStream] operator[SEP] identifier[onCompleted] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[aggregatedErrorStream] operator[SEP] identifier[onError] operator[SEP] Keyword[new] identifier[CompositeException] operator[SEP] identifier[exceptionsList] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[FluentModelTImpl] operator[>] identifier[stream] operator[=] identifier[Observable] operator[SEP] identifier[concat] operator[SEP] identifier[operationsStream] , identifier[aggregatedErrorStream] operator[SEP] operator[SEP] Keyword[return] identifier[stream] operator[SEP]
}
|
public static boolean isValidLong(@Nullable final String longStr, final long lowerBound, final long upperBound) {
return isValidLong(longStr, lowerBound, upperBound, true, false);
} | class class_name[name] begin[{]
method[isValidLong, return_type[type[boolean]], modifier[public static], parameter[longStr, lowerBound, upperBound]] begin[{]
return[call[.isValidLong, parameter[member[.longStr], member[.lowerBound], member[.upperBound], literal[true], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isValidLong] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[longStr] , Keyword[final] Keyword[long] identifier[lowerBound] , Keyword[final] Keyword[long] identifier[upperBound] operator[SEP] {
Keyword[return] identifier[isValidLong] operator[SEP] identifier[longStr] , identifier[lowerBound] , identifier[upperBound] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
protected void prepareDialogPage(DialogPage page) {
page.addPropertyChangeListener(childChangeHandler);
JComponent c = page.getControl();
GuiStandardUtils.attachDialogBorder(c);
Dimension size = c.getPreferredSize();
if (size.width > largestPageWidth) {
largestPageWidth = size.width;
}
if (size.height > largestPageHeight) {
largestPageHeight = size.height;
}
} | class class_name[name] begin[{]
method[prepareDialogPage, return_type[void], modifier[protected], parameter[page]] begin[{]
call[page.addPropertyChangeListener, parameter[member[.childChangeHandler]]]
local_variable[type[JComponent], c]
call[GuiStandardUtils.attachDialogBorder, parameter[member[.c]]]
local_variable[type[Dimension], size]
if[binary_operation[member[size.width], >, member[.largestPageWidth]]] begin[{]
assign[member[.largestPageWidth], member[size.width]]
else begin[{]
None
end[}]
if[binary_operation[member[size.height], >, member[.largestPageHeight]]] begin[{]
assign[member[.largestPageHeight], member[size.height]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[prepareDialogPage] operator[SEP] identifier[DialogPage] identifier[page] operator[SEP] {
identifier[page] operator[SEP] identifier[addPropertyChangeListener] operator[SEP] identifier[childChangeHandler] operator[SEP] operator[SEP] identifier[JComponent] identifier[c] operator[=] identifier[page] operator[SEP] identifier[getControl] operator[SEP] operator[SEP] operator[SEP] identifier[GuiStandardUtils] operator[SEP] identifier[attachDialogBorder] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[Dimension] identifier[size] operator[=] identifier[c] operator[SEP] identifier[getPreferredSize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[width] operator[>] identifier[largestPageWidth] operator[SEP] {
identifier[largestPageWidth] operator[=] identifier[size] operator[SEP] identifier[width] operator[SEP]
}
Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[height] operator[>] identifier[largestPageHeight] operator[SEP] {
identifier[largestPageHeight] operator[=] identifier[size] operator[SEP] identifier[height] operator[SEP]
}
}
|
public void setProducerConnectionUuid(SIBUuid12 producerConnectionUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setProducerConnectionUuid", producerConnectionUuid);
this.producerConnectionUuid = producerConnectionUuid;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setProducerConnectionUuid");
} | class class_name[name] begin[{]
method[setProducerConnectionUuid, return_type[void], modifier[public], parameter[producerConnectionUuid]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setProducerConnectionUuid"], member[.producerConnectionUuid]]]
else begin[{]
None
end[}]
assign[THIS[member[None.producerConnectionUuid]], member[.producerConnectionUuid]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setProducerConnectionUuid"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setProducerConnectionUuid] operator[SEP] identifier[SIBUuid12] identifier[producerConnectionUuid] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[producerConnectionUuid] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[producerConnectionUuid] operator[=] identifier[producerConnectionUuid] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public Observable<VnetValidationFailureDetailsInner> verifyHostingEnvironmentVnetAsync(VnetParameters parameters) {
return verifyHostingEnvironmentVnetWithServiceResponseAsync(parameters).map(new Func1<ServiceResponse<VnetValidationFailureDetailsInner>, VnetValidationFailureDetailsInner>() {
@Override
public VnetValidationFailureDetailsInner call(ServiceResponse<VnetValidationFailureDetailsInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[verifyHostingEnvironmentVnetAsync, return_type[type[Observable]], modifier[public], parameter[parameters]] begin[{]
return[call[.verifyHostingEnvironmentVnetWithServiceResponseAsync, parameter[member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[VnetValidationFailureDetailsInner] operator[>] identifier[verifyHostingEnvironmentVnetAsync] operator[SEP] identifier[VnetParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[verifyHostingEnvironmentVnetWithServiceResponseAsync] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[VnetValidationFailureDetailsInner] operator[>] , identifier[VnetValidationFailureDetailsInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[VnetValidationFailureDetailsInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[VnetValidationFailureDetailsInner] 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 Optional<Integer> readMaybeVInt(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | class class_name[name] begin[{]
method[readMaybeVInt, return_type[type[Optional]], modifier[public static], parameter[bf]] begin[{]
if[binary_operation[call[bf.readableBytes, parameter[]], >=, literal[1]]] begin[{]
local_variable[type[byte], b]
return[call[.read, parameter[member[.bf], member[.b], literal[7], binary_operation[member[.b], &, literal[0x7F]], literal[1]]]]
else begin[{]
call[bf.resetReaderIndex, parameter[]]
return[call[Optional.empty, parameter[]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Optional] operator[<] identifier[Integer] operator[>] identifier[readMaybeVInt] operator[SEP] identifier[ByteBuf] identifier[bf] operator[SEP] {
Keyword[if] operator[SEP] identifier[bf] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[>=] Other[1] operator[SEP] {
Keyword[byte] identifier[b] operator[=] identifier[bf] operator[SEP] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[read] operator[SEP] identifier[bf] , identifier[b] , Other[7] , identifier[b] operator[&] literal[Integer] , Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bf] operator[SEP] identifier[resetReaderIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
}
|
void addFileName(final String fileName) {
writeLock.lock();
try {
final FileListCacheValue fileList = getFileList();
boolean done = fileList.add(fileName);
if (done) {
updateFileList(fileList);
if (trace)
log.trace("Updated file listing: added " + fileName);
}
} finally {
writeLock.unlock();
}
} | class class_name[name] begin[{]
method[addFileName, return_type[void], modifier[default], parameter[fileName]] begin[{]
call[writeLock.lock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=fileList)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=FileListCacheValue, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=fileList, selectors=[], type_arguments=None), name=done)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=updateFileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Updated file listing: added "), operandr=MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None))]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=writeLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[void] identifier[addFileName] operator[SEP] Keyword[final] identifier[String] identifier[fileName] operator[SEP] {
identifier[writeLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[FileListCacheValue] identifier[fileList] operator[=] identifier[getFileList] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[done] operator[=] identifier[fileList] operator[SEP] identifier[add] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[done] operator[SEP] {
identifier[updateFileList] operator[SEP] identifier[fileList] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trace] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[fileName] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[writeLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public boolean hasRoleForResource(CmsRequestContext context, CmsUser user, CmsRole role, CmsResource resource) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
boolean result;
try {
result = hasRoleForResource(dbc, user, role, resource);
} finally {
dbc.clear();
}
return result;
} | class class_name[name] begin[{]
method[hasRoleForResource, return_type[type[boolean]], modifier[public], parameter[context, user, role, resource]] begin[{]
local_variable[type[CmsDbContext], dbc]
local_variable[type[boolean], result]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasRoleForResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=dbc, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[hasRoleForResource] operator[SEP] identifier[CmsRequestContext] identifier[context] , identifier[CmsUser] identifier[user] , identifier[CmsRole] identifier[role] , identifier[CmsResource] identifier[resource] operator[SEP] {
identifier[CmsDbContext] identifier[dbc] operator[=] identifier[m_dbContextFactory] operator[SEP] identifier[getDbContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[boolean] identifier[result] operator[SEP] Keyword[try] {
identifier[result] operator[=] identifier[hasRoleForResource] operator[SEP] identifier[dbc] , identifier[user] , identifier[role] , identifier[resource] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[dbc] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public final AppProfile getAppProfile(AppProfileName name) {
GetAppProfileRequest request =
GetAppProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getAppProfile(request);
} | class class_name[name] begin[{]
method[getAppProfile, return_type[type[AppProfile]], modifier[final public], parameter[name]] begin[{]
local_variable[type[GetAppProfileRequest], request]
return[call[.getAppProfile, parameter[member[.request]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[AppProfile] identifier[getAppProfile] operator[SEP] identifier[AppProfileName] identifier[name] operator[SEP] {
identifier[GetAppProfileRequest] identifier[request] operator[=] identifier[GetAppProfileRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setName] operator[SEP] identifier[name] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[name] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getAppProfile] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected void extractCardHolderName(final byte[] pData) {
// Extract Card Holder name (if exist)
byte[] cardHolderByte = TlvUtil.getValue(pData, EmvTags.CARDHOLDER_NAME);
if (cardHolderByte != null) {
String[] name = StringUtils.split(new String(cardHolderByte).trim(), TrackUtils.CARD_HOLDER_NAME_SEPARATOR);
if (name != null && name.length > 0) {
template.get().getCard().setHolderLastname(StringUtils.trimToNull(name[0]));
if (name.length == 2) {
template.get().getCard().setHolderFirstname(StringUtils.trimToNull(name[1]));
}
}
}
} | class class_name[name] begin[{]
method[extractCardHolderName, return_type[void], modifier[protected], parameter[pData]] begin[{]
local_variable[type[byte], cardHolderByte]
if[binary_operation[member[.cardHolderByte], !=, literal[null]]] begin[{]
local_variable[type[String], name]
if[binary_operation[binary_operation[member[.name], !=, literal[null]], &&, binary_operation[member[name.length], >, literal[0]]]] begin[{]
call[template.get, parameter[]]
if[binary_operation[member[name.length], ==, literal[2]]] begin[{]
call[template.get, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[extractCardHolderName] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[pData] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[cardHolderByte] operator[=] identifier[TlvUtil] operator[SEP] identifier[getValue] operator[SEP] identifier[pData] , identifier[EmvTags] operator[SEP] identifier[CARDHOLDER_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cardHolderByte] operator[!=] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[StringUtils] operator[SEP] identifier[split] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[cardHolderByte] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] , identifier[TrackUtils] operator[SEP] identifier[CARD_HOLDER_NAME_SEPARATOR] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[!=] Other[null] operator[&&] identifier[name] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[template] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getCard] operator[SEP] operator[SEP] operator[SEP] identifier[setHolderLastname] operator[SEP] identifier[StringUtils] operator[SEP] identifier[trimToNull] operator[SEP] identifier[name] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[template] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getCard] operator[SEP] operator[SEP] operator[SEP] identifier[setHolderFirstname] operator[SEP] identifier[StringUtils] operator[SEP] identifier[trimToNull] operator[SEP] identifier[name] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static void validate(SpiExpressionList<?> expressions,
ListExpressionValidation validation,
boolean ignoreUnknown) {
if (expressions == null) return;
List<SpiExpression> list = expressions.getUnderlyingList();
Iterator<SpiExpression> it = list.iterator();
while (it.hasNext()) {
it.next().validate(validation);
if (ignoreUnknown && !validation.lastValid()) {
it.remove();
}
}
} | class class_name[name] begin[{]
method[validate, return_type[void], modifier[public static], parameter[expressions, validation, ignoreUnknown]] begin[{]
if[binary_operation[member[.expressions], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[List], list]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
call[it.next, parameter[]]
if[binary_operation[member[.ignoreUnknown], &&, call[validation.lastValid, parameter[]]]] begin[{]
call[it.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[validate] operator[SEP] identifier[SpiExpressionList] operator[<] operator[?] operator[>] identifier[expressions] , identifier[ListExpressionValidation] identifier[validation] , Keyword[boolean] identifier[ignoreUnknown] operator[SEP] {
Keyword[if] operator[SEP] identifier[expressions] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[List] operator[<] identifier[SpiExpression] operator[>] identifier[list] operator[=] identifier[expressions] operator[SEP] identifier[getUnderlyingList] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[SpiExpression] operator[>] identifier[it] operator[=] identifier[list] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[validate] operator[SEP] identifier[validation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ignoreUnknown] operator[&&] operator[!] identifier[validation] operator[SEP] identifier[lastValid] operator[SEP] operator[SEP] operator[SEP] {
identifier[it] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void obtainShowDialogHeader(@NonNull final TypedArray typedArray) {
boolean defaultValue = getContext().getResources()
.getBoolean(R.bool.dialog_preference_default_show_dialog_header);
showDialogHeader(
typedArray.getBoolean(R.styleable.DialogPreference_showDialogHeader, defaultValue));
} | class class_name[name] begin[{]
method[obtainShowDialogHeader, return_type[void], modifier[private], parameter[typedArray]] begin[{]
local_variable[type[boolean], defaultValue]
call[.showDialogHeader, parameter[call[typedArray.getBoolean, parameter[member[R.styleable.DialogPreference_showDialogHeader], member[.defaultValue]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[obtainShowDialogHeader] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[TypedArray] identifier[typedArray] operator[SEP] {
Keyword[boolean] identifier[defaultValue] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getBoolean] operator[SEP] identifier[R] operator[SEP] identifier[bool] operator[SEP] identifier[dialog_preference_default_show_dialog_header] operator[SEP] operator[SEP] identifier[showDialogHeader] operator[SEP] identifier[typedArray] operator[SEP] identifier[getBoolean] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_showDialogHeader] , identifier[defaultValue] operator[SEP] operator[SEP] operator[SEP]
}
|
private void setExchangeRateChain(List<ExchangeRate> chain) {
this.chain.clear();
if (chain==null || chain.isEmpty()) {
this.chain.add(this);
} else {
for (ExchangeRate rate : chain) {
if (rate==null) {
throw new IllegalArgumentException("Rate Chain element can not be null.");
}
}
this.chain.addAll(chain);
}
} | class class_name[name] begin[{]
method[setExchangeRateChain, return_type[void], modifier[private], parameter[chain]] begin[{]
THIS[member[None.chain]call[None.clear, parameter[]]]
if[binary_operation[binary_operation[member[.chain], ==, literal[null]], ||, call[chain.isEmpty, parameter[]]]] begin[{]
THIS[member[None.chain]call[None.add, parameter[THIS[]]]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Rate Chain element can not be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=chain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExchangeRate, sub_type=None))), label=None)
THIS[member[None.chain]call[None.addAll, parameter[member[.chain]]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setExchangeRateChain] operator[SEP] identifier[List] operator[<] identifier[ExchangeRate] operator[>] identifier[chain] operator[SEP] {
Keyword[this] operator[SEP] identifier[chain] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[chain] operator[==] Other[null] operator[||] identifier[chain] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[chain] operator[SEP] identifier[add] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[ExchangeRate] identifier[rate] operator[:] identifier[chain] operator[SEP] {
Keyword[if] operator[SEP] identifier[rate] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[chain] operator[SEP] identifier[addAll] operator[SEP] identifier[chain] operator[SEP] operator[SEP]
}
}
|
static String primitiveTypeIDLName(Class type) {
if (type == Void.TYPE)
return "void";
if (type == Boolean.TYPE)
return "boolean";
if (type == Character.TYPE)
return "wchar";
if (type == Byte.TYPE)
return "octet";
if (type == Short.TYPE)
return "short";
if (type == Integer.TYPE)
return "long";
if (type == Long.TYPE)
return "long long";
if (type == Float.TYPE)
return "float";
if (type == Double.TYPE)
return "double";
throw IIOPLogger.ROOT_LOGGER.notAPrimitive(type.getName());
} | class class_name[name] begin[{]
method[primitiveTypeIDLName, return_type[type[String]], modifier[static], parameter[type]] begin[{]
if[binary_operation[member[.type], ==, member[Void.TYPE]]] begin[{]
return[literal["void"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Boolean.TYPE]]] begin[{]
return[literal["boolean"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Character.TYPE]]] begin[{]
return[literal["wchar"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Byte.TYPE]]] begin[{]
return[literal["octet"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Short.TYPE]]] begin[{]
return[literal["short"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Integer.TYPE]]] begin[{]
return[literal["long"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Long.TYPE]]] begin[{]
return[literal["long long"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Float.TYPE]]] begin[{]
return[literal["float"]]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[Double.TYPE]]] begin[{]
return[literal["double"]]
else begin[{]
None
end[}]
ThrowStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)], member=notAPrimitive, postfix_operators=[], prefix_operators=[], qualifier=IIOPLogger.ROOT_LOGGER, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[static] identifier[String] identifier[primitiveTypeIDLName] operator[SEP] identifier[Class] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Void] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Boolean] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Character] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Byte] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Short] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Integer] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Long] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Float] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[Double] operator[SEP] identifier[TYPE] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[throw] identifier[IIOPLogger] operator[SEP] identifier[ROOT_LOGGER] operator[SEP] identifier[notAPrimitive] operator[SEP] identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static JSONArray merge(JSONArray src, JSONArray dest,
boolean overwrite) {
return merge(src, dest, null, overwrite);
} | class class_name[name] begin[{]
method[merge, return_type[type[JSONArray]], modifier[public static], parameter[src, dest, overwrite]] begin[{]
return[call[.merge, parameter[member[.src], member[.dest], literal[null], member[.overwrite]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JSONArray] identifier[merge] operator[SEP] identifier[JSONArray] identifier[src] , identifier[JSONArray] identifier[dest] , Keyword[boolean] identifier[overwrite] operator[SEP] {
Keyword[return] identifier[merge] operator[SEP] identifier[src] , identifier[dest] , Other[null] , identifier[overwrite] operator[SEP] operator[SEP]
}
|
public void deployApplication(String applicationName) throws IOException {
final Optional<URL> defaultFileOptional = this.kubernetesAssistantDefaultResourcesLocator.locate();
if (defaultFileOptional.isPresent()) {
deployApplication(applicationName, defaultFileOptional.get());
} else {
log.warning("No default Kubernetes resources found at default locations.");
}
} | class class_name[name] begin[{]
method[deployApplication, return_type[void], modifier[public], parameter[applicationName]] begin[{]
local_variable[type[Optional], defaultFileOptional]
if[call[defaultFileOptional.isPresent, parameter[]]] begin[{]
call[.deployApplication, parameter[member[.applicationName], call[defaultFileOptional.get, parameter[]]]]
else begin[{]
call[log.warning, parameter[literal["No default Kubernetes resources found at default locations."]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deployApplication] operator[SEP] identifier[String] identifier[applicationName] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[Optional] operator[<] identifier[URL] operator[>] identifier[defaultFileOptional] operator[=] Keyword[this] operator[SEP] identifier[kubernetesAssistantDefaultResourcesLocator] operator[SEP] identifier[locate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[defaultFileOptional] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[deployApplication] operator[SEP] identifier[applicationName] , identifier[defaultFileOptional] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
@Override
public java.util.concurrent.Future<SendMessageResult> sendMessageAsync(String queueUrl, String messageBody,
com.amazonaws.handlers.AsyncHandler<SendMessageRequest, SendMessageResult> asyncHandler) {
return sendMessageAsync(new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody(messageBody), asyncHandler);
} | class class_name[name] begin[{]
method[sendMessageAsync, return_type[type[java]], modifier[public], parameter[queueUrl, messageBody, asyncHandler]] begin[{]
return[call[.sendMessageAsync, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=queueUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withQueueUrl, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=messageBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withMessageBody, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SendMessageRequest, sub_type=None)), member[.asyncHandler]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[concurrent] operator[SEP] identifier[Future] operator[<] identifier[SendMessageResult] operator[>] identifier[sendMessageAsync] operator[SEP] identifier[String] identifier[queueUrl] , identifier[String] identifier[messageBody] , identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[handlers] operator[SEP] identifier[AsyncHandler] operator[<] identifier[SendMessageRequest] , identifier[SendMessageResult] operator[>] identifier[asyncHandler] operator[SEP] {
Keyword[return] identifier[sendMessageAsync] operator[SEP] Keyword[new] identifier[SendMessageRequest] operator[SEP] operator[SEP] operator[SEP] identifier[withQueueUrl] operator[SEP] identifier[queueUrl] operator[SEP] operator[SEP] identifier[withMessageBody] operator[SEP] identifier[messageBody] operator[SEP] , identifier[asyncHandler] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SimpleAntlrPackage.GROUP__ELEMENTS:
getElements().clear();
getElements().addAll((Collection<? extends RuleElement>)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=GROUP__ELEMENTS, postfix_operators=[], prefix_operators=[], qualifier=SimpleAntlrPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=RuleElement, sub_type=None))], dimensions=[], name=Collection, sub_type=None))], member=addAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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[SuppressWarnings] operator[SEP] literal[String] operator[SEP] 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[SimpleAntlrPackage] operator[SEP] identifier[GROUP__ELEMENTS] operator[:] identifier[getElements] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[getElements] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[RuleElement] operator[>] 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]
}
|
protected String createDDMFormRuleCondition(DDMForm ddmForm) {
String notEmptyStatement = "not(isEmpty(getValue('%s')))";
List<DDMFormField> ddmFormFields = ddmForm.getDDMFormFields();
Stream<DDMFormField> stream = ddmFormFields.stream();
return stream.map(
field -> String.format(notEmptyStatement, field.getName())
).collect(
Collectors.joining(" OR ")
);
} | class class_name[name] begin[{]
method[createDDMFormRuleCondition, return_type[type[String]], modifier[protected], parameter[ddmForm]] begin[{]
local_variable[type[String], notEmptyStatement]
local_variable[type[List], ddmFormFields]
local_variable[type[Stream], stream]
return[call[stream.map, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=notEmptyStatement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), parameters=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[createDDMFormRuleCondition] operator[SEP] identifier[DDMForm] identifier[ddmForm] operator[SEP] {
identifier[String] identifier[notEmptyStatement] operator[=] literal[String] operator[SEP] identifier[List] operator[<] identifier[DDMFormField] operator[>] identifier[ddmFormFields] operator[=] identifier[ddmForm] operator[SEP] identifier[getDDMFormFields] operator[SEP] operator[SEP] operator[SEP] identifier[Stream] operator[<] identifier[DDMFormField] operator[>] identifier[stream] operator[=] identifier[ddmFormFields] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[stream] operator[SEP] identifier[map] operator[SEP] identifier[field] operator[->] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[notEmptyStatement] , identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[joining] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static SSLContext createSSLContext(String trustedNamesGroupKey) throws IOException {
SSLContext sslContext = null;
KeyManager[] keyManagers = null;
Map<String, Object> tlsMap = (Map<String, Object>)ClientConfig.get().getMappedConfig().get(TLS);
if(tlsMap != null) {
try {
// load key store for client certificate if two way ssl is used.
Boolean loadKeyStore = (Boolean) tlsMap.get(LOAD_KEY_STORE);
if (loadKeyStore != null && loadKeyStore) {
String keyStoreName = (String)tlsMap.get(KEY_STORE);
String keyStorePass = (String)ClientConfig.get().getSecretConfig().get(SecretConstants.CLIENT_KEYSTORE_PASS);
String keyPass = (String)ClientConfig.get().getSecretConfig().get(SecretConstants.CLIENT_KEY_PASS);
KeyStore keyStore = loadKeyStore(keyStoreName, keyStorePass.toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keyStore, keyPass.toCharArray());
keyManagers = keyManagerFactory.getKeyManagers();
}
} catch (NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException e) {
throw new IOException("Unable to initialise KeyManager[]", e);
}
TrustManager[] trustManagers = null;
try {
// load trust store, this is the server public key certificate
// first check if javax.net.ssl.trustStore system properties is set. It is only necessary if the server
// certificate doesn't have the entire chain.
Boolean loadTrustStore = (Boolean) tlsMap.get(LOAD_TRUST_STORE);
if (loadTrustStore != null && loadTrustStore) {
String trustStoreName = System.getProperty(TRUST_STORE_PROPERTY);
String trustStorePass = System.getProperty(TRUST_STORE_PASSWORD_PROPERTY);
if (trustStoreName != null && trustStorePass != null) {
if(logger.isInfoEnabled()) logger.info("Loading trust store from system property at " + Encode.forJava(trustStoreName));
} else {
trustStoreName = (String) tlsMap.get(TRUST_STORE);
trustStorePass = (String)ClientConfig.get().getSecretConfig().get(SecretConstants.CLIENT_TRUSTSTORE_PASS);
if(logger.isInfoEnabled()) logger.info("Loading trust store from config at " + Encode.forJava(trustStoreName));
}
if (trustStoreName != null && trustStorePass != null) {
KeyStore trustStore = loadKeyStore(trustStoreName, trustStorePass.toCharArray());
TLSConfig tlsConfig = TLSConfig.create(tlsMap, trustedNamesGroupKey);
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trustStore);
trustManagers = ClientX509ExtendedTrustManager.decorate(trustManagerFactory.getTrustManagers(), tlsConfig);
}
}
} catch (NoSuchAlgorithmException | KeyStoreException e) {
throw new IOException("Unable to initialise TrustManager[]", e);
}
try {
sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, trustManagers, null);
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new IOException("Unable to create and initialise the SSLContext", e);
}
} else {
logger.error("TLS configuration section is missing in client.yml");
}
return sslContext;
} | class class_name[name] begin[{]
method[createSSLContext, return_type[type[SSLContext]], modifier[public static], parameter[trustedNamesGroupKey]] begin[{]
local_variable[type[SSLContext], sslContext]
local_variable[type[KeyManager], keyManagers]
local_variable[type[Map], tlsMap]
if[binary_operation[member[.tlsMap], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=LOAD_KEY_STORE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tlsMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), name=loadKeyStore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=loadKeyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MemberReference(member=loadKeyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=KEY_STORE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tlsMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=keyStoreName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ClientConfig, selectors=[MethodInvocation(arguments=[], member=getSecretConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CLIENT_KEYSTORE_PASS, postfix_operators=[], prefix_operators=[], qualifier=SecretConstants, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=keyStorePass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ClientConfig, selectors=[MethodInvocation(arguments=[], member=getSecretConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CLIENT_KEY_PASS, postfix_operators=[], prefix_operators=[], qualifier=SecretConstants, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=keyPass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=keyStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=keyStorePass, selectors=[], type_arguments=None)], member=loadKeyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=keyStore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeyStore, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefaultAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=KeyManagerFactory, selectors=[], type_arguments=None)], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=KeyManagerFactory, selectors=[], type_arguments=None), name=keyManagerFactory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeyManagerFactory, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=keyPass, selectors=[], type_arguments=None)], member=init, postfix_operators=[], prefix_operators=[], qualifier=keyManagerFactory, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=keyManagers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getKeyManagers, postfix_operators=[], prefix_operators=[], qualifier=keyManagerFactory, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to initialise KeyManager[]"), 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException', 'UnrecoverableKeyException', 'KeyStoreException']))], finally_block=None, label=None, resources=None)
local_variable[type[TrustManager], trustManagers]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=LOAD_TRUST_STORE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tlsMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), name=loadTrustStore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=loadTrustStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MemberReference(member=loadTrustStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=TRUST_STORE_PROPERTY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=trustStoreName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=TRUST_STORE_PASSWORD_PROPERTY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=trustStorePass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=trustStorePass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=TRUST_STORE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tlsMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=trustStorePass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ClientConfig, selectors=[MethodInvocation(arguments=[], member=getSecretConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CLIENT_TRUSTSTORE_PASS, postfix_operators=[], prefix_operators=[], qualifier=SecretConstants, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Loading trust store from config at "), operandr=MethodInvocation(arguments=[MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forJava, postfix_operators=[], prefix_operators=[], qualifier=Encode, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Loading trust store from system property at "), operandr=MethodInvocation(arguments=[MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forJava, postfix_operators=[], prefix_operators=[], qualifier=Encode, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None))])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=trustStorePass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=trustStoreName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=trustStorePass, selectors=[], type_arguments=None)], member=loadKeyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=trustStore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeyStore, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tlsMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trustedNamesGroupKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=TLSConfig, selectors=[], type_arguments=None), name=tlsConfig)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TLSConfig, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefaultAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=KeyManagerFactory, selectors=[], type_arguments=None)], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=TrustManagerFactory, selectors=[], type_arguments=None), name=trustManagerFactory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TrustManagerFactory, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=trustStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=trustManagerFactory, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=trustManagers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTrustManagers, postfix_operators=[], prefix_operators=[], qualifier=trustManagerFactory, selectors=[], type_arguments=None), MemberReference(member=tlsConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decorate, postfix_operators=[], prefix_operators=[], qualifier=ClientX509ExtendedTrustManager, selectors=[], type_arguments=None)), label=None)]))]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to initialise TrustManager[]"), 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException', 'KeyStoreException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sslContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TLS")], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=SSLContext, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keyManagers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trustManagers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=init, postfix_operators=[], prefix_operators=[], qualifier=sslContext, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create and initialise the SSLContext"), 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException', 'KeyManagementException']))], finally_block=None, label=None, resources=None)
else begin[{]
call[logger.error, parameter[literal["TLS configuration section is missing in client.yml"]]]
end[}]
return[member[.sslContext]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[SSLContext] identifier[createSSLContext] operator[SEP] identifier[String] identifier[trustedNamesGroupKey] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[SSLContext] identifier[sslContext] operator[=] Other[null] operator[SEP] identifier[KeyManager] operator[SEP] operator[SEP] identifier[keyManagers] operator[=] Other[null] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[tlsMap] operator[=] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[ClientConfig] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getMappedConfig] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[TLS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tlsMap] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[Boolean] identifier[loadKeyStore] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[tlsMap] operator[SEP] identifier[get] operator[SEP] identifier[LOAD_KEY_STORE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loadKeyStore] operator[!=] Other[null] operator[&&] identifier[loadKeyStore] operator[SEP] {
identifier[String] identifier[keyStoreName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[tlsMap] operator[SEP] identifier[get] operator[SEP] identifier[KEY_STORE] operator[SEP] operator[SEP] identifier[String] identifier[keyStorePass] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[ClientConfig] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getSecretConfig] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[SecretConstants] operator[SEP] identifier[CLIENT_KEYSTORE_PASS] operator[SEP] operator[SEP] identifier[String] identifier[keyPass] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[ClientConfig] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getSecretConfig] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[SecretConstants] operator[SEP] identifier[CLIENT_KEY_PASS] operator[SEP] operator[SEP] identifier[KeyStore] identifier[keyStore] operator[=] identifier[loadKeyStore] operator[SEP] identifier[keyStoreName] , identifier[keyStorePass] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[KeyManagerFactory] identifier[keyManagerFactory] operator[=] identifier[KeyManagerFactory] operator[SEP] identifier[getInstance] operator[SEP] identifier[KeyManagerFactory] operator[SEP] identifier[getDefaultAlgorithm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[keyManagerFactory] operator[SEP] identifier[init] operator[SEP] identifier[keyStore] , identifier[keyPass] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[keyManagers] operator[=] identifier[keyManagerFactory] operator[SEP] identifier[getKeyManagers] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] operator[|] identifier[UnrecoverableKeyException] operator[|] identifier[KeyStoreException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[TrustManager] operator[SEP] operator[SEP] identifier[trustManagers] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[Boolean] identifier[loadTrustStore] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[tlsMap] operator[SEP] identifier[get] operator[SEP] identifier[LOAD_TRUST_STORE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loadTrustStore] operator[!=] Other[null] operator[&&] identifier[loadTrustStore] operator[SEP] {
identifier[String] identifier[trustStoreName] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[TRUST_STORE_PROPERTY] operator[SEP] operator[SEP] identifier[String] identifier[trustStorePass] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[TRUST_STORE_PASSWORD_PROPERTY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trustStoreName] operator[!=] Other[null] operator[&&] identifier[trustStorePass] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[Encode] operator[SEP] identifier[forJava] operator[SEP] identifier[trustStoreName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[trustStoreName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[tlsMap] operator[SEP] identifier[get] operator[SEP] identifier[TRUST_STORE] operator[SEP] operator[SEP] identifier[trustStorePass] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[ClientConfig] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getSecretConfig] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[SecretConstants] operator[SEP] identifier[CLIENT_TRUSTSTORE_PASS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[Encode] operator[SEP] identifier[forJava] operator[SEP] identifier[trustStoreName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[trustStoreName] operator[!=] Other[null] operator[&&] identifier[trustStorePass] operator[!=] Other[null] operator[SEP] {
identifier[KeyStore] identifier[trustStore] operator[=] identifier[loadKeyStore] operator[SEP] identifier[trustStoreName] , identifier[trustStorePass] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TLSConfig] identifier[tlsConfig] operator[=] identifier[TLSConfig] operator[SEP] identifier[create] operator[SEP] identifier[tlsMap] , identifier[trustedNamesGroupKey] operator[SEP] operator[SEP] identifier[TrustManagerFactory] identifier[trustManagerFactory] operator[=] identifier[TrustManagerFactory] operator[SEP] identifier[getInstance] operator[SEP] identifier[KeyManagerFactory] operator[SEP] identifier[getDefaultAlgorithm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[trustManagerFactory] operator[SEP] identifier[init] operator[SEP] identifier[trustStore] operator[SEP] operator[SEP] identifier[trustManagers] operator[=] identifier[ClientX509ExtendedTrustManager] operator[SEP] identifier[decorate] operator[SEP] identifier[trustManagerFactory] operator[SEP] identifier[getTrustManagers] operator[SEP] operator[SEP] , identifier[tlsConfig] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] operator[|] identifier[KeyStoreException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[sslContext] operator[=] identifier[SSLContext] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sslContext] operator[SEP] identifier[init] operator[SEP] identifier[keyManagers] , identifier[trustManagers] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] operator[|] identifier[KeyManagementException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sslContext] operator[SEP]
}
|
public synchronized boolean containsKey(CacheKey key) {
Preconditions.checkNotNull(key);
if (!mMap.containsKey(key)) {
return false;
}
EncodedImage storedEncodedImage = mMap.get(key);
synchronized (storedEncodedImage) {
if (!EncodedImage.isValid(storedEncodedImage)) {
// Reference is not valid, this means that someone cleared reference while it was still in
// use. Log error
// TODO: 3697790
mMap.remove(key);
FLog.w(
TAG,
"Found closed reference %d for key %s (%d)",
System.identityHashCode(storedEncodedImage),
key.getUriString(),
System.identityHashCode(key));
return false;
}
return true;
}
} | class class_name[name] begin[{]
method[containsKey, return_type[type[boolean]], modifier[synchronized public], parameter[key]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.key]]]
if[call[mMap.containsKey, parameter[member[.key]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[EncodedImage], storedEncodedImage]
SYNCHRONIZED[member[.storedEncodedImage]] BEGIN[{]
if[call[EncodedImage.isValid, parameter[member[.storedEncodedImage]]]] begin[{]
call[mMap.remove, parameter[member[.key]]]
call[FLog.w, parameter[member[.TAG], literal["Found closed reference %d for key %s (%d)"], call[System.identityHashCode, parameter[member[.storedEncodedImage]]], call[key.getUriString, parameter[]], call[System.identityHashCode, parameter[member[.key]]]]]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
END[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[boolean] identifier[containsKey] operator[SEP] identifier[CacheKey] identifier[key] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[mMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[EncodedImage] identifier[storedEncodedImage] operator[=] identifier[mMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[storedEncodedImage] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[EncodedImage] operator[SEP] identifier[isValid] operator[SEP] identifier[storedEncodedImage] operator[SEP] operator[SEP] {
identifier[mMap] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[FLog] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] , identifier[System] operator[SEP] identifier[identityHashCode] operator[SEP] identifier[storedEncodedImage] operator[SEP] , identifier[key] operator[SEP] identifier[getUriString] operator[SEP] operator[SEP] , identifier[System] operator[SEP] identifier[identityHashCode] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public static byte[] decodeUrl(final String arg) throws Exception {
String s = arg;
s = s.replace('-', '+'); // 62nd char of encoding
s = s.replace('_', '/'); // 63rd char of encoding
switch (s.length() % 4) // Pad with trailing '='s
{
case 0:
break; // No pad chars in this case
case 2:
s += "==";
break; // Two pad chars
case 3:
s += "=";
break; // One pad char
default:
throw new java.lang.Exception("Illegal base64url string!");
}
return Base64Util.decode(s);
} | class class_name[name] begin[{]
method[decodeUrl, return_type[type[byte]], modifier[public static], parameter[arg]] begin[{]
local_variable[type[String], s]
assign[member[.s], call[s.replace, parameter[literal['-'], literal['+']]]]
assign[member[.s], call[s.replace, parameter[literal['_'], literal['/']]]]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="==")), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=")), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal base64url string!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)))), label=None)])], expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=%), label=None)
return[call[Base64Util.decode, parameter[member[.s]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[decodeUrl] operator[SEP] Keyword[final] identifier[String] identifier[arg] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[s] operator[=] identifier[arg] operator[SEP] identifier[s] operator[=] identifier[s] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[s] operator[=] identifier[s] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[%] Other[4] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] identifier[s] operator[+=] literal[String] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[3] operator[:] identifier[s] operator[+=] literal[String] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Base64Util] operator[SEP] identifier[decode] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
|
protected void perturbCenter( Cluster c , int x , int y ) {
float best = Float.MAX_VALUE;
int bestX=0,bestY=0;
for( int dy = -1; dy <= 1; dy++ ) {
for( int dx = -1; dx <= 1; dx++ ) {
float d = gradient(x + dx, y + dy);
if( d < best ) {
best = d;
bestX = dx;
bestY = dy;
}
}
}
c.x = x+bestX;
c.y = y+bestY;
setColor(c.color,x+bestX,y+bestY);
} | class class_name[name] begin[{]
method[perturbCenter, return_type[void], modifier[protected], parameter[c, x, y]] begin[{]
local_variable[type[float], best]
local_variable[type[int], bestX]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=gradient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=best, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=best, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=dx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=dy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=dx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), name=dx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=dx, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=dy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), name=dy)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=dy, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[c.x], binary_operation[member[.x], +, member[.bestX]]]
assign[member[c.y], binary_operation[member[.y], +, member[.bestY]]]
call[.setColor, parameter[member[c.color], binary_operation[member[.x], +, member[.bestX]], binary_operation[member[.y], +, member[.bestY]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[perturbCenter] operator[SEP] identifier[Cluster] identifier[c] , Keyword[int] identifier[x] , Keyword[int] identifier[y] operator[SEP] {
Keyword[float] identifier[best] operator[=] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[int] identifier[bestX] operator[=] Other[0] , identifier[bestY] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[dy] operator[=] operator[-] Other[1] operator[SEP] identifier[dy] operator[<=] Other[1] operator[SEP] identifier[dy] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[dx] operator[=] operator[-] Other[1] operator[SEP] identifier[dx] operator[<=] Other[1] operator[SEP] identifier[dx] operator[++] operator[SEP] {
Keyword[float] identifier[d] operator[=] identifier[gradient] operator[SEP] identifier[x] operator[+] identifier[dx] , identifier[y] operator[+] identifier[dy] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[<] identifier[best] operator[SEP] {
identifier[best] operator[=] identifier[d] operator[SEP] identifier[bestX] operator[=] identifier[dx] operator[SEP] identifier[bestY] operator[=] identifier[dy] operator[SEP]
}
}
}
identifier[c] operator[SEP] identifier[x] operator[=] identifier[x] operator[+] identifier[bestX] operator[SEP] identifier[c] operator[SEP] identifier[y] operator[=] identifier[y] operator[+] identifier[bestY] operator[SEP] identifier[setColor] operator[SEP] identifier[c] operator[SEP] identifier[color] , identifier[x] operator[+] identifier[bestX] , identifier[y] operator[+] identifier[bestY] operator[SEP] operator[SEP]
}
|
public static void main(final String[] args) {
Switch about = new Switch("a", "about", "display about message");
Switch help = new Switch("h", "help", "display help message");
FileArgument refBedFile = new FileArgument("r", "ref-bed-file", "reference BED file", true);
FileArgument sourceBedFile = new FileArgument("i", "source-bed-file", "input BED file, default stdin", false);
FileArgument targetBedFile = new FileArgument("o", "target-bed-file", "output BED file, default stdout", false);
ArgumentList arguments = new ArgumentList(about, help, refBedFile, sourceBedFile, targetBedFile);
CommandLine commandLine = new CommandLine(args);
LiftoverBed liftoverBed = null;
try {
CommandLineParser.parse(commandLine, arguments);
if (about.wasFound()) {
About.about(System.out);
System.exit(0);
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
liftoverBed = new LiftoverBed(refBedFile.getValue(), sourceBedFile.getValue(), targetBedFile.getValue());
}
catch (CommandLineParseException e) {
if (about.wasFound()) {
About.about(System.out);
System.exit(0);
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(liftoverBed.call());
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[Switch], about]
local_variable[type[Switch], help]
local_variable[type[FileArgument], refBedFile]
local_variable[type[FileArgument], sourceBedFile]
local_variable[type[FileArgument], targetBedFile]
local_variable[type[ArgumentList], arguments]
local_variable[type[CommandLine], commandLine]
local_variable[type[LiftoverBed], liftoverBed]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=CommandLineParser, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=about, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=about, postfix_operators=[], prefix_operators=[], qualifier=About, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=help, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=USAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=Usage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=liftoverBed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=refBedFile, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=sourceBedFile, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=targetBedFile, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LiftoverBed, sub_type=None))), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=about, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=about, postfix_operators=[], prefix_operators=[], qualifier=About, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=wasFound, postfix_operators=[], prefix_operators=[], qualifier=help, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=USAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=Usage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=USAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=commandLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=err, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=Usage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CommandLineParseException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=call, postfix_operators=[], prefix_operators=[], qualifier=liftoverBed, selectors=[], type_arguments=None)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[Switch] identifier[about] operator[=] Keyword[new] identifier[Switch] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[Switch] identifier[help] operator[=] Keyword[new] identifier[Switch] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[FileArgument] identifier[refBedFile] operator[=] Keyword[new] identifier[FileArgument] operator[SEP] literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[FileArgument] identifier[sourceBedFile] operator[=] Keyword[new] identifier[FileArgument] operator[SEP] literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[FileArgument] identifier[targetBedFile] operator[=] Keyword[new] identifier[FileArgument] operator[SEP] literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[ArgumentList] identifier[arguments] operator[=] Keyword[new] identifier[ArgumentList] operator[SEP] identifier[about] , identifier[help] , identifier[refBedFile] , identifier[sourceBedFile] , identifier[targetBedFile] operator[SEP] operator[SEP] identifier[CommandLine] identifier[commandLine] operator[=] Keyword[new] identifier[CommandLine] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[LiftoverBed] identifier[liftoverBed] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[CommandLineParser] operator[SEP] identifier[parse] operator[SEP] identifier[commandLine] , identifier[arguments] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[about] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[About] operator[SEP] identifier[about] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[help] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[Usage] operator[SEP] identifier[usage] operator[SEP] identifier[USAGE] , Other[null] , identifier[commandLine] , identifier[arguments] , identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[liftoverBed] operator[=] Keyword[new] identifier[LiftoverBed] operator[SEP] identifier[refBedFile] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[sourceBedFile] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[targetBedFile] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CommandLineParseException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[about] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[About] operator[SEP] identifier[about] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[help] operator[SEP] identifier[wasFound] operator[SEP] operator[SEP] operator[SEP] {
identifier[Usage] operator[SEP] identifier[usage] operator[SEP] identifier[USAGE] , Other[null] , identifier[commandLine] , identifier[arguments] , identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[Usage] operator[SEP] identifier[usage] operator[SEP] identifier[USAGE] , identifier[e] , identifier[commandLine] , identifier[arguments] , identifier[System] operator[SEP] identifier[err] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[System] operator[SEP] identifier[exit] operator[SEP] identifier[liftoverBed] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
|
LayoutTiled.DataChunkIterator getDataChunkIteratorNoFilter(Section want, int nChunkDim) throws IOException {
/*
if (if (debugChunkOrder) ) {
DataChunkIteratorNoFilter iter = new DataChunkIteratorNoFilter(null, nChunkDim);
int count = 0;
int last = -1;
while (iter.hasNext()) {
LayoutTiled.DataChunk chunk = iter.next();
System.out.printf("%d : %d%n", count++, tiling.order(chunk.offset));
if (tiling.order(chunk.offset) <= last)
System.out.println("HEY");
last = tiling.order(chunk.offset);
}
}*/
return new DataChunkIteratorNoFilter(want, nChunkDim);
} | class class_name[name] begin[{]
method[getDataChunkIteratorNoFilter, return_type[type[LayoutTiled]], modifier[default], parameter[want, nChunkDim]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=want, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nChunkDim, 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=DataChunkIteratorNoFilter, sub_type=None))]
end[}]
END[}] | identifier[LayoutTiled] operator[SEP] identifier[DataChunkIterator] identifier[getDataChunkIteratorNoFilter] operator[SEP] identifier[Section] identifier[want] , Keyword[int] identifier[nChunkDim] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] Keyword[new] identifier[DataChunkIteratorNoFilter] operator[SEP] identifier[want] , identifier[nChunkDim] operator[SEP] operator[SEP]
}
|
protected final PrcAccDocGetForReverse lazyGetPrcAccDocGetForReverse(
final Map<String, Object> pAddParam) throws Exception {
@SuppressWarnings("unchecked")
PrcAccDocGetForReverse<RS, IDoc> proc = (PrcAccDocGetForReverse<RS, IDoc>)
this.processorsMap.get(PrcAccDocGetForReverse.class.getSimpleName());
if (proc == null) {
proc = new PrcAccDocGetForReverse<RS, IDoc>();
proc.setSrvOrm(getSrvOrm());
@SuppressWarnings("unchecked")
IEntityProcessor<IDoc, Long> procDlg =
(IEntityProcessor<IDoc, Long>)
this.fctBnEntitiesProcessors
.lazyGet(pAddParam, PrcEntityPbCopy.class.getSimpleName());
proc.setPrcAccEntityPbCopy(procDlg);
//assigning fully initialized object:
this.processorsMap
.put(PrcAccDocGetForReverse.class.getSimpleName(), proc);
}
return proc;
} | class class_name[name] begin[{]
method[lazyGetPrcAccDocGetForReverse, return_type[type[PrcAccDocGetForReverse]], modifier[final protected], parameter[pAddParam]] begin[{]
local_variable[type[PrcAccDocGetForReverse], proc]
if[binary_operation[member[.proc], ==, literal[null]]] begin[{]
assign[member[.proc], 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=RS, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IDoc, sub_type=None))], dimensions=None, name=PrcAccDocGetForReverse, sub_type=None))]
call[proc.setSrvOrm, parameter[call[.getSrvOrm, parameter[]]]]
local_variable[type[IEntityProcessor], procDlg]
call[proc.setPrcAccEntityPbCopy, parameter[member[.procDlg]]]
THIS[member[None.processorsMap]call[None.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PrcAccDocGetForReverse, sub_type=None)), member[.proc]]]]
else begin[{]
None
end[}]
return[member[.proc]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[PrcAccDocGetForReverse] identifier[lazyGetPrcAccDocGetForReverse] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pAddParam] operator[SEP] Keyword[throws] identifier[Exception] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[PrcAccDocGetForReverse] operator[<] identifier[RS] , identifier[IDoc] operator[>] identifier[proc] operator[=] operator[SEP] identifier[PrcAccDocGetForReverse] operator[<] identifier[RS] , identifier[IDoc] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[processorsMap] operator[SEP] identifier[get] operator[SEP] identifier[PrcAccDocGetForReverse] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proc] operator[==] Other[null] operator[SEP] {
identifier[proc] operator[=] Keyword[new] identifier[PrcAccDocGetForReverse] operator[<] identifier[RS] , identifier[IDoc] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[proc] operator[SEP] identifier[setSrvOrm] operator[SEP] identifier[getSrvOrm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[IEntityProcessor] operator[<] identifier[IDoc] , identifier[Long] operator[>] identifier[procDlg] operator[=] operator[SEP] identifier[IEntityProcessor] operator[<] identifier[IDoc] , identifier[Long] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[fctBnEntitiesProcessors] operator[SEP] identifier[lazyGet] operator[SEP] identifier[pAddParam] , identifier[PrcEntityPbCopy] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[proc] operator[SEP] identifier[setPrcAccEntityPbCopy] operator[SEP] identifier[procDlg] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[processorsMap] operator[SEP] identifier[put] operator[SEP] identifier[PrcAccDocGetForReverse] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[proc] operator[SEP] operator[SEP]
}
Keyword[return] identifier[proc] operator[SEP]
}
|
public static synchronized <T extends OrmLiteSqliteOpenHelper> T getHelper(Context context, Class<T> openHelperClass) {
if (openHelperClass == null) {
throw new IllegalArgumentException("openHelperClass argument is null");
}
innerSetHelperClass(openHelperClass);
return loadHelper(context, openHelperClass);
} | class class_name[name] begin[{]
method[getHelper, return_type[type[T]], modifier[synchronized public static], parameter[context, openHelperClass]] begin[{]
if[binary_operation[member[.openHelperClass], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="openHelperClass argument is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.innerSetHelperClass, parameter[member[.openHelperClass]]]
return[call[.loadHelper, parameter[member[.context], member[.openHelperClass]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] operator[<] identifier[T] Keyword[extends] identifier[OrmLiteSqliteOpenHelper] operator[>] identifier[T] identifier[getHelper] operator[SEP] identifier[Context] identifier[context] , identifier[Class] operator[<] identifier[T] operator[>] identifier[openHelperClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[openHelperClass] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[innerSetHelperClass] operator[SEP] identifier[openHelperClass] operator[SEP] operator[SEP] Keyword[return] identifier[loadHelper] operator[SEP] identifier[context] , identifier[openHelperClass] operator[SEP] operator[SEP]
}
|
public EnterpriseBeansType<EjbJarType<T>> getOrCreateEnterpriseBeans()
{
Node node = childNode.getOrCreate("enterprise-beans");
EnterpriseBeansType<EjbJarType<T>> enterpriseBeans = new EnterpriseBeansTypeImpl<EjbJarType<T>>(this, "enterprise-beans", childNode, node);
return enterpriseBeans;
} | class class_name[name] begin[{]
method[getOrCreateEnterpriseBeans, return_type[type[EnterpriseBeansType]], modifier[public], parameter[]] begin[{]
local_variable[type[Node], node]
local_variable[type[EnterpriseBeansType], enterpriseBeans]
return[member[.enterpriseBeans]]
end[}]
END[}] | Keyword[public] identifier[EnterpriseBeansType] operator[<] identifier[EjbJarType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateEnterpriseBeans] operator[SEP] operator[SEP] {
identifier[Node] identifier[node] operator[=] identifier[childNode] operator[SEP] identifier[getOrCreate] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[EnterpriseBeansType] operator[<] identifier[EjbJarType] operator[<] identifier[T] operator[>] operator[>] identifier[enterpriseBeans] operator[=] Keyword[new] identifier[EnterpriseBeansTypeImpl] operator[<] identifier[EjbJarType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[node] operator[SEP] operator[SEP] Keyword[return] identifier[enterpriseBeans] operator[SEP]
}
|
public Any execute(DeviceImpl device, Any in_any) throws DevFailed
{
Util.out4.println("StartLoggingCmd::execute(): arrived");
Logging.instance().start_logging();
Util.out4.println("Leaving StartLoggingCmd.execute()");
return Util.return_empty_any("StartLogging");
} | class class_name[name] begin[{]
method[execute, return_type[type[Any]], modifier[public], parameter[device, in_any]] begin[{]
call[Util.out4.println, parameter[literal["StartLoggingCmd::execute(): arrived"]]]
call[Logging.instance, parameter[]]
call[Util.out4.println, parameter[literal["Leaving StartLoggingCmd.execute()"]]]
return[call[Util.return_empty_any, parameter[literal["StartLogging"]]]]
end[}]
END[}] | Keyword[public] identifier[Any] identifier[execute] operator[SEP] identifier[DeviceImpl] identifier[device] , identifier[Any] identifier[in_any] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[Util] operator[SEP] identifier[out4] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Logging] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[start_logging] operator[SEP] operator[SEP] operator[SEP] identifier[Util] operator[SEP] identifier[out4] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[Util] operator[SEP] identifier[return_empty_any] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public void marshall(GetMappingRequest getMappingRequest, ProtocolMarshaller protocolMarshaller) {
if (getMappingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMappingRequest.getSource(), SOURCE_BINDING);
protocolMarshaller.marshall(getMappingRequest.getSinks(), SINKS_BINDING);
protocolMarshaller.marshall(getMappingRequest.getLocation(), LOCATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getMappingRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getMappingRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSource, postfix_operators=[], prefix_operators=[], qualifier=getMappingRequest, selectors=[], type_arguments=None), MemberReference(member=SOURCE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSinks, postfix_operators=[], prefix_operators=[], qualifier=getMappingRequest, selectors=[], type_arguments=None), MemberReference(member=SINKS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=getMappingRequest, selectors=[], type_arguments=None), MemberReference(member=LOCATION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetMappingRequest] identifier[getMappingRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getMappingRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getMappingRequest] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] , identifier[SOURCE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getMappingRequest] operator[SEP] identifier[getSinks] operator[SEP] operator[SEP] , identifier[SINKS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getMappingRequest] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] , identifier[LOCATION_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void marshall(JobData jobData, ProtocolMarshaller protocolMarshaller) {
if (jobData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobData.getActionTypeId(), ACTIONTYPEID_BINDING);
protocolMarshaller.marshall(jobData.getActionConfiguration(), ACTIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(jobData.getPipelineContext(), PIPELINECONTEXT_BINDING);
protocolMarshaller.marshall(jobData.getInputArtifacts(), INPUTARTIFACTS_BINDING);
protocolMarshaller.marshall(jobData.getOutputArtifacts(), OUTPUTARTIFACTS_BINDING);
protocolMarshaller.marshall(jobData.getArtifactCredentials(), ARTIFACTCREDENTIALS_BINDING);
protocolMarshaller.marshall(jobData.getContinuationToken(), CONTINUATIONTOKEN_BINDING);
protocolMarshaller.marshall(jobData.getEncryptionKey(), ENCRYPTIONKEY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[jobData, protocolMarshaller]] begin[{]
if[binary_operation[member[.jobData], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActionTypeId, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=ACTIONTYPEID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActionConfiguration, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=ACTIONCONFIGURATION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPipelineContext, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=PIPELINECONTEXT_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInputArtifacts, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=INPUTARTIFACTS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOutputArtifacts, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=OUTPUTARTIFACTS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getArtifactCredentials, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=ARTIFACTCREDENTIALS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getContinuationToken, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=CONTINUATIONTOKEN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEncryptionKey, postfix_operators=[], prefix_operators=[], qualifier=jobData, selectors=[], type_arguments=None), MemberReference(member=ENCRYPTIONKEY_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[JobData] identifier[jobData] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[jobData] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getActionTypeId] operator[SEP] operator[SEP] , identifier[ACTIONTYPEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getActionConfiguration] operator[SEP] operator[SEP] , identifier[ACTIONCONFIGURATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getPipelineContext] operator[SEP] operator[SEP] , identifier[PIPELINECONTEXT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getInputArtifacts] operator[SEP] operator[SEP] , identifier[INPUTARTIFACTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getOutputArtifacts] operator[SEP] operator[SEP] , identifier[OUTPUTARTIFACTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getArtifactCredentials] operator[SEP] operator[SEP] , identifier[ARTIFACTCREDENTIALS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getContinuationToken] operator[SEP] operator[SEP] , identifier[CONTINUATIONTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[jobData] operator[SEP] identifier[getEncryptionKey] operator[SEP] operator[SEP] , identifier[ENCRYPTIONKEY_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public ManagedArtifact getArtifact(String pathInfo) {
LOGGER.entering();
ManagedArtifact managedArtifact = serverRepository.getArtifact(pathInfo);
LOGGER.exiting(managedArtifact);
return managedArtifact;
} | class class_name[name] begin[{]
method[getArtifact, return_type[type[ManagedArtifact]], modifier[public], parameter[pathInfo]] begin[{]
call[LOGGER.entering, parameter[]]
local_variable[type[ManagedArtifact], managedArtifact]
call[LOGGER.exiting, parameter[member[.managedArtifact]]]
return[member[.managedArtifact]]
end[}]
END[}] | Keyword[public] identifier[ManagedArtifact] identifier[getArtifact] operator[SEP] identifier[String] identifier[pathInfo] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[entering] operator[SEP] operator[SEP] operator[SEP] identifier[ManagedArtifact] identifier[managedArtifact] operator[=] identifier[serverRepository] operator[SEP] identifier[getArtifact] operator[SEP] identifier[pathInfo] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[exiting] operator[SEP] identifier[managedArtifact] operator[SEP] operator[SEP] Keyword[return] identifier[managedArtifact] operator[SEP]
}
|
public com.google.api.ads.adwords.axis.v201809.cm.FeedItemDevicePreference getDevicePreference() {
return devicePreference;
} | class class_name[name] begin[{]
method[getDevicePreference, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.devicePreference]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[FeedItemDevicePreference] identifier[getDevicePreference] operator[SEP] operator[SEP] {
Keyword[return] identifier[devicePreference] operator[SEP]
}
|
protected ServiceTracker<IOptions, ?> getOptionsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException {
ServiceTracker<IOptions, ?> tracker = new ServiceTracker<IOptions, Object>(
bundleContext,
bundleContext.createFilter(
"(&(" + Constants.OBJECTCLASS + "=" + IOptions.class.getName() + //$NON-NLS-1$ //$NON-NLS-2$
")(name=" + getServletBundleName() + "))"), //$NON-NLS-1$ //$NON-NLS-2$
null);
tracker.open();
return tracker;
} | class class_name[name] begin[{]
method[getOptionsServiceTracker, return_type[type[ServiceTracker]], modifier[protected], parameter[bundleContext]] begin[{]
local_variable[type[ServiceTracker], tracker]
call[tracker.open, parameter[]]
return[member[.tracker]]
end[}]
END[}] | Keyword[protected] identifier[ServiceTracker] operator[<] identifier[IOptions] , operator[?] operator[>] identifier[getOptionsServiceTracker] operator[SEP] identifier[BundleContext] identifier[bundleContext] operator[SEP] Keyword[throws] identifier[InvalidSyntaxException] {
identifier[ServiceTracker] operator[<] identifier[IOptions] , operator[?] operator[>] identifier[tracker] operator[=] Keyword[new] identifier[ServiceTracker] operator[<] identifier[IOptions] , identifier[Object] operator[>] operator[SEP] identifier[bundleContext] , identifier[bundleContext] operator[SEP] identifier[createFilter] operator[SEP] literal[String] operator[+] identifier[Constants] operator[SEP] identifier[OBJECTCLASS] operator[+] literal[String] operator[+] identifier[IOptions] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getServletBundleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[tracker] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tracker] operator[SEP]
}
|
public final void synpred12_InternalSARL_fragment() throws RecognitionException {
// InternalSARL.g:8629:6: ( ( ( ( ruleJvmFormalParameter ) ) '=' ) )
// InternalSARL.g:8629:7: ( ( ( ruleJvmFormalParameter ) ) '=' )
{
// InternalSARL.g:8629:7: ( ( ( ruleJvmFormalParameter ) ) '=' )
// InternalSARL.g:8630:7: ( ( ruleJvmFormalParameter ) ) '='
{
// InternalSARL.g:8630:7: ( ( ruleJvmFormalParameter ) )
// InternalSARL.g:8631:8: ( ruleJvmFormalParameter )
{
// InternalSARL.g:8631:8: ( ruleJvmFormalParameter )
// InternalSARL.g:8632:9: ruleJvmFormalParameter
{
pushFollow(FOLLOW_83);
ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return ;
}
}
match(input,47,FOLLOW_2); if (state.failed) return ;
}
}
} | class class_name[name] begin[{]
method[synpred12_InternalSARL_fragment, return_type[void], modifier[final public], parameter[]] begin[{]
call[.pushFollow, parameter[member[.FOLLOW_83]]]
call[.ruleJvmFormalParameter, parameter[]]
member[state._fsp]
if[member[state.failed]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.match, parameter[member[.input], literal[47], member[.FOLLOW_2]]]
if[member[state.failed]] begin[{]
return[None]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[synpred12_InternalSARL_fragment] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
{
{
{
{
identifier[pushFollow] operator[SEP] identifier[FOLLOW_83] operator[SEP] operator[SEP] identifier[ruleJvmFormalParameter] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
}
identifier[match] operator[SEP] identifier[input] , Other[47] , identifier[FOLLOW_2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
}
}
|
@Override
public <T> List<T> search(String base, String filter, ContextMapper<T> mapper) {
return search(base, filter, defaultSearchScope, mapper);
} | class class_name[name] begin[{]
method[search, return_type[type[List]], modifier[public], parameter[base, filter, mapper]] begin[{]
return[call[.search, parameter[member[.base], member[.filter], member[.defaultSearchScope], member[.mapper]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[search] operator[SEP] identifier[String] identifier[base] , identifier[String] identifier[filter] , identifier[ContextMapper] operator[<] identifier[T] operator[>] identifier[mapper] operator[SEP] {
Keyword[return] identifier[search] operator[SEP] identifier[base] , identifier[filter] , identifier[defaultSearchScope] , identifier[mapper] operator[SEP] operator[SEP]
}
|
static MultiVertexGeometry planarSimplify(MultiVertexGeometry input_geom,
double tolerance, boolean use_winding_rule_for_polygons,
boolean dirty_result, ProgressTracker progress_tracker) {
TopologicalOperations topoOps = new TopologicalOperations();
return topoOps.planarSimplifyImpl_(input_geom, tolerance,
use_winding_rule_for_polygons, dirty_result, progress_tracker);
} | class class_name[name] begin[{]
method[planarSimplify, return_type[type[MultiVertexGeometry]], modifier[static], parameter[input_geom, tolerance, use_winding_rule_for_polygons, dirty_result, progress_tracker]] begin[{]
local_variable[type[TopologicalOperations], topoOps]
return[call[topoOps.planarSimplifyImpl_, parameter[member[.input_geom], member[.tolerance], member[.use_winding_rule_for_polygons], member[.dirty_result], member[.progress_tracker]]]]
end[}]
END[}] | Keyword[static] identifier[MultiVertexGeometry] identifier[planarSimplify] operator[SEP] identifier[MultiVertexGeometry] identifier[input_geom] , Keyword[double] identifier[tolerance] , Keyword[boolean] identifier[use_winding_rule_for_polygons] , Keyword[boolean] identifier[dirty_result] , identifier[ProgressTracker] identifier[progress_tracker] operator[SEP] {
identifier[TopologicalOperations] identifier[topoOps] operator[=] Keyword[new] identifier[TopologicalOperations] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[topoOps] operator[SEP] identifier[planarSimplifyImpl_] operator[SEP] identifier[input_geom] , identifier[tolerance] , identifier[use_winding_rule_for_polygons] , identifier[dirty_result] , identifier[progress_tracker] operator[SEP] operator[SEP]
}
|
public void setComplianceItems(java.util.Collection<ComplianceItem> complianceItems) {
if (complianceItems == null) {
this.complianceItems = null;
return;
}
this.complianceItems = new com.amazonaws.internal.SdkInternalList<ComplianceItem>(complianceItems);
} | class class_name[name] begin[{]
method[setComplianceItems, return_type[void], modifier[public], parameter[complianceItems]] begin[{]
if[binary_operation[member[.complianceItems], ==, literal[null]]] begin[{]
assign[THIS[member[None.complianceItems]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.complianceItems]], ClassCreator(arguments=[MemberReference(member=complianceItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ComplianceItem, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setComplianceItems] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[ComplianceItem] operator[>] identifier[complianceItems] operator[SEP] {
Keyword[if] operator[SEP] identifier[complianceItems] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[complianceItems] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[complianceItems] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[ComplianceItem] operator[>] operator[SEP] identifier[complianceItems] operator[SEP] operator[SEP]
}
|
@Override
public List<CPAttachmentFileEntry> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | class class_name[name] begin[{]
method[findAll, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[call[.findAll, parameter[member[QueryUtil.ALL_POS], member[QueryUtil.ALL_POS], literal[null]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[CPAttachmentFileEntry] operator[>] identifier[findAll] operator[SEP] operator[SEP] {
Keyword[return] identifier[findAll] operator[SEP] identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , Other[null] operator[SEP] operator[SEP]
}
|
public void addNavButtons()
{
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, UserGroup.USER_ICON, UserGroup.USER_DETAIL, null);
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, MenuConstants.FORMDETAIL, MenuConstants.FORMDETAIL, null);
super.addNavButtons();
} | class class_name[name] begin[{]
method[addNavButtons, return_type[void], modifier[public], parameter[]] begin[{]
ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=FIRST_SCREEN_LOCATION, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[]), MemberReference(member=SET_ANCHOR, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[])], member=getNextLocation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=DEFAULT_DISPLAY, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=USER_ICON, postfix_operators=[], prefix_operators=[], qualifier=UserGroup, selectors=[]), MemberReference(member=USER_DETAIL, postfix_operators=[], prefix_operators=[], qualifier=UserGroup, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SCannedBox, sub_type=None))
ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=FIRST_SCREEN_LOCATION, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[]), MemberReference(member=SET_ANCHOR, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[])], member=getNextLocation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=DEFAULT_DISPLAY, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=FORMDETAIL, postfix_operators=[], prefix_operators=[], qualifier=MenuConstants, selectors=[]), MemberReference(member=FORMDETAIL, postfix_operators=[], prefix_operators=[], qualifier=MenuConstants, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SCannedBox, sub_type=None))
SuperMethodInvocation(arguments=[], member=addNavButtons, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addNavButtons] operator[SEP] operator[SEP] {
Keyword[new] identifier[SCannedBox] operator[SEP] Keyword[this] operator[SEP] identifier[getNextLocation] operator[SEP] identifier[ScreenConstants] operator[SEP] identifier[FIRST_SCREEN_LOCATION] , identifier[ScreenConstants] operator[SEP] identifier[SET_ANCHOR] operator[SEP] , Keyword[this] , Other[null] , identifier[ScreenConstants] operator[SEP] identifier[DEFAULT_DISPLAY] , Other[null] , Other[null] , identifier[UserGroup] operator[SEP] identifier[USER_ICON] , identifier[UserGroup] operator[SEP] identifier[USER_DETAIL] , Other[null] operator[SEP] operator[SEP] Keyword[new] identifier[SCannedBox] operator[SEP] Keyword[this] operator[SEP] identifier[getNextLocation] operator[SEP] identifier[ScreenConstants] operator[SEP] identifier[FIRST_SCREEN_LOCATION] , identifier[ScreenConstants] operator[SEP] identifier[SET_ANCHOR] operator[SEP] , Keyword[this] , Other[null] , identifier[ScreenConstants] operator[SEP] identifier[DEFAULT_DISPLAY] , Other[null] , Other[null] , identifier[MenuConstants] operator[SEP] identifier[FORMDETAIL] , identifier[MenuConstants] operator[SEP] identifier[FORMDETAIL] , Other[null] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[addNavButtons] operator[SEP] operator[SEP] operator[SEP]
}
|
List<String> buildClassPath(String appClassPath) throws IOException {
String sparkHome = getSparkHome();
Set<String> cp = new LinkedHashSet<>();
addToClassPath(cp, appClassPath);
addToClassPath(cp, getConfDir());
boolean prependClasses = !isEmpty(getenv("SPARK_PREPEND_CLASSES"));
boolean isTesting = "1".equals(getenv("SPARK_TESTING"));
if (prependClasses || isTesting) {
String scala = getScalaVersion();
List<String> projects = Arrays.asList(
"common/kvstore",
"common/network-common",
"common/network-shuffle",
"common/network-yarn",
"common/sketch",
"common/tags",
"common/unsafe",
"core",
"examples",
"graphx",
"launcher",
"mllib",
"repl",
"resource-managers/mesos",
"resource-managers/yarn",
"sql/catalyst",
"sql/core",
"sql/hive",
"sql/hive-thriftserver",
"streaming"
);
if (prependClasses) {
if (!isTesting) {
System.err.println(
"NOTE: SPARK_PREPEND_CLASSES is set, placing locally compiled Spark classes ahead of " +
"assembly.");
}
for (String project : projects) {
addToClassPath(cp, String.format("%s/%s/target/scala-%s/classes", sparkHome, project,
scala));
}
}
if (isTesting) {
for (String project : projects) {
addToClassPath(cp, String.format("%s/%s/target/scala-%s/test-classes", sparkHome,
project, scala));
}
}
// Add this path to include jars that are shaded in the final deliverable created during
// the maven build. These jars are copied to this directory during the build.
addToClassPath(cp, String.format("%s/core/target/jars/*", sparkHome));
addToClassPath(cp, String.format("%s/mllib/target/jars/*", sparkHome));
}
// Add Spark jars to the classpath. For the testing case, we rely on the test code to set and
// propagate the test classpath appropriately. For normal invocation, look for the jars
// directory under SPARK_HOME.
boolean isTestingSql = "1".equals(getenv("SPARK_SQL_TESTING"));
String jarsDir = findJarsDir(getSparkHome(), getScalaVersion(), !isTesting && !isTestingSql);
if (jarsDir != null) {
addToClassPath(cp, join(File.separator, jarsDir, "*"));
}
addToClassPath(cp, getenv("HADOOP_CONF_DIR"));
addToClassPath(cp, getenv("YARN_CONF_DIR"));
addToClassPath(cp, getenv("SPARK_DIST_CLASSPATH"));
return new ArrayList<>(cp);
} | class class_name[name] begin[{]
method[buildClassPath, return_type[type[List]], modifier[default], parameter[appClassPath]] begin[{]
local_variable[type[String], sparkHome]
local_variable[type[Set], cp]
call[.addToClassPath, parameter[member[.cp], member[.appClassPath]]]
call[.addToClassPath, parameter[member[.cp], call[.getConfDir, parameter[]]]]
local_variable[type[boolean], prependClasses]
local_variable[type[boolean], isTesting]
if[binary_operation[member[.prependClasses], ||, member[.isTesting]]] begin[{]
local_variable[type[String], scala]
local_variable[type[List], projects]
if[member[.prependClasses]] begin[{]
if[member[.isTesting]] begin[{]
call[System.err.println, parameter[binary_operation[literal["NOTE: SPARK_PREPEND_CLASSES is set, placing locally compiled Spark classes ahead of "], +, literal["assembly."]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s/%s/target/scala-%s/classes"), MemberReference(member=sparkHome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=project, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scala, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=addToClassPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=projects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=project)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[member[.isTesting]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s/%s/target/scala-%s/test-classes"), MemberReference(member=sparkHome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=project, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scala, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=addToClassPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=projects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=project)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[.addToClassPath, parameter[member[.cp], call[String.format, parameter[literal["%s/core/target/jars/*"], member[.sparkHome]]]]]
call[.addToClassPath, parameter[member[.cp], call[String.format, parameter[literal["%s/mllib/target/jars/*"], member[.sparkHome]]]]]
else begin[{]
None
end[}]
local_variable[type[boolean], isTestingSql]
local_variable[type[String], jarsDir]
if[binary_operation[member[.jarsDir], !=, literal[null]]] begin[{]
call[.addToClassPath, parameter[member[.cp], call[.join, parameter[member[File.separator], member[.jarsDir], literal["*"]]]]]
else begin[{]
None
end[}]
call[.addToClassPath, parameter[member[.cp], call[.getenv, parameter[literal["HADOOP_CONF_DIR"]]]]]
call[.addToClassPath, parameter[member[.cp], call[.getenv, parameter[literal["YARN_CONF_DIR"]]]]]
call[.addToClassPath, parameter[member[.cp], call[.getenv, parameter[literal["SPARK_DIST_CLASSPATH"]]]]]
return[ClassCreator(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
END[}] | identifier[List] operator[<] identifier[String] operator[>] identifier[buildClassPath] operator[SEP] identifier[String] identifier[appClassPath] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[sparkHome] operator[=] identifier[getSparkHome] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[cp] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[appClassPath] operator[SEP] operator[SEP] identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[getConfDir] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[prependClasses] operator[=] operator[!] identifier[isEmpty] operator[SEP] identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isTesting] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prependClasses] operator[||] identifier[isTesting] operator[SEP] {
identifier[String] identifier[scala] operator[=] identifier[getScalaVersion] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[projects] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prependClasses] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isTesting] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[project] operator[:] identifier[projects] operator[SEP] {
identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sparkHome] , identifier[project] , identifier[scala] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[isTesting] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[project] operator[:] identifier[projects] operator[SEP] {
identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sparkHome] , identifier[project] , identifier[scala] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sparkHome] operator[SEP] operator[SEP] operator[SEP] identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sparkHome] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[isTestingSql] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[jarsDir] operator[=] identifier[findJarsDir] operator[SEP] identifier[getSparkHome] operator[SEP] operator[SEP] , identifier[getScalaVersion] operator[SEP] operator[SEP] , operator[!] identifier[isTesting] operator[&&] operator[!] identifier[isTestingSql] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jarsDir] operator[!=] Other[null] operator[SEP] {
identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[join] operator[SEP] identifier[File] operator[SEP] identifier[separator] , identifier[jarsDir] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[addToClassPath] operator[SEP] identifier[cp] , identifier[getenv] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[cp] operator[SEP] operator[SEP]
}
|
public static Cookie newCookie(final String name, final String value, final String purpose,
final String domain, final int maxAge, final String path, final boolean secure)
{
final Cookie cookie = new Cookie(name, value);
cookie.setComment(purpose);
cookie.setDomain(domain);
cookie.setMaxAge(maxAge);
cookie.setPath(path);
return cookie;
} | class class_name[name] begin[{]
method[newCookie, return_type[type[Cookie]], modifier[public static], parameter[name, value, purpose, domain, maxAge, path, secure]] begin[{]
local_variable[type[Cookie], cookie]
call[cookie.setComment, parameter[member[.purpose]]]
call[cookie.setDomain, parameter[member[.domain]]]
call[cookie.setMaxAge, parameter[member[.maxAge]]]
call[cookie.setPath, parameter[member[.path]]]
return[member[.cookie]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Cookie] identifier[newCookie] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[value] , Keyword[final] identifier[String] identifier[purpose] , Keyword[final] identifier[String] identifier[domain] , Keyword[final] Keyword[int] identifier[maxAge] , Keyword[final] identifier[String] identifier[path] , Keyword[final] Keyword[boolean] identifier[secure] operator[SEP] {
Keyword[final] identifier[Cookie] identifier[cookie] operator[=] Keyword[new] identifier[Cookie] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] identifier[cookie] operator[SEP] identifier[setComment] operator[SEP] identifier[purpose] operator[SEP] operator[SEP] identifier[cookie] operator[SEP] identifier[setDomain] operator[SEP] identifier[domain] operator[SEP] operator[SEP] identifier[cookie] operator[SEP] identifier[setMaxAge] operator[SEP] identifier[maxAge] operator[SEP] operator[SEP] identifier[cookie] operator[SEP] identifier[setPath] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[cookie] operator[SEP]
}
|
protected boolean isOpenAPIMethod(MethodDoc methodDoc) {
AnnotationDesc[] annotations = methodDoc.annotations();
boolean isActionMethod = false;
for (int i = 0; i < annotations.length; i++) {
if (annotations[i].annotationType().name().equals("RequestMapping")
|| annotations[i].annotationType().name().equals("PostMapping")
|| annotations[i].annotationType().name().equals("GetMapping")
|| annotations[i].annotationType().name().equals("DeleteMapping")
|| annotations[i].annotationType().name().equals("PutMapping")
|| annotations[i].annotationType().name().equals("PatchMapping") ) {
isActionMethod = true;
break;
}
}
Tag[] t = methodDoc.tags(WRAPITaglet.NAME);
return isActionMethod
|| t.length > 0
|| this.isProgramElementDocAnnotatedWith(methodDoc, "javax.ws.rs.Path");
} | class class_name[name] begin[{]
method[isOpenAPIMethod, return_type[type[boolean]], modifier[protected], parameter[methodDoc]] begin[{]
local_variable[type[AnnotationDesc], annotations]
local_variable[type[boolean], isActionMethod]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RequestMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PostMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=||), operandr=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GetMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=||), operandr=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DeleteMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=||), operandr=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PutMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=||), operandr=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=annotationType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PatchMapping")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isActionMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=annotations, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[Tag], t]
return[binary_operation[binary_operation[member[.isActionMethod], ||, binary_operation[member[t.length], >, literal[0]]], ||, THIS[call[None.isProgramElementDocAnnotatedWith, parameter[member[.methodDoc], literal["javax.ws.rs.Path"]]]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isOpenAPIMethod] operator[SEP] identifier[MethodDoc] identifier[methodDoc] operator[SEP] {
identifier[AnnotationDesc] operator[SEP] operator[SEP] identifier[annotations] operator[=] identifier[methodDoc] operator[SEP] identifier[annotations] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isActionMethod] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[annotations] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[annotations] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[isActionMethod] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[Tag] operator[SEP] operator[SEP] identifier[t] operator[=] identifier[methodDoc] operator[SEP] identifier[tags] operator[SEP] identifier[WRAPITaglet] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] Keyword[return] identifier[isActionMethod] operator[||] identifier[t] operator[SEP] identifier[length] operator[>] Other[0] operator[||] Keyword[this] operator[SEP] identifier[isProgramElementDocAnnotatedWith] operator[SEP] identifier[methodDoc] , literal[String] operator[SEP] operator[SEP]
}
|
public void addAndExpression(final INodeReadTrx mTransaction) {
assert getPipeStack().size() >= 2;
final AbsAxis mOperand2 = getPipeStack().pop().getExpr();
final AbsAxis operand1 = getPipeStack().pop().getExpr();
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(new AndExpr(mTransaction, operand1, mOperand2));
} | class class_name[name] begin[{]
method[addAndExpression, return_type[void], modifier[public], parameter[mTransaction]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPipeStack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>=), label=None, value=None)
local_variable[type[AbsAxis], mOperand2]
local_variable[type[AbsAxis], operand1]
if[binary_operation[call[.getPipeStack, parameter[]], ||, binary_operation[call[.getExpression, parameter[]], !=, literal[0]]]] begin[{]
call[.addExpressionSingle, parameter[]]
else begin[{]
None
end[}]
call[.getExpression, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addAndExpression] operator[SEP] Keyword[final] identifier[INodeReadTrx] identifier[mTransaction] operator[SEP] {
Keyword[assert] identifier[getPipeStack] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[2] operator[SEP] Keyword[final] identifier[AbsAxis] identifier[mOperand2] operator[=] identifier[getPipeStack] operator[SEP] operator[SEP] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] identifier[getExpr] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[AbsAxis] identifier[operand1] operator[=] identifier[getPipeStack] operator[SEP] operator[SEP] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] identifier[getExpr] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getPipeStack] operator[SEP] operator[SEP] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[||] identifier[getExpression] operator[SEP] operator[SEP] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[addExpressionSingle] operator[SEP] operator[SEP] operator[SEP]
}
identifier[getExpression] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[AndExpr] operator[SEP] identifier[mTransaction] , identifier[operand1] , identifier[mOperand2] operator[SEP] operator[SEP] operator[SEP]
}
|
public void renameUid(final String type, final String oldname,
final String newname) {
Tags.validateString(type, oldname);
Tags.validateString(type, newname);
if (type.toLowerCase().equals("metric")) {
try {
this.metrics.getId(oldname);
this.metrics.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else if (type.toLowerCase().equals("tagk")) {
try {
this.tag_names.getId(oldname);
this.tag_names.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else if (type.toLowerCase().equals("tagv")) {
try {
this.tag_values.getId(oldname);
this.tag_values.rename(oldname, newname);
} catch (NoSuchUniqueName nsue) {
throw new IllegalArgumentException("Name(\"" + oldname +
"\") does not exist");
}
} else {
LOG.warn("Unknown type name: " + type);
throw new IllegalArgumentException("Unknown type name");
}
} | class class_name[name] begin[{]
method[renameUid, return_type[void], modifier[public], parameter[type, oldname, newname]] begin[{]
call[Tags.validateString, parameter[member[.type], member[.oldname]]]
call[Tags.validateString, parameter[member[.type], member[.newname]]]
if[call[type.toLowerCase, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=metrics, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=metrics, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Name(\""), operandr=MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\") does not exist"), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nsue, types=['NoSuchUniqueName']))], finally_block=None, label=None, resources=None)
else begin[{]
if[call[type.toLowerCase, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tag_names, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tag_names, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Name(\""), operandr=MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\") does not exist"), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nsue, types=['NoSuchUniqueName']))], finally_block=None, label=None, resources=None)
else begin[{]
if[call[type.toLowerCase, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tag_values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tag_values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Name(\""), operandr=MemberReference(member=oldname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\") does not exist"), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nsue, types=['NoSuchUniqueName']))], finally_block=None, label=None, resources=None)
else begin[{]
call[LOG.warn, parameter[binary_operation[literal["Unknown type name: "], +, member[.type]]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown type name")], 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[}]
END[}] | Keyword[public] Keyword[void] identifier[renameUid] operator[SEP] Keyword[final] identifier[String] identifier[type] , Keyword[final] identifier[String] identifier[oldname] , Keyword[final] identifier[String] identifier[newname] operator[SEP] {
identifier[Tags] operator[SEP] identifier[validateString] operator[SEP] identifier[type] , identifier[oldname] operator[SEP] operator[SEP] identifier[Tags] operator[SEP] identifier[validateString] operator[SEP] identifier[type] , identifier[newname] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[metrics] operator[SEP] identifier[getId] operator[SEP] identifier[oldname] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[metrics] operator[SEP] identifier[rename] operator[SEP] identifier[oldname] , identifier[newname] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[nsue] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[oldname] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[tag_names] operator[SEP] identifier[getId] operator[SEP] identifier[oldname] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[tag_names] operator[SEP] identifier[rename] operator[SEP] identifier[oldname] , identifier[newname] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[nsue] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[oldname] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[tag_values] operator[SEP] identifier[getId] operator[SEP] identifier[oldname] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[tag_values] operator[SEP] identifier[rename] operator[SEP] identifier[oldname] , identifier[newname] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[nsue] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[oldname] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[type] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
private boolean isEligibleForEviction(SegmentMetadata metadata, long sequenceNumberCutoff) {
return !metadata.isPinned()
&& (metadata.getLastUsed() < sequenceNumberCutoff
|| metadata.isDeleted() && metadata.getLastUsed() <= this.lastTruncatedSequenceNumber.get());
} | class class_name[name] begin[{]
method[isEligibleForEviction, return_type[type[boolean]], modifier[private], parameter[metadata, sequenceNumberCutoff]] begin[{]
return[binary_operation[call[metadata.isPinned, parameter[]], &&, binary_operation[binary_operation[call[metadata.getLastUsed, parameter[]], <, member[.sequenceNumberCutoff]], ||, binary_operation[call[metadata.isDeleted, parameter[]], &&, binary_operation[call[metadata.getLastUsed, parameter[]], <=, THIS[member[None.lastTruncatedSequenceNumber]call[None.get, parameter[]]]]]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isEligibleForEviction] operator[SEP] identifier[SegmentMetadata] identifier[metadata] , Keyword[long] identifier[sequenceNumberCutoff] operator[SEP] {
Keyword[return] operator[!] identifier[metadata] operator[SEP] identifier[isPinned] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[metadata] operator[SEP] identifier[getLastUsed] operator[SEP] operator[SEP] operator[<] identifier[sequenceNumberCutoff] operator[||] identifier[metadata] operator[SEP] identifier[isDeleted] operator[SEP] operator[SEP] operator[&&] identifier[metadata] operator[SEP] identifier[getLastUsed] operator[SEP] operator[SEP] operator[<=] Keyword[this] operator[SEP] identifier[lastTruncatedSequenceNumber] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void setHandlerData(Object data)
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(setPolicy);
handlerDataLocal.set(data);
} | class class_name[name] begin[{]
method[setHandlerData, return_type[void], modifier[public static], parameter[data]] begin[{]
local_variable[type[SecurityManager], sm]
if[binary_operation[member[.sm], !=, literal[null]]] begin[{]
call[sm.checkPermission, parameter[member[.setPolicy]]]
else begin[{]
None
end[}]
call[handlerDataLocal.set, parameter[member[.data]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setHandlerData] operator[SEP] identifier[Object] identifier[data] operator[SEP] {
identifier[SecurityManager] identifier[sm] operator[=] identifier[System] operator[SEP] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sm] operator[!=] Other[null] operator[SEP] identifier[sm] operator[SEP] identifier[checkPermission] operator[SEP] identifier[setPolicy] operator[SEP] operator[SEP] identifier[handlerDataLocal] operator[SEP] identifier[set] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
|
public static StringPrep getInstance(int profile) {
if (profile < 0 || profile > MAX_PROFILE) {
throw new IllegalArgumentException("Bad profile type");
}
StringPrep instance = null;
// A StringPrep instance is immutable. We use a single instance
// per type and store it in the internal cache.
synchronized (CACHE) {
WeakReference<StringPrep> ref = CACHE[profile];
if (ref != null) {
instance = ref.get();
}
if (instance == null) {
ByteBuffer bytes = ICUBinary.getRequiredData(PROFILE_NAMES[profile] + ".spp");
if (bytes != null) {
try {
instance = new StringPrep(bytes);
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
if (instance != null) {
CACHE[profile] = new WeakReference<StringPrep>(instance);
}
}
}
return instance;
} | class class_name[name] begin[{]
method[getInstance, return_type[type[StringPrep]], modifier[public static], parameter[profile]] begin[{]
if[binary_operation[binary_operation[member[.profile], <, literal[0]], ||, binary_operation[member[.profile], >, member[.MAX_PROFILE]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad profile type")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[StringPrep], instance]
SYNCHRONIZED[member[.CACHE]] BEGIN[{]
local_variable[type[WeakReference], ref]
if[binary_operation[member[.ref], !=, literal[null]]] begin[{]
assign[member[.instance], call[ref.get, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.instance], ==, literal[null]]] begin[{]
local_variable[type[ByteBuffer], bytes]
if[binary_operation[member[.bytes], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringPrep, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ICUUncheckedIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.instance], !=, literal[null]]] begin[{]
assign[member[.CACHE], ClassCreator(arguments=[MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StringPrep, sub_type=None))], dimensions=None, name=WeakReference, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
END[}]
return[member[.instance]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StringPrep] identifier[getInstance] operator[SEP] Keyword[int] identifier[profile] operator[SEP] {
Keyword[if] operator[SEP] identifier[profile] operator[<] Other[0] operator[||] identifier[profile] operator[>] identifier[MAX_PROFILE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[StringPrep] identifier[instance] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[CACHE] operator[SEP] {
identifier[WeakReference] operator[<] identifier[StringPrep] operator[>] identifier[ref] operator[=] identifier[CACHE] operator[SEP] identifier[profile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ref] operator[!=] Other[null] operator[SEP] {
identifier[instance] operator[=] identifier[ref] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[instance] operator[==] Other[null] operator[SEP] {
identifier[ByteBuffer] identifier[bytes] operator[=] identifier[ICUBinary] operator[SEP] identifier[getRequiredData] operator[SEP] identifier[PROFILE_NAMES] operator[SEP] identifier[profile] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bytes] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[instance] operator[=] Keyword[new] identifier[StringPrep] operator[SEP] identifier[bytes] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ICUUncheckedIOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[instance] operator[!=] Other[null] operator[SEP] {
identifier[CACHE] operator[SEP] identifier[profile] operator[SEP] operator[=] Keyword[new] identifier[WeakReference] operator[<] identifier[StringPrep] operator[>] operator[SEP] identifier[instance] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[instance] operator[SEP]
}
|
public static void addSupport(AbstractModule module) {
module.bindInstance(SQLCodegenModule.ENTITYPATH_TYPE, RelationalPathSpatial.class);
registerTypes(module.get(Configuration.class));
registerTypes(module.get(TypeMappings.class));
addImports(module);
} | class class_name[name] begin[{]
method[addSupport, return_type[void], modifier[public static], parameter[module]] begin[{]
call[module.bindInstance, parameter[member[SQLCodegenModule.ENTITYPATH_TYPE], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RelationalPathSpatial, sub_type=None))]]
call[.registerTypes, parameter[call[module.get, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Configuration, sub_type=None))]]]]
call[.registerTypes, parameter[call[module.get, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeMappings, sub_type=None))]]]]
call[.addImports, parameter[member[.module]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addSupport] operator[SEP] identifier[AbstractModule] identifier[module] operator[SEP] {
identifier[module] operator[SEP] identifier[bindInstance] operator[SEP] identifier[SQLCodegenModule] operator[SEP] identifier[ENTITYPATH_TYPE] , identifier[RelationalPathSpatial] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[registerTypes] operator[SEP] identifier[module] operator[SEP] identifier[get] operator[SEP] identifier[Configuration] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[registerTypes] operator[SEP] identifier[module] operator[SEP] identifier[get] operator[SEP] identifier[TypeMappings] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[addImports] operator[SEP] identifier[module] operator[SEP] operator[SEP]
}
|
protected static Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>>
configureBigQueryWrite() {
Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure = new HashMap<>();
tableConfigure.put(
"user", new WriteToBigQuery.FieldInfo<>("STRING", (c, w) -> c.element().getKey()));
tableConfigure.put(
"total_score",
new WriteToBigQuery.FieldInfo<>("INTEGER", (c, w) -> c.element().getValue()));
return tableConfigure;
} | class class_name[name] begin[{]
method[configureBigQueryWrite, return_type[type[Map]], modifier[static protected], parameter[]] begin[{]
local_variable[type[Map], tableConfigure]
call[tableConfigure.put, parameter[literal["user"], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="STRING"), LambdaExpression(body=MethodInvocation(arguments=[], member=element, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[], member=getKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[InferredFormalParameter(name=c), InferredFormalParameter(name=w)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriteToBigQuery, sub_type=ReferenceType(arguments=[], dimensions=None, name=FieldInfo, sub_type=None)))]]
call[tableConfigure.put, parameter[literal["total_score"], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTEGER"), LambdaExpression(body=MethodInvocation(arguments=[], member=element, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[InferredFormalParameter(name=c), InferredFormalParameter(name=w)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WriteToBigQuery, sub_type=ReferenceType(arguments=[], dimensions=None, name=FieldInfo, sub_type=None)))]]
return[member[.tableConfigure]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[WriteToBigQuery] operator[SEP] identifier[FieldInfo] operator[<] identifier[KV] operator[<] identifier[String] , identifier[Integer] operator[>] operator[>] operator[>] identifier[configureBigQueryWrite] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[WriteToBigQuery] operator[SEP] identifier[FieldInfo] operator[<] identifier[KV] operator[<] identifier[String] , identifier[Integer] operator[>] operator[>] operator[>] identifier[tableConfigure] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[tableConfigure] operator[SEP] identifier[put] operator[SEP] literal[String] , Keyword[new] identifier[WriteToBigQuery] operator[SEP] identifier[FieldInfo] operator[<] operator[>] operator[SEP] literal[String] , operator[SEP] identifier[c] , identifier[w] operator[SEP] operator[->] identifier[c] operator[SEP] identifier[element] operator[SEP] operator[SEP] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[tableConfigure] operator[SEP] identifier[put] operator[SEP] literal[String] , Keyword[new] identifier[WriteToBigQuery] operator[SEP] identifier[FieldInfo] operator[<] operator[>] operator[SEP] literal[String] , operator[SEP] identifier[c] , identifier[w] operator[SEP] operator[->] identifier[c] operator[SEP] identifier[element] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tableConfigure] operator[SEP]
}
|
CommandLine getCommandLine() {
if (getWorkingDirectory() == null) {
if (commonsExecCommandLine.isFile()) {
File exec = new File(commonsExecCommandLine.getExecutable());
File dir = exec.getParentFile();
if (dir == null) {
throw new IllegalStateException(
"directory MUST be set (and could not be auto-determined from executable, although it was a File)");
}
this.setWorkingDirectory(dir);
// DO NOT } else {
// throw new
// IllegalStateException("directory MUST be set (and could not be auto-determined from executable)");
}
}
return commonsExecCommandLine;
} | class class_name[name] begin[{]
method[getCommandLine, return_type[type[CommandLine]], modifier[default], parameter[]] begin[{]
if[binary_operation[call[.getWorkingDirectory, parameter[]], ==, literal[null]]] begin[{]
if[call[commonsExecCommandLine.isFile, parameter[]]] begin[{]
local_variable[type[File], exec]
local_variable[type[File], dir]
if[binary_operation[member[.dir], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="directory MUST be set (and could not be auto-determined from executable, although it was a File)")], 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[}]
THIS[call[None.setWorkingDirectory, parameter[member[.dir]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.commonsExecCommandLine]]
end[}]
END[}] | identifier[CommandLine] identifier[getCommandLine] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getWorkingDirectory] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[commonsExecCommandLine] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[File] identifier[exec] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[commonsExecCommandLine] operator[SEP] identifier[getExecutable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[dir] operator[=] identifier[exec] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dir] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[setWorkingDirectory] operator[SEP] identifier[dir] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[commonsExecCommandLine] operator[SEP]
}
|
public static boolean isVetoed(Class<?> javaClass) {
if (javaClass.isAnnotationPresent(Vetoed.class)) {
return true;
}
return isPackageVetoed(javaClass.getPackage());
} | class class_name[name] begin[{]
method[isVetoed, return_type[type[boolean]], modifier[public static], parameter[javaClass]] begin[{]
if[call[javaClass.isAnnotationPresent, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Vetoed, sub_type=None))]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[.isPackageVetoed, parameter[call[javaClass.getPackage, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isVetoed] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[javaClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[javaClass] operator[SEP] identifier[isAnnotationPresent] operator[SEP] identifier[Vetoed] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[isPackageVetoed] operator[SEP] identifier[javaClass] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized Bundle deployBundle(final URI bundleLocation, final boolean startBundle,
final Integer startLevel) {
stateChanged = true;
if (startLevel != null && startLevel < currentFrameworkStartLevelValue) {
setFrameworkStartLevel(startLevel);
}
File bundleFile = convertURIToFile(bundleLocation);
String bundleLocationString = bundleLocation.toString();
Bundle installedBundle = null;
BundleData bundleData = getBundleData(bundleFile);
if (bundleData == null) {
return null;
}
URI realBundleLocation = bundleLocation;
if (!bundleData.getEvaluatedLocationFile().getAbsoluteFile().equals(bundleFile.getAbsoluteFile())) {
String newRealBundleLocationStr = "reference:" + bundleData.getEvaluatedLocationFile().toURI().toString();
try {
realBundleLocation = new URI(newRealBundleLocationStr);
} catch (URISyntaxException e) {
Logger.error("Real bundle location canno be parsed as an URI: " + newRealBundleLocationStr, e);
}
}
Bundle originalBundle = bundleDeployerService.getExistingBundleBySymbolicName(bundleData.getSymbolicName(),
bundleData.getVersion(), bundleLocation);
if (originalBundle != null) {
installedBundlesWithStartFlag.remove(originalBundle);
BundleStartLevel originalBundleStartLevel = originalBundle.adapt(BundleStartLevel.class);
int originalBundleStartLevelValue = originalBundleStartLevel.getStartLevel();
if (originalBundleStartLevelValue < currentFrameworkStartLevelValue) {
setFrameworkStartLevel(originalBundleStartLevelValue);
}
if (originalBundle.getLocation().equals(bundleLocation)) {
try {
if (originalBundle.getState() == Bundle.ACTIVE) {
Logger.info("Stopping already existing bundle " + originalBundle.toString());
originalBundle.stop();
}
Logger.info("Calling update on bundle " + originalBundle.toString());
originalBundle.update();
installedBundle = originalBundle;
BundleStartLevel installedBundleStartLevel = installedBundle.adapt(BundleStartLevel.class);
if (startLevel != null && !startLevel.equals(installedBundleStartLevel.getStartLevel())) {
installedBundleStartLevel.setStartLevel(startLevel);
}
} catch (BundleException e) {
Logger.error("Error during deploying bundle: " + bundleLocationString, e);
}
} else {
try {
Logger.info("Uninstalling Bundle " + originalBundle.getSymbolicName() + ":"
+ originalBundle.getVersion().toString());
originalBundle.uninstall();
Logger.info("Installing bundle from '" + bundleLocationString + "'");
installedBundle = systemBundleContext.installBundle(realBundleLocation.toString());
BundleStartLevel newBundleStartLevel = installedBundle.adapt(BundleStartLevel.class);
if (startLevel == null) {
newBundleStartLevel.setStartLevel(originalBundleStartLevelValue);
} else {
newBundleStartLevel.setStartLevel(startLevel);
}
} catch (BundleException e) {
Logger.error("Error during deploying bundle: " + bundleLocationString, e);
}
}
} else {
try {
Integer startLevelToUse = startLevel;
if (startLevelToUse == null) {
startLevelToUse = originalFrameworkStartLevelValue;
}
Logger.info("Installing new bundle from folder '" + bundleLocationString + "' with startLevel "
+ startLevelToUse);
installedBundle = systemBundleContext.installBundle(realBundleLocation.toString());
BundleStartLevel bundleStartLevel = installedBundle.adapt(BundleStartLevel.class);
bundleStartLevel.setStartLevel(startLevelToUse);
} catch (BundleException e) {
Logger.error("Error during deploying bundle: " + bundleLocationString, e);
}
}
if (startBundle && installedBundle != null) {
installedBundlesWithStartFlag.add(installedBundle);
}
return installedBundle;
} | class class_name[name] begin[{]
method[deployBundle, return_type[type[Bundle]], modifier[synchronized public], parameter[bundleLocation, startBundle, startLevel]] begin[{]
assign[member[.stateChanged], literal[true]]
if[binary_operation[binary_operation[member[.startLevel], !=, literal[null]], &&, binary_operation[member[.startLevel], <, member[.currentFrameworkStartLevelValue]]]] begin[{]
call[.setFrameworkStartLevel, parameter[member[.startLevel]]]
else begin[{]
None
end[}]
local_variable[type[File], bundleFile]
local_variable[type[String], bundleLocationString]
local_variable[type[Bundle], installedBundle]
local_variable[type[BundleData], bundleData]
if[binary_operation[member[.bundleData], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[URI], realBundleLocation]
if[call[bundleData.getEvaluatedLocationFile, parameter[]]] begin[{]
local_variable[type[String], newRealBundleLocationStr]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=realBundleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=newRealBundleLocationStr, 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))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Real bundle location canno be parsed as an URI: "), operandr=MemberReference(member=newRealBundleLocationStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
local_variable[type[Bundle], originalBundle]
if[binary_operation[member[.originalBundle], !=, literal[null]]] begin[{]
call[installedBundlesWithStartFlag.remove, parameter[member[.originalBundle]]]
local_variable[type[BundleStartLevel], originalBundleStartLevel]
local_variable[type[int], originalBundleStartLevelValue]
if[binary_operation[member[.originalBundleStartLevelValue], <, member[.currentFrameworkStartLevelValue]]] begin[{]
call[.setFrameworkStartLevel, parameter[member[.originalBundleStartLevelValue]]]
else begin[{]
None
end[}]
if[call[originalBundle.getLocation, parameter[]]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getState, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), operandr=MemberReference(member=ACTIVE, postfix_operators=[], prefix_operators=[], qualifier=Bundle, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Stopping already existing bundle "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=stop, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Calling update on bundle "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=update, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=installedBundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=originalBundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundleStartLevel, sub_type=None))], member=adapt, postfix_operators=[], prefix_operators=[], qualifier=installedBundle, selectors=[], type_arguments=None), name=installedBundleStartLevel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BundleStartLevel, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=startLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStartLevel, postfix_operators=[], prefix_operators=[], qualifier=installedBundleStartLevel, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=startLevel, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=startLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setStartLevel, postfix_operators=[], prefix_operators=[], qualifier=installedBundleStartLevel, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error during deploying bundle: "), operandr=MemberReference(member=bundleLocationString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BundleException']))], finally_block=None, label=None, resources=None)
else begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Uninstalling Bundle "), operandr=MethodInvocation(arguments=[], member=getSymbolicName, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MethodInvocation(arguments=[], member=getVersion, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=uninstall, postfix_operators=[], prefix_operators=[], qualifier=originalBundle, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Installing bundle from '"), operandr=MemberReference(member=bundleLocationString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=installedBundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=realBundleLocation, selectors=[], type_arguments=None)], member=installBundle, postfix_operators=[], prefix_operators=[], qualifier=systemBundleContext, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundleStartLevel, sub_type=None))], member=adapt, postfix_operators=[], prefix_operators=[], qualifier=installedBundle, selectors=[], type_arguments=None), name=newBundleStartLevel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BundleStartLevel, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=startLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=startLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setStartLevel, postfix_operators=[], prefix_operators=[], qualifier=newBundleStartLevel, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=originalBundleStartLevelValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setStartLevel, postfix_operators=[], prefix_operators=[], qualifier=newBundleStartLevel, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error during deploying bundle: "), operandr=MemberReference(member=bundleLocationString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BundleException']))], finally_block=None, label=None, resources=None)
end[}]
else begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=startLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=startLevelToUse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=startLevelToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=startLevelToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=originalFrameworkStartLevelValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Installing new bundle from folder '"), operandr=MemberReference(member=bundleLocationString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' with startLevel "), operator=+), operandr=MemberReference(member=startLevelToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=installedBundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=realBundleLocation, selectors=[], type_arguments=None)], member=installBundle, postfix_operators=[], prefix_operators=[], qualifier=systemBundleContext, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundleStartLevel, sub_type=None))], member=adapt, postfix_operators=[], prefix_operators=[], qualifier=installedBundle, selectors=[], type_arguments=None), name=bundleStartLevel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BundleStartLevel, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=startLevelToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setStartLevel, postfix_operators=[], prefix_operators=[], qualifier=bundleStartLevel, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error during deploying bundle: "), operandr=MemberReference(member=bundleLocationString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BundleException']))], finally_block=None, label=None, resources=None)
end[}]
if[binary_operation[member[.startBundle], &&, binary_operation[member[.installedBundle], !=, literal[null]]]] begin[{]
call[installedBundlesWithStartFlag.add, parameter[member[.installedBundle]]]
else begin[{]
None
end[}]
return[member[.installedBundle]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[Bundle] identifier[deployBundle] operator[SEP] Keyword[final] identifier[URI] identifier[bundleLocation] , Keyword[final] Keyword[boolean] identifier[startBundle] , Keyword[final] identifier[Integer] identifier[startLevel] operator[SEP] {
identifier[stateChanged] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[startLevel] operator[!=] Other[null] operator[&&] identifier[startLevel] operator[<] identifier[currentFrameworkStartLevelValue] operator[SEP] {
identifier[setFrameworkStartLevel] operator[SEP] identifier[startLevel] operator[SEP] operator[SEP]
}
identifier[File] identifier[bundleFile] operator[=] identifier[convertURIToFile] operator[SEP] identifier[bundleLocation] operator[SEP] operator[SEP] identifier[String] identifier[bundleLocationString] operator[=] identifier[bundleLocation] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Bundle] identifier[installedBundle] operator[=] Other[null] operator[SEP] identifier[BundleData] identifier[bundleData] operator[=] identifier[getBundleData] operator[SEP] identifier[bundleFile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bundleData] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[URI] identifier[realBundleLocation] operator[=] identifier[bundleLocation] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[bundleData] operator[SEP] identifier[getEvaluatedLocationFile] operator[SEP] operator[SEP] operator[SEP] identifier[getAbsoluteFile] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[bundleFile] operator[SEP] identifier[getAbsoluteFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[newRealBundleLocationStr] operator[=] literal[String] operator[+] identifier[bundleData] operator[SEP] identifier[getEvaluatedLocationFile] operator[SEP] operator[SEP] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[realBundleLocation] operator[=] Keyword[new] identifier[URI] operator[SEP] identifier[newRealBundleLocationStr] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
identifier[Logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[newRealBundleLocationStr] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[Bundle] identifier[originalBundle] operator[=] identifier[bundleDeployerService] operator[SEP] identifier[getExistingBundleBySymbolicName] operator[SEP] identifier[bundleData] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] , identifier[bundleData] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] , identifier[bundleLocation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[originalBundle] operator[!=] Other[null] operator[SEP] {
identifier[installedBundlesWithStartFlag] operator[SEP] identifier[remove] operator[SEP] identifier[originalBundle] operator[SEP] operator[SEP] identifier[BundleStartLevel] identifier[originalBundleStartLevel] operator[=] identifier[originalBundle] operator[SEP] identifier[adapt] operator[SEP] identifier[BundleStartLevel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[int] identifier[originalBundleStartLevelValue] operator[=] identifier[originalBundleStartLevel] operator[SEP] identifier[getStartLevel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[originalBundleStartLevelValue] operator[<] identifier[currentFrameworkStartLevelValue] operator[SEP] {
identifier[setFrameworkStartLevel] operator[SEP] identifier[originalBundleStartLevelValue] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[originalBundle] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[bundleLocation] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[originalBundle] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[==] identifier[Bundle] operator[SEP] identifier[ACTIVE] operator[SEP] {
identifier[Logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[originalBundle] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[originalBundle] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[originalBundle] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[originalBundle] operator[SEP] identifier[update] operator[SEP] operator[SEP] operator[SEP] identifier[installedBundle] operator[=] identifier[originalBundle] operator[SEP] identifier[BundleStartLevel] identifier[installedBundleStartLevel] operator[=] identifier[installedBundle] operator[SEP] identifier[adapt] operator[SEP] identifier[BundleStartLevel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startLevel] operator[!=] Other[null] operator[&&] operator[!] identifier[startLevel] operator[SEP] identifier[equals] operator[SEP] identifier[installedBundleStartLevel] operator[SEP] identifier[getStartLevel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[installedBundleStartLevel] operator[SEP] identifier[setStartLevel] operator[SEP] identifier[startLevel] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[BundleException] identifier[e] operator[SEP] {
identifier[Logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[bundleLocationString] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[try] {
identifier[Logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[originalBundle] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[originalBundle] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[originalBundle] operator[SEP] identifier[uninstall] operator[SEP] operator[SEP] operator[SEP] identifier[Logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[bundleLocationString] operator[+] literal[String] operator[SEP] operator[SEP] identifier[installedBundle] operator[=] identifier[systemBundleContext] operator[SEP] identifier[installBundle] operator[SEP] identifier[realBundleLocation] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BundleStartLevel] identifier[newBundleStartLevel] operator[=] identifier[installedBundle] operator[SEP] identifier[adapt] operator[SEP] identifier[BundleStartLevel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startLevel] operator[==] Other[null] operator[SEP] {
identifier[newBundleStartLevel] operator[SEP] identifier[setStartLevel] operator[SEP] identifier[originalBundleStartLevelValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[newBundleStartLevel] operator[SEP] identifier[setStartLevel] operator[SEP] identifier[startLevel] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[BundleException] identifier[e] operator[SEP] {
identifier[Logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[bundleLocationString] , identifier[e] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
Keyword[try] {
identifier[Integer] identifier[startLevelToUse] operator[=] identifier[startLevel] operator[SEP] Keyword[if] operator[SEP] identifier[startLevelToUse] operator[==] Other[null] operator[SEP] {
identifier[startLevelToUse] operator[=] identifier[originalFrameworkStartLevelValue] operator[SEP]
}
identifier[Logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[bundleLocationString] operator[+] literal[String] operator[+] identifier[startLevelToUse] operator[SEP] operator[SEP] identifier[installedBundle] operator[=] identifier[systemBundleContext] operator[SEP] identifier[installBundle] operator[SEP] identifier[realBundleLocation] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BundleStartLevel] identifier[bundleStartLevel] operator[=] identifier[installedBundle] operator[SEP] identifier[adapt] operator[SEP] identifier[BundleStartLevel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[bundleStartLevel] operator[SEP] identifier[setStartLevel] operator[SEP] identifier[startLevelToUse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BundleException] identifier[e] operator[SEP] {
identifier[Logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[bundleLocationString] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[startBundle] operator[&&] identifier[installedBundle] operator[!=] Other[null] operator[SEP] {
identifier[installedBundlesWithStartFlag] operator[SEP] identifier[add] operator[SEP] identifier[installedBundle] operator[SEP] operator[SEP]
}
Keyword[return] identifier[installedBundle] operator[SEP]
}
|
public static <E> Iterator<E> tap(Iterator<E> iterator, Consumer<E> consumer) {
return new TransformingIterator<E, E>(iterator, new Tapper<E>(consumer));
} | class class_name[name] begin[{]
method[tap, return_type[type[Iterator]], modifier[public static], parameter[iterator, consumer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=None, name=Tapper, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=None, name=TransformingIterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[Iterator] operator[<] identifier[E] operator[>] identifier[tap] operator[SEP] identifier[Iterator] operator[<] identifier[E] operator[>] identifier[iterator] , identifier[Consumer] operator[<] identifier[E] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] Keyword[new] identifier[TransformingIterator] operator[<] identifier[E] , identifier[E] operator[>] operator[SEP] identifier[iterator] , Keyword[new] identifier[Tapper] operator[<] identifier[E] operator[>] operator[SEP] identifier[consumer] operator[SEP] operator[SEP] operator[SEP]
}
|
public Optional<AlertPolicy> show(String name, long policyId)
{
Optional<AlertPolicy> ret = Optional.absent();
Collection<AlertPolicy> policies = list(name);
for(AlertPolicy policy : policies)
{
if(policy.getId() == policyId)
ret = Optional.of(policy);
}
return ret;
} | class class_name[name] begin[{]
method[show, return_type[type[Optional]], modifier[public], parameter[name, policyId]] begin[{]
local_variable[type[Optional], ret]
local_variable[type[Collection], policies]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=policy, selectors=[], type_arguments=None), operandr=MemberReference(member=policyId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=policy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None)), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=policies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=policy)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AlertPolicy, sub_type=None))), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[Optional] operator[<] identifier[AlertPolicy] operator[>] identifier[show] operator[SEP] identifier[String] identifier[name] , Keyword[long] identifier[policyId] operator[SEP] {
identifier[Optional] operator[<] identifier[AlertPolicy] operator[>] identifier[ret] operator[=] identifier[Optional] operator[SEP] identifier[absent] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[AlertPolicy] operator[>] identifier[policies] operator[=] identifier[list] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AlertPolicy] identifier[policy] operator[:] identifier[policies] operator[SEP] {
Keyword[if] operator[SEP] identifier[policy] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[==] identifier[policyId] operator[SEP] identifier[ret] operator[=] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[policy] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static String escape(String input, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
for (Character character : special) {
sb.append(character);
}
sb.append(echar);
String s = Matcher.quoteReplacement(new String(new char[]{echar}));
return input.replaceAll("[" + Pattern.quote(sb.toString()) + "]", s + "$0");
} | class class_name[name] begin[{]
method[escape, return_type[type[String]], modifier[public static], parameter[input, echar, special]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=character, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=special, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=character)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None))), label=None)
call[sb.append, parameter[member[.echar]]]
local_variable[type[String], s]
return[call[input.replaceAll, parameter[binary_operation[binary_operation[literal["["], +, call[Pattern.quote, parameter[call[sb.toString, parameter[]]]]], +, literal["]"]], binary_operation[member[.s], +, literal["$0"]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[escape] operator[SEP] identifier[String] identifier[input] , Keyword[char] identifier[echar] , Keyword[char] operator[SEP] operator[SEP] identifier[special] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Character] identifier[character] operator[:] identifier[special] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[character] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[echar] operator[SEP] operator[SEP] identifier[String] identifier[s] operator[=] identifier[Matcher] operator[SEP] identifier[quoteReplacement] operator[SEP] Keyword[new] identifier[String] operator[SEP] Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
identifier[echar]
} operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[input] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[+] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[s] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
@EventHandler
public void handle(ChargingStationPlacedEvent event) {
LOG.info("ChargingStationPlacedEvent");
updateLocationForChargingStation(event.getChargingStationId(), event.getCoordinates(), event.getAddress(), event.getAccessibility());
} | class class_name[name] begin[{]
method[handle, return_type[void], modifier[public], parameter[event]] begin[{]
call[LOG.info, parameter[literal["ChargingStationPlacedEvent"]]]
call[.updateLocationForChargingStation, parameter[call[event.getChargingStationId, parameter[]], call[event.getCoordinates, parameter[]], call[event.getAddress, parameter[]], call[event.getAccessibility, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[EventHandler] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[ChargingStationPlacedEvent] identifier[event] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[updateLocationForChargingStation] operator[SEP] identifier[event] operator[SEP] identifier[getChargingStationId] operator[SEP] operator[SEP] , identifier[event] operator[SEP] identifier[getCoordinates] operator[SEP] operator[SEP] , identifier[event] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[event] operator[SEP] identifier[getAccessibility] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.