code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
private int getSlotCount(int memory, int vcores) {
int cpuports = (int) Math.ceil(vcores / JOYConstants.JSTORM_VCORE_WEIGHT);
int memoryports = (int) Math.floor(memory / JOYConstants.JSTORM_MEMORY_WEIGHT);
// return cpuports > memoryports ? memoryports : cpuports;
return memoryports;
} | class class_name[name] begin[{]
method[getSlotCount, return_type[type[int]], modifier[private], parameter[memory, vcores]] begin[{]
local_variable[type[int], cpuports]
local_variable[type[int], memoryports]
return[member[.memoryports]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[getSlotCount] operator[SEP] Keyword[int] identifier[memory] , Keyword[int] identifier[vcores] operator[SEP] {
Keyword[int] identifier[cpuports] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[vcores] operator[/] identifier[JOYConstants] operator[SEP] identifier[JSTORM_VCORE_WEIGHT] operator[SEP] operator[SEP] Keyword[int] identifier[memoryports] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[memory] operator[/] identifier[JOYConstants] operator[SEP] identifier[JSTORM_MEMORY_WEIGHT] operator[SEP] operator[SEP] Keyword[return] identifier[memoryports] operator[SEP]
}
|
private RenditionMetadata getExactMatchRendition(final Set<RenditionMetadata> candidates, MediaArgs mediaArgs) {
// check for fixed width and/or height request
if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches(mediaArgs.getFixedWidth(), mediaArgs.getFixedHeight())) {
return candidate;
}
}
}
// otherwise check for media format restriction
else if (mediaArgs.getMediaFormats() != null && mediaArgs.getMediaFormats().length > 0) {
return visitMediaFormats(mediaArgs, new MediaFormatVisitor<RenditionMetadata>() {
@Override
public RenditionMetadata visit(MediaFormat mediaFormat) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches((int)mediaFormat.getEffectiveMinWidth(),
(int)mediaFormat.getEffectiveMinHeight(),
(int)mediaFormat.getEffectiveMaxWidth(),
(int)mediaFormat.getEffectiveMaxHeight(),
mediaFormat.getRatio())) {
candidate.setMediaFormat(mediaFormat);
return candidate;
}
}
return null;
}
});
}
// no restriction - return original or first rendition
else {
return getOriginalOrFirstRendition(candidates);
}
// none found
return null;
} | class class_name[name] begin[{]
method[getExactMatchRendition, return_type[type[RenditionMetadata]], modifier[private], parameter[candidates, mediaArgs]] begin[{]
if[binary_operation[binary_operation[call[mediaArgs.getFixedWidth, parameter[]], >, literal[0]], ||, binary_operation[call[mediaArgs.getFixedHeight, parameter[]], >, literal[0]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFixedWidth, postfix_operators=[], prefix_operators=[], qualifier=mediaArgs, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFixedHeight, postfix_operators=[], prefix_operators=[], qualifier=mediaArgs, selectors=[], type_arguments=None)], member=matches, postfix_operators=[], prefix_operators=[], qualifier=candidate, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=candidates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=candidate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RenditionMetadata, sub_type=None))), label=None)
else begin[{]
if[binary_operation[binary_operation[call[mediaArgs.getMediaFormats, parameter[]], !=, literal[null]], &&, binary_operation[call[mediaArgs.getMediaFormats, parameter[]], >, literal[0]]]] begin[{]
return[call[.visitMediaFormats, parameter[member[.mediaArgs], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[], member=getEffectiveMinWidth, postfix_operators=[], prefix_operators=[], qualifier=mediaFormat, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), Cast(expression=MethodInvocation(arguments=[], member=getEffectiveMinHeight, postfix_operators=[], prefix_operators=[], qualifier=mediaFormat, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), Cast(expression=MethodInvocation(arguments=[], member=getEffectiveMaxWidth, postfix_operators=[], prefix_operators=[], qualifier=mediaFormat, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), Cast(expression=MethodInvocation(arguments=[], member=getEffectiveMaxHeight, postfix_operators=[], prefix_operators=[], qualifier=mediaFormat, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), MethodInvocation(arguments=[], member=getRatio, postfix_operators=[], prefix_operators=[], qualifier=mediaFormat, selectors=[], type_arguments=None)], member=matches, postfix_operators=[], prefix_operators=[], qualifier=candidate, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mediaFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setMediaFormat, postfix_operators=[], prefix_operators=[], qualifier=candidate, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=candidates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=candidate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RenditionMetadata, sub_type=None))), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], documentation=None, modifiers={'public'}, name=visit, parameters=[FormalParameter(annotations=[], modifiers=set(), name=mediaFormat, type=ReferenceType(arguments=None, dimensions=[], name=MediaFormat, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=RenditionMetadata, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RenditionMetadata, sub_type=None))], dimensions=None, name=MediaFormatVisitor, sub_type=None))]]]
else begin[{]
return[call[.getOriginalOrFirstRendition, parameter[member[.candidates]]]]
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[RenditionMetadata] identifier[getExactMatchRendition] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[RenditionMetadata] operator[>] identifier[candidates] , identifier[MediaArgs] identifier[mediaArgs] operator[SEP] {
Keyword[if] operator[SEP] identifier[mediaArgs] operator[SEP] identifier[getFixedWidth] operator[SEP] operator[SEP] operator[>] Other[0] operator[||] identifier[mediaArgs] operator[SEP] identifier[getFixedHeight] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[RenditionMetadata] identifier[candidate] operator[:] identifier[candidates] operator[SEP] {
Keyword[if] operator[SEP] identifier[candidate] operator[SEP] identifier[matches] operator[SEP] identifier[mediaArgs] operator[SEP] identifier[getFixedWidth] operator[SEP] operator[SEP] , identifier[mediaArgs] operator[SEP] identifier[getFixedHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[candidate] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[mediaArgs] operator[SEP] identifier[getMediaFormats] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[mediaArgs] operator[SEP] identifier[getMediaFormats] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[visitMediaFormats] operator[SEP] identifier[mediaArgs] , Keyword[new] identifier[MediaFormatVisitor] operator[<] identifier[RenditionMetadata] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[RenditionMetadata] identifier[visit] operator[SEP] identifier[MediaFormat] identifier[mediaFormat] operator[SEP] {
Keyword[for] operator[SEP] identifier[RenditionMetadata] identifier[candidate] operator[:] identifier[candidates] operator[SEP] {
Keyword[if] operator[SEP] identifier[candidate] operator[SEP] identifier[matches] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[mediaFormat] operator[SEP] identifier[getEffectiveMinWidth] operator[SEP] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] identifier[mediaFormat] operator[SEP] identifier[getEffectiveMinHeight] operator[SEP] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] identifier[mediaFormat] operator[SEP] identifier[getEffectiveMaxWidth] operator[SEP] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] identifier[mediaFormat] operator[SEP] identifier[getEffectiveMaxHeight] operator[SEP] operator[SEP] , identifier[mediaFormat] operator[SEP] identifier[getRatio] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[candidate] operator[SEP] identifier[setMediaFormat] operator[SEP] identifier[mediaFormat] operator[SEP] operator[SEP] Keyword[return] identifier[candidate] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[getOriginalOrFirstRendition] operator[SEP] identifier[candidates] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected void decodeFilters(final FacesContext context, final Sheet sheet, final Map<String, String> params,
final String clientId) {
int renderCol = 0;
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") != null) {
final String value = params.get(clientId + "_filter_" + renderCol);
column.setFilterValue(value);
}
renderCol++;
}
} | class class_name[name] begin[{]
method[decodeFilters, return_type[void], modifier[protected], parameter[context, sheet, params, clientId]] begin[{]
local_variable[type[int], renderCol]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isRendered, postfix_operators=[], prefix_operators=['!'], qualifier=column, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filterBy")], member=getValueExpression, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=clientId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_filter_"), operator=+), operandr=MemberReference(member=renderCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFilterValue, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=renderCol, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getColumns, postfix_operators=[], prefix_operators=[], qualifier=sheet, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=column)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=SheetColumn, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[decodeFilters] operator[SEP] Keyword[final] identifier[FacesContext] identifier[context] , Keyword[final] identifier[Sheet] identifier[sheet] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] , Keyword[final] identifier[String] identifier[clientId] operator[SEP] {
Keyword[int] identifier[renderCol] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[SheetColumn] identifier[column] operator[:] identifier[sheet] operator[SEP] identifier[getColumns] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[column] operator[SEP] identifier[isRendered] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[column] operator[SEP] identifier[getValueExpression] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[params] operator[SEP] identifier[get] operator[SEP] identifier[clientId] operator[+] literal[String] operator[+] identifier[renderCol] operator[SEP] operator[SEP] identifier[column] operator[SEP] identifier[setFilterValue] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
identifier[renderCol] operator[++] operator[SEP]
}
}
|
public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2,
int offset1, int length1, int offset2, int length2,
int width, int stopPenalty) {
try {
int minLength = Math.min(length1, length2) + width + 1;
length1 = Math.min(length1, minLength);
length2 = Math.min(length2, minLength);
MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET);
BandedSemiLocalResult result = alignSemiLocalLeft0(scoring, seq1, seq2,
offset1, length1, offset2, length2, width, stopPenalty, mutations, AlignmentCache.get());
return new Alignment<>(seq1, mutations.createAndDestroy(),
new Range(offset1, result.sequence1Stop + 1), new Range(offset2, result.sequence2Stop + 1),
result.score);
} finally {
AlignmentCache.release();
}
} | class class_name[name] begin[{]
method[alignSemiLocalLeft, return_type[type[Alignment]], modifier[public static], parameter[scoring, seq1, seq2, offset1, length1, offset2, length2, width, stopPenalty]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=length1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=minLength)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=length1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=length1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=length2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=length2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ALPHABET, postfix_operators=[], prefix_operators=[], qualifier=NucleotideSequence, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=MutationsBuilder, sub_type=None)), name=mutations)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NucleotideSequence, sub_type=None))], dimensions=[], name=MutationsBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=scoring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seq1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seq2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stopPenalty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mutations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=AlignmentCache, selectors=[], type_arguments=None)], member=alignSemiLocalLeft0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BandedSemiLocalResult, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=seq1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=createAndDestroy, postfix_operators=[], prefix_operators=[], qualifier=mutations, selectors=[], type_arguments=None), ClassCreator(arguments=[MemberReference(member=offset1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=sequence1Stop, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Range, sub_type=None)), ClassCreator(arguments=[MemberReference(member=offset2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=sequence2Stop, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Range, sub_type=None)), MemberReference(member=score, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Alignment, sub_type=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=AlignmentCache, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Alignment] operator[<] identifier[NucleotideSequence] operator[>] identifier[alignSemiLocalLeft] operator[SEP] identifier[LinearGapAlignmentScoring] identifier[scoring] , identifier[NucleotideSequence] identifier[seq1] , identifier[NucleotideSequence] identifier[seq2] , Keyword[int] identifier[offset1] , Keyword[int] identifier[length1] , Keyword[int] identifier[offset2] , Keyword[int] identifier[length2] , Keyword[int] identifier[width] , Keyword[int] identifier[stopPenalty] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[minLength] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[length1] , identifier[length2] operator[SEP] operator[+] identifier[width] operator[+] Other[1] operator[SEP] identifier[length1] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[length1] , identifier[minLength] operator[SEP] operator[SEP] identifier[length2] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[length2] , identifier[minLength] operator[SEP] operator[SEP] identifier[MutationsBuilder] operator[<] identifier[NucleotideSequence] operator[>] identifier[mutations] operator[=] Keyword[new] identifier[MutationsBuilder] operator[<] operator[>] operator[SEP] identifier[NucleotideSequence] operator[SEP] identifier[ALPHABET] operator[SEP] operator[SEP] identifier[BandedSemiLocalResult] identifier[result] operator[=] identifier[alignSemiLocalLeft0] operator[SEP] identifier[scoring] , identifier[seq1] , identifier[seq2] , identifier[offset1] , identifier[length1] , identifier[offset2] , identifier[length2] , identifier[width] , identifier[stopPenalty] , identifier[mutations] , identifier[AlignmentCache] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Alignment] operator[<] operator[>] operator[SEP] identifier[seq1] , identifier[mutations] operator[SEP] identifier[createAndDestroy] operator[SEP] operator[SEP] , Keyword[new] identifier[Range] operator[SEP] identifier[offset1] , identifier[result] operator[SEP] identifier[sequence1Stop] operator[+] Other[1] operator[SEP] , Keyword[new] identifier[Range] operator[SEP] identifier[offset2] , identifier[result] operator[SEP] identifier[sequence2Stop] operator[+] Other[1] operator[SEP] , identifier[result] operator[SEP] identifier[score] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[AlignmentCache] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Iterable<Map.Entry<Integer, Record>> entries() {
return () -> new Iterator<Map.Entry<Integer, Record>>() {
private final Iterator<Map.Entry<Integer, Record>> it = data.records.entrySet().iterator();
/** {@inheritDoc} */
@Override
public boolean hasNext() {
return it.hasNext();
}
/** {@inheritDoc} */
@Override
public Map.Entry<Integer, Record> next() {
return it.next();
}
/** {@inheritDoc} */
@Override
public void remove() {
throw new UnsupportedOperationException("This is a read-only iterator, remove operation is not supported.");
}
};
} | class class_name[name] begin[{]
method[entries, return_type[type[Iterable]], modifier[public], parameter[]] begin[{]
return[LambdaExpression(body=ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=data.records, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=it)], documentation=None, modifiers={'final', 'private'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Record, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))], dimensions=[], name=Iterator, sub_type=None)), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None)], documentation=/** {@inheritDoc} */, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None)], documentation=/** {@inheritDoc} */, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Record, sub_type=None))], dimensions=None, name=Entry, sub_type=None)), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This is a read-only iterator, remove operation is not supported.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)], documentation=/** {@inheritDoc} */, modifiers={'public'}, name=remove, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Record, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))], dimensions=None, name=Iterator, sub_type=None)), parameters=[])]
end[}]
END[}] | Keyword[public] identifier[Iterable] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[Record] operator[>] operator[>] identifier[entries] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] operator[->] Keyword[new] identifier[Iterator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[Record] operator[>] operator[>] operator[SEP] operator[SEP] {
Keyword[private] Keyword[final] identifier[Iterator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[Record] operator[>] operator[>] identifier[it] operator[=] identifier[data] operator[SEP] identifier[records] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[Record] operator[>] identifier[next] operator[SEP] operator[SEP] {
Keyword[return] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[remove] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public int getPosition(String fieldName) {
Integer index = nameFieldIndexLookup.get(fieldName);
if (index == null) {
return -1;
}
return index;
} | class class_name[name] begin[{]
method[getPosition, return_type[type[int]], modifier[public], parameter[fieldName]] begin[{]
local_variable[type[Integer], index]
if[binary_operation[member[.index], ==, literal[null]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
return[member[.index]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getPosition] operator[SEP] identifier[String] identifier[fieldName] operator[SEP] {
identifier[Integer] identifier[index] operator[=] identifier[nameFieldIndexLookup] operator[SEP] identifier[get] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[index] operator[SEP]
}
|
@Override
public void onModuleLoad() {
ScriptInjector.fromString(GwtBootstrap3ClientBundle.INSTANCE.gwtBootstrap3().getText())
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
if (!isjQueryLoaded()) {
ScriptInjector.fromString(GwtBootstrap3ClientBundle.INSTANCE.jQuery().getText())
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
}
if (!isBootstrapLoaded()) {
ScriptInjector.fromString(GwtBootstrap3ClientBundle.INSTANCE.bootstrap().getText())
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
}
} | class class_name[name] begin[{]
method[onModuleLoad, return_type[void], modifier[public], parameter[]] begin[{]
call[ScriptInjector.fromString, parameter[call[GwtBootstrap3ClientBundle.INSTANCE.gwtBootstrap3, parameter[]]]]
if[call[.isjQueryLoaded, parameter[]]] begin[{]
call[ScriptInjector.fromString, parameter[call[GwtBootstrap3ClientBundle.INSTANCE.jQuery, parameter[]]]]
else begin[{]
None
end[}]
if[call[.isBootstrapLoaded, parameter[]]] begin[{]
call[ScriptInjector.fromString, parameter[call[GwtBootstrap3ClientBundle.INSTANCE.bootstrap, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onModuleLoad] operator[SEP] operator[SEP] {
identifier[ScriptInjector] operator[SEP] identifier[fromString] operator[SEP] identifier[GwtBootstrap3ClientBundle] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[gwtBootstrap3] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setWindow] operator[SEP] identifier[ScriptInjector] operator[SEP] identifier[TOP_WINDOW] operator[SEP] operator[SEP] identifier[inject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isjQueryLoaded] operator[SEP] operator[SEP] operator[SEP] {
identifier[ScriptInjector] operator[SEP] identifier[fromString] operator[SEP] identifier[GwtBootstrap3ClientBundle] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[jQuery] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setWindow] operator[SEP] identifier[ScriptInjector] operator[SEP] identifier[TOP_WINDOW] operator[SEP] operator[SEP] identifier[inject] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isBootstrapLoaded] operator[SEP] operator[SEP] operator[SEP] {
identifier[ScriptInjector] operator[SEP] identifier[fromString] operator[SEP] identifier[GwtBootstrap3ClientBundle] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[bootstrap] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setWindow] operator[SEP] identifier[ScriptInjector] operator[SEP] identifier[TOP_WINDOW] operator[SEP] operator[SEP] identifier[inject] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <V> ListenableFuture<V> withFallback(
ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback, Executor executor) {
checkNotNull(fallback);
return new FallbackFuture<V>(input, fallback, executor);
} | class class_name[name] begin[{]
method[withFallback, return_type[type[ListenableFuture]], modifier[public static], parameter[input, fallback, executor]] begin[{]
call[.checkNotNull, parameter[member[.fallback]]]
return[ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=executor, 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=V, sub_type=None))], dimensions=None, name=FallbackFuture, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] operator[>] identifier[ListenableFuture] operator[<] identifier[V] operator[>] identifier[withFallback] operator[SEP] identifier[ListenableFuture] operator[<] operator[?] Keyword[extends] identifier[V] operator[>] identifier[input] , identifier[FutureFallback] operator[<] operator[?] Keyword[extends] identifier[V] operator[>] identifier[fallback] , identifier[Executor] identifier[executor] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[fallback] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[FallbackFuture] operator[<] identifier[V] operator[>] operator[SEP] identifier[input] , identifier[fallback] , identifier[executor] operator[SEP] operator[SEP]
}
|
public static StringBuilder appendMd5DigestAsHex(InputStream inputStream, StringBuilder builder)
throws IOException {
return appendDigestAsHex(MD5_ALGORITHM_NAME, inputStream, builder);
} | class class_name[name] begin[{]
method[appendMd5DigestAsHex, return_type[type[StringBuilder]], modifier[public static], parameter[inputStream, builder]] begin[{]
return[call[.appendDigestAsHex, parameter[member[.MD5_ALGORITHM_NAME], member[.inputStream], member[.builder]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StringBuilder] identifier[appendMd5DigestAsHex] operator[SEP] identifier[InputStream] identifier[inputStream] , identifier[StringBuilder] identifier[builder] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[appendDigestAsHex] operator[SEP] identifier[MD5_ALGORITHM_NAME] , identifier[inputStream] , identifier[builder] operator[SEP] operator[SEP]
}
|
public static TraceComponent register(Class<?> aClass, String group, String bundle) {
TraceComponent tc = new TraceComponent(aClass.getName(), aClass, group, bundle);
registerTraceComponent(tc);
return tc;
} | class class_name[name] begin[{]
method[register, return_type[type[TraceComponent]], modifier[public static], parameter[aClass, group, bundle]] begin[{]
local_variable[type[TraceComponent], tc]
call[.registerTraceComponent, parameter[member[.tc]]]
return[member[.tc]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TraceComponent] identifier[register] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] , identifier[String] identifier[group] , identifier[String] identifier[bundle] operator[SEP] {
identifier[TraceComponent] identifier[tc] operator[=] Keyword[new] identifier[TraceComponent] operator[SEP] identifier[aClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[aClass] , identifier[group] , identifier[bundle] operator[SEP] operator[SEP] identifier[registerTraceComponent] operator[SEP] identifier[tc] operator[SEP] operator[SEP] Keyword[return] identifier[tc] operator[SEP]
}
|
public static final String formatTime(long timestamp, boolean useIsoDateFormat) {
DateFormat df = dateformats.get();
if (df == null) {
df = getDateFormat();
dateformats.set(df);
}
try {
// Get and store the locale Date pattern that was retrieved from getDateTimeInstance, to be used later.
// This is to prevent creating multiple new instances of SimpleDateFormat, which is expensive.
String ddp = localeDatePattern.get();
if (ddp == null) {
ddp = ((SimpleDateFormat) df).toPattern();
localeDatePattern.set(ddp);
}
if (useIsoDateFormat) {
((SimpleDateFormat) df).applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
} else {
((SimpleDateFormat) df).applyPattern(ddp);
}
} catch (Exception e) {
// Use the default pattern, instead.
}
return df.format(timestamp);
} | class class_name[name] begin[{]
method[formatTime, return_type[type[String]], modifier[final public static], parameter[timestamp, useIsoDateFormat]] begin[{]
local_variable[type[DateFormat], df]
if[binary_operation[member[.df], ==, literal[null]]] begin[{]
assign[member[.df], call[.getDateFormat, parameter[]]]
call[dateformats.set, parameter[member[.df]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=localeDatePattern, selectors=[], type_arguments=None), name=ddp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ddp, 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=ddp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=df, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SimpleDateFormat, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ddp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=localeDatePattern, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MemberReference(member=useIsoDateFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=df, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SimpleDateFormat, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=df, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SimpleDateFormat, sub_type=None)), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[call[df.format, parameter[member[.timestamp]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[String] identifier[formatTime] operator[SEP] Keyword[long] identifier[timestamp] , Keyword[boolean] identifier[useIsoDateFormat] operator[SEP] {
identifier[DateFormat] identifier[df] operator[=] identifier[dateformats] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[df] operator[==] Other[null] operator[SEP] {
identifier[df] operator[=] identifier[getDateFormat] operator[SEP] operator[SEP] operator[SEP] identifier[dateformats] operator[SEP] identifier[set] operator[SEP] identifier[df] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[String] identifier[ddp] operator[=] identifier[localeDatePattern] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ddp] operator[==] Other[null] operator[SEP] {
identifier[ddp] operator[=] operator[SEP] operator[SEP] identifier[SimpleDateFormat] operator[SEP] identifier[df] operator[SEP] operator[SEP] identifier[toPattern] operator[SEP] operator[SEP] operator[SEP] identifier[localeDatePattern] operator[SEP] identifier[set] operator[SEP] identifier[ddp] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[useIsoDateFormat] operator[SEP] {
operator[SEP] operator[SEP] identifier[SimpleDateFormat] operator[SEP] identifier[df] operator[SEP] operator[SEP] identifier[applyPattern] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
operator[SEP] operator[SEP] identifier[SimpleDateFormat] operator[SEP] identifier[df] operator[SEP] operator[SEP] identifier[applyPattern] operator[SEP] identifier[ddp] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
Keyword[return] identifier[df] operator[SEP] identifier[format] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP]
}
|
public String[] arrayUnescapeJava(final Object[] target) {
if (target == null) {
return null;
}
final String[] result = new String[target.length];
for (int i = 0; i < target.length; i++) {
result[i] = unescapeJava(target[i]);
}
return result;
} | class class_name[name] begin[{]
method[arrayUnescapeJava, return_type[type[String]], modifier[public], parameter[target]] begin[{]
if[binary_operation[member[.target], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=unescapeJava, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=target, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[arrayUnescapeJava] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[target] operator[SEP] {
Keyword[if] operator[SEP] identifier[target] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[target] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[target] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[unescapeJava] operator[SEP] identifier[target] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void addBodyFileUpload(String name, String filename, File file, String contentType, boolean isText)
throws ErrorDataEncoderException {
checkNotNull(name, "name");
checkNotNull(file, "file");
if (filename == null) {
filename = StringUtil.EMPTY_STRING;
}
String scontentType = contentType;
String contentTransferEncoding = null;
if (contentType == null) {
if (isText) {
scontentType = HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE;
} else {
scontentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE;
}
}
if (!isText) {
contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value();
}
FileUpload fileUpload = factory.createFileUpload(request, name, filename, scontentType,
contentTransferEncoding, null, file.length());
try {
fileUpload.setContent(file);
} catch (IOException e) {
throw new ErrorDataEncoderException(e);
}
addBodyHttpData(fileUpload);
} | class class_name[name] begin[{]
method[addBodyFileUpload, return_type[void], modifier[public], parameter[name, filename, file, contentType, isText]] begin[{]
call[.checkNotNull, parameter[member[.name], literal["name"]]]
call[.checkNotNull, parameter[member[.file], literal["file"]]]
if[binary_operation[member[.filename], ==, literal[null]]] begin[{]
assign[member[.filename], member[StringUtil.EMPTY_STRING]]
else begin[{]
None
end[}]
local_variable[type[String], scontentType]
local_variable[type[String], contentTransferEncoding]
if[binary_operation[member[.contentType], ==, literal[null]]] begin[{]
if[member[.isText]] begin[{]
assign[member[.scontentType], member[HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE]]
else begin[{]
assign[member[.scontentType], member[HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE]]
end[}]
else begin[{]
None
end[}]
if[member[.isText]] begin[{]
assign[member[.contentTransferEncoding], call[HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[FileUpload], fileUpload]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContent, postfix_operators=[], prefix_operators=[], qualifier=fileUpload, selectors=[], type_arguments=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=ErrorDataEncoderException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
call[.addBodyHttpData, parameter[member[.fileUpload]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addBodyFileUpload] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[filename] , identifier[File] identifier[file] , identifier[String] identifier[contentType] , Keyword[boolean] identifier[isText] operator[SEP] Keyword[throws] identifier[ErrorDataEncoderException] {
identifier[checkNotNull] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[file] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[filename] operator[==] Other[null] operator[SEP] {
identifier[filename] operator[=] identifier[StringUtil] operator[SEP] identifier[EMPTY_STRING] operator[SEP]
}
identifier[String] identifier[scontentType] operator[=] identifier[contentType] operator[SEP] identifier[String] identifier[contentTransferEncoding] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[contentType] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[isText] operator[SEP] {
identifier[scontentType] operator[=] identifier[HttpPostBodyUtil] operator[SEP] identifier[DEFAULT_TEXT_CONTENT_TYPE] operator[SEP]
}
Keyword[else] {
identifier[scontentType] operator[=] identifier[HttpPostBodyUtil] operator[SEP] identifier[DEFAULT_BINARY_CONTENT_TYPE] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[isText] operator[SEP] {
identifier[contentTransferEncoding] operator[=] identifier[HttpPostBodyUtil] operator[SEP] identifier[TransferEncodingMechanism] operator[SEP] identifier[BINARY] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
identifier[FileUpload] identifier[fileUpload] operator[=] identifier[factory] operator[SEP] identifier[createFileUpload] operator[SEP] identifier[request] , identifier[name] , identifier[filename] , identifier[scontentType] , identifier[contentTransferEncoding] , Other[null] , identifier[file] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[fileUpload] operator[SEP] identifier[setContent] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ErrorDataEncoderException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[addBodyHttpData] operator[SEP] identifier[fileUpload] operator[SEP] operator[SEP]
}
|
public boolean authenticateAndAuthorize(String resource, String credentials, AuthHandler.Permissions level) throws AuthenticationException {
Preconditions.checkNotNull(credentials, "credentials");
boolean retVal = false;
try {
String[] parts = extractMethodAndToken(credentials);
String method = parts[0];
String token = parts[1];
AuthHandler handler = getHandler(method);
Preconditions.checkNotNull( handler, "Can not find handler.");
Principal principal;
if ((principal = handler.authenticate(token)) == null) {
throw new AuthenticationException("Authentication failure");
}
retVal = handler.authorize(resource, principal).ordinal() >= level.ordinal();
} catch (AuthException e) {
throw new AuthenticationException("Authentication failure");
}
return retVal;
} | class class_name[name] begin[{]
method[authenticateAndAuthorize, return_type[type[boolean]], modifier[public], parameter[resource, credentials, level]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.credentials], literal["credentials"]]]
local_variable[type[boolean], retVal]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=credentials, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractMethodAndToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=parts)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), name=token)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AuthHandler, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not find handler.")], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=principal)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Principal, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=authenticate, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None)), 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="Authentication failure")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuthenticationException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=retVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=authorize, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[MethodInvocation(arguments=[], member=ordinal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=level, selectors=[], type_arguments=None), operator=>=)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Authentication failure")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuthenticationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AuthException']))], finally_block=None, label=None, resources=None)
return[member[.retVal]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[authenticateAndAuthorize] operator[SEP] identifier[String] identifier[resource] , identifier[String] identifier[credentials] , identifier[AuthHandler] operator[SEP] identifier[Permissions] identifier[level] operator[SEP] Keyword[throws] identifier[AuthenticationException] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[credentials] , literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[retVal] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[extractMethodAndToken] operator[SEP] identifier[credentials] operator[SEP] operator[SEP] identifier[String] identifier[method] operator[=] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[token] operator[=] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[AuthHandler] identifier[handler] operator[=] identifier[getHandler] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[handler] , literal[String] operator[SEP] operator[SEP] identifier[Principal] identifier[principal] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[principal] operator[=] identifier[handler] operator[SEP] identifier[authenticate] operator[SEP] identifier[token] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AuthenticationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[retVal] operator[=] identifier[handler] operator[SEP] identifier[authorize] operator[SEP] identifier[resource] , identifier[principal] operator[SEP] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[>=] identifier[level] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AuthException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AuthenticationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[retVal] operator[SEP]
}
|
public String buildSelectDeleteFileMode(String htmlAttributes) {
List<String> options = new ArrayList<String>(2);
options.add(key(Messages.GUI_PREF_PRESERVE_SIBLINGS_0));
options.add(key(Messages.GUI_PREF_DELETE_SIBLINGS_0));
List<String> values = new ArrayList<String>(2);
values.add(String.valueOf(CmsResource.DELETE_PRESERVE_SIBLINGS));
values.add(String.valueOf(CmsResource.DELETE_REMOVE_SIBLINGS));
int selectedIndex = values.indexOf(getParamTabDiDeleteFileMode());
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | class class_name[name] begin[{]
method[buildSelectDeleteFileMode, return_type[type[String]], modifier[public], parameter[htmlAttributes]] begin[{]
local_variable[type[List], options]
call[options.add, parameter[call[.key, parameter[member[Messages.GUI_PREF_PRESERVE_SIBLINGS_0]]]]]
call[options.add, parameter[call[.key, parameter[member[Messages.GUI_PREF_DELETE_SIBLINGS_0]]]]]
local_variable[type[List], values]
call[values.add, parameter[call[String.valueOf, parameter[member[CmsResource.DELETE_PRESERVE_SIBLINGS]]]]]
call[values.add, parameter[call[String.valueOf, parameter[member[CmsResource.DELETE_REMOVE_SIBLINGS]]]]]
local_variable[type[int], selectedIndex]
return[call[.buildSelect, parameter[member[.htmlAttributes], member[.options], member[.values], member[.selectedIndex]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[buildSelectDeleteFileMode] operator[SEP] identifier[String] identifier[htmlAttributes] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[options] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_PREF_PRESERVE_SIBLINGS_0] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_PREF_DELETE_SIBLINGS_0] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[values] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[CmsResource] operator[SEP] identifier[DELETE_PRESERVE_SIBLINGS] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[CmsResource] operator[SEP] identifier[DELETE_REMOVE_SIBLINGS] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[selectedIndex] operator[=] identifier[values] operator[SEP] identifier[indexOf] operator[SEP] identifier[getParamTabDiDeleteFileMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[buildSelect] operator[SEP] identifier[htmlAttributes] , identifier[options] , identifier[values] , identifier[selectedIndex] operator[SEP] operator[SEP]
}
|
public Node nextSibling() {
if (currentNode == null)
return null;
Node node = getNextSibling(currentNode);
if (node != null)
currentNode = node;
return node;
} | class class_name[name] begin[{]
method[nextSibling, return_type[type[Node]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.currentNode], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Node], node]
if[binary_operation[member[.node], !=, literal[null]]] begin[{]
assign[member[.currentNode], member[.node]]
else begin[{]
None
end[}]
return[member[.node]]
end[}]
END[}] | Keyword[public] identifier[Node] identifier[nextSibling] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentNode] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Node] identifier[node] operator[=] identifier[getNextSibling] operator[SEP] identifier[currentNode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[!=] Other[null] operator[SEP] identifier[currentNode] operator[=] identifier[node] operator[SEP] Keyword[return] identifier[node] operator[SEP]
}
|
public boolean getEnableSpringELCompiler() {
final Set<IDialect> dialects = getDialects();
for (final IDialect dialect : dialects) {
if (dialect instanceof SpringStandardDialect) {
return ((SpringStandardDialect) dialect).getEnableSpringELCompiler();
}
}
return false;
} | class class_name[name] begin[{]
method[getEnableSpringELCompiler, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[Set], dialects]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dialect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=SpringStandardDialect, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MemberReference(member=dialect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SpringStandardDialect, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=dialects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dialect)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=IDialect, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[getEnableSpringELCompiler] operator[SEP] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[IDialect] operator[>] identifier[dialects] operator[=] identifier[getDialects] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[IDialect] identifier[dialect] operator[:] identifier[dialects] operator[SEP] {
Keyword[if] operator[SEP] identifier[dialect] Keyword[instanceof] identifier[SpringStandardDialect] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[SpringStandardDialect] operator[SEP] identifier[dialect] operator[SEP] operator[SEP] identifier[getEnableSpringELCompiler] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
boolean addPolicy(String sec, String ptype, List<String> rule) {
boolean ruleAdded = model.addPolicy(sec, ptype, rule);
if (!ruleAdded) {
return false;
}
if (adapter != null && autoSave) {
try {
adapter.addPolicy(sec, ptype, rule);
} catch (Error e) {
if (!e.getMessage().equals("not implemented")) {
throw e;
}
}
if (watcher != null) {
// error intentionally ignored
watcher.update();
}
}
return true;
} | class class_name[name] begin[{]
method[addPolicy, return_type[type[boolean]], modifier[default], parameter[sec, ptype, rule]] begin[{]
local_variable[type[boolean], ruleAdded]
if[member[.ruleAdded]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.adapter], !=, literal[null]], &&, member[.autoSave]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ptype, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addPolicy, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=['!'], qualifier=e, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="not implemented")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Error']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.watcher], !=, literal[null]]] begin[{]
call[watcher.update, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[boolean] identifier[addPolicy] operator[SEP] identifier[String] identifier[sec] , identifier[String] identifier[ptype] , identifier[List] operator[<] identifier[String] operator[>] identifier[rule] operator[SEP] {
Keyword[boolean] identifier[ruleAdded] operator[=] identifier[model] operator[SEP] identifier[addPolicy] operator[SEP] identifier[sec] , identifier[ptype] , identifier[rule] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ruleAdded] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[adapter] operator[!=] Other[null] operator[&&] identifier[autoSave] operator[SEP] {
Keyword[try] {
identifier[adapter] operator[SEP] identifier[addPolicy] operator[SEP] identifier[sec] , identifier[ptype] , identifier[rule] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Error] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[watcher] operator[!=] Other[null] operator[SEP] {
identifier[watcher] operator[SEP] identifier[update] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
static public String
canonicalpath(String path)
{
if(path == null) return null;
StringBuilder b = new StringBuilder(path);
canonicalpath(b);
return b.toString();
} | class class_name[name] begin[{]
method[canonicalpath, return_type[type[String]], modifier[public static], parameter[path]] begin[{]
if[binary_operation[member[.path], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], b]
call[.canonicalpath, parameter[member[.b]]]
return[call[b.toString, parameter[]]]
end[}]
END[}] | Keyword[static] Keyword[public] identifier[String] identifier[canonicalpath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[path] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[StringBuilder] identifier[b] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[canonicalpath] operator[SEP] identifier[b] operator[SEP] operator[SEP] Keyword[return] identifier[b] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Tile getTile (int fqTileId)
throws NoSuchTileSetException
{
return getTile(TileUtil.getTileSetId(fqTileId), TileUtil.getTileIndex(fqTileId), null);
} | class class_name[name] begin[{]
method[getTile, return_type[type[Tile]], modifier[public], parameter[fqTileId]] begin[{]
return[call[.getTile, parameter[call[TileUtil.getTileSetId, parameter[member[.fqTileId]]], call[TileUtil.getTileIndex, parameter[member[.fqTileId]]], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[Tile] identifier[getTile] operator[SEP] Keyword[int] identifier[fqTileId] operator[SEP] Keyword[throws] identifier[NoSuchTileSetException] {
Keyword[return] identifier[getTile] operator[SEP] identifier[TileUtil] operator[SEP] identifier[getTileSetId] operator[SEP] identifier[fqTileId] operator[SEP] , identifier[TileUtil] operator[SEP] identifier[getTileIndex] operator[SEP] identifier[fqTileId] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
|
private long getLongFromDom( Document dom, String tag )
{
return Long.parseLong( dom.getElementsByTagName( tag ).item( 0 ).getTextContent() );
} | class class_name[name] begin[{]
method[getLongFromDom, return_type[type[long]], modifier[private], parameter[dom, tag]] begin[{]
return[call[Long.parseLong, parameter[call[dom.getElementsByTagName, parameter[member[.tag]]]]]]
end[}]
END[}] | Keyword[private] Keyword[long] identifier[getLongFromDom] operator[SEP] identifier[Document] identifier[dom] , identifier[String] identifier[tag] operator[SEP] {
Keyword[return] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[dom] operator[SEP] identifier[getElementsByTagName] operator[SEP] identifier[tag] operator[SEP] operator[SEP] identifier[item] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getTextContent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static boolean hasBluetoothFeature(Context context) {
return hasBluetoothFeature(context.getPackageManager());
} | class class_name[name] begin[{]
method[hasBluetoothFeature, return_type[type[boolean]], modifier[public static], parameter[context]] begin[{]
return[call[.hasBluetoothFeature, parameter[call[context.getPackageManager, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[FROYO] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[hasBluetoothFeature] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[return] identifier[hasBluetoothFeature] operator[SEP] identifier[context] operator[SEP] identifier[getPackageManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void addInfoLayoutComponents() {
TextField siteTableFilter = new TextField();
siteTableFilter.setIcon(FontOpenCms.FILTER);
siteTableFilter.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
siteTableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
siteTableFilter.setWidth("200px");
siteTableFilter.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
public void textChange(TextChangeEvent event) {
m_table.filterTable(event.getText());
}
});
m_infoLayout.addComponent(siteTableFilter);
} | class class_name[name] begin[{]
method[addInfoLayoutComponents, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[TextField], siteTableFilter]
call[siteTableFilter.setIcon, parameter[member[FontOpenCms.FILTER]]]
call[siteTableFilter.setInputPrompt, parameter[call[Messages.get, parameter[]]]]
call[siteTableFilter.addStyleName, parameter[member[ValoTheme.TEXTFIELD_INLINE_ICON]]]
call[siteTableFilter.setWidth, parameter[literal["200px"]]]
call[siteTableFilter.addTextChangeListener, parameter[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L), name=serialVersionUID)], documentation=None, modifiers={'final', 'private', 'static'}, type=BasicType(dimensions=[], name=long)), MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getText, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], member=filterTable, postfix_operators=[], prefix_operators=[], qualifier=m_table, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=textChange, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=TextChangeEvent, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TextChangeListener, sub_type=None))]]
call[m_infoLayout.addComponent, parameter[member[.siteTableFilter]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addInfoLayoutComponents] operator[SEP] operator[SEP] {
identifier[TextField] identifier[siteTableFilter] operator[=] Keyword[new] identifier[TextField] operator[SEP] operator[SEP] operator[SEP] identifier[siteTableFilter] operator[SEP] identifier[setIcon] operator[SEP] identifier[FontOpenCms] operator[SEP] identifier[FILTER] operator[SEP] operator[SEP] identifier[siteTableFilter] operator[SEP] identifier[setInputPrompt] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] identifier[UI] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_EXPLORER_FILTER_0] operator[SEP] operator[SEP] operator[SEP] identifier[siteTableFilter] operator[SEP] identifier[addStyleName] operator[SEP] identifier[ValoTheme] operator[SEP] identifier[TEXTFIELD_INLINE_ICON] operator[SEP] operator[SEP] identifier[siteTableFilter] operator[SEP] identifier[setWidth] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[siteTableFilter] operator[SEP] identifier[addTextChangeListener] operator[SEP] Keyword[new] identifier[TextChangeListener] operator[SEP] operator[SEP] {
Keyword[private] Keyword[static] Keyword[final] Keyword[long] identifier[serialVersionUID] operator[=] Other[1L] operator[SEP] Keyword[public] Keyword[void] identifier[textChange] operator[SEP] identifier[TextChangeEvent] identifier[event] operator[SEP] {
identifier[m_table] operator[SEP] identifier[filterTable] operator[SEP] identifier[event] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[m_infoLayout] operator[SEP] identifier[addComponent] operator[SEP] identifier[siteTableFilter] operator[SEP] operator[SEP]
}
|
public static String getPasswordResetToken(final RequestContext requestContext) {
val flowScope = requestContext.getFlowScope();
return flowScope.getString(FLOWSCOPE_PARAMETER_NAME_TOKEN);
} | class class_name[name] begin[{]
method[getPasswordResetToken, return_type[type[String]], modifier[public static], parameter[requestContext]] begin[{]
local_variable[type[val], flowScope]
return[call[flowScope.getString, parameter[member[.FLOWSCOPE_PARAMETER_NAME_TOKEN]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getPasswordResetToken] operator[SEP] Keyword[final] identifier[RequestContext] identifier[requestContext] operator[SEP] {
identifier[val] identifier[flowScope] operator[=] identifier[requestContext] operator[SEP] identifier[getFlowScope] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[flowScope] operator[SEP] identifier[getString] operator[SEP] identifier[FLOWSCOPE_PARAMETER_NAME_TOKEN] operator[SEP] operator[SEP]
}
|
@Override
public Character getPropertyCharacter(Class<?> aClass, String key,
char defaultValue)
{
String results = getProperty(aClass, key, "");
if (results.length() == 0)
return Character.valueOf(defaultValue);
else
return Character.valueOf(results.charAt(0));// return first character
} | class class_name[name] begin[{]
method[getPropertyCharacter, return_type[type[Character]], modifier[public], parameter[aClass, key, defaultValue]] begin[{]
local_variable[type[String], results]
if[binary_operation[call[results.length, parameter[]], ==, literal[0]]] begin[{]
return[call[Character.valueOf, parameter[member[.defaultValue]]]]
else begin[{]
return[call[Character.valueOf, parameter[call[results.charAt, parameter[literal[0]]]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Character] identifier[getPropertyCharacter] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] , identifier[String] identifier[key] , Keyword[char] identifier[defaultValue] operator[SEP] {
identifier[String] identifier[results] operator[=] identifier[getProperty] operator[SEP] identifier[aClass] , identifier[key] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[results] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[Character] operator[SEP] identifier[valueOf] operator[SEP] identifier[defaultValue] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[Character] operator[SEP] identifier[valueOf] operator[SEP] identifier[results] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean performDialogOperation() throws CmsException {
// lock the image gallery folder
checkLock(getParamResource());
Iterator<CmsResource> i = getImages().iterator();
// loop over all image resources to change the properties
while (i.hasNext()) {
CmsResource res = i.next();
String imageName = res.getName();
String propertySuffix = "" + imageName.hashCode();
// update the title property
CmsProperty titleProperty = getCms().readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false);
String newValue = getJsp().getRequest().getParameter(PREFIX_TITLE + propertySuffix);
writeProperty(res, CmsPropertyDefinition.PROPERTY_TITLE, newValue, titleProperty);
// update the description property
CmsProperty descProperty = getCms().readPropertyObject(
res,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
false);
newValue = getJsp().getRequest().getParameter(PREFIX_DESCRIPTION + propertySuffix);
writeProperty(res, CmsPropertyDefinition.PROPERTY_DESCRIPTION, newValue, descProperty);
}
return true;
} | class class_name[name] begin[{]
method[performDialogOperation, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
call[.checkLock, parameter[call[.getParamResource, parameter[]]]]
local_variable[type[Iterator], i]
while[call[i.hasNext, parameter[]]] begin[{]
local_variable[type[CmsResource], res]
local_variable[type[String], imageName]
local_variable[type[String], propertySuffix]
local_variable[type[CmsProperty], titleProperty]
local_variable[type[String], newValue]
call[.writeProperty, parameter[member[.res], member[CmsPropertyDefinition.PROPERTY_TITLE], member[.newValue], member[.titleProperty]]]
local_variable[type[CmsProperty], descProperty]
assign[member[.newValue], call[.getJsp, parameter[]]]
call[.writeProperty, parameter[member[.res], member[CmsPropertyDefinition.PROPERTY_DESCRIPTION], member[.newValue], member[.descProperty]]]
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[performDialogOperation] operator[SEP] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[checkLock] operator[SEP] identifier[getParamResource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[CmsResource] operator[>] identifier[i] operator[=] identifier[getImages] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsResource] identifier[res] operator[=] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[imageName] operator[=] identifier[res] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[propertySuffix] operator[=] literal[String] operator[+] identifier[imageName] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] identifier[CmsProperty] identifier[titleProperty] operator[=] identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[readPropertyObject] operator[SEP] identifier[res] , identifier[CmsPropertyDefinition] operator[SEP] identifier[PROPERTY_TITLE] , literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[newValue] operator[=] identifier[getJsp] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getParameter] operator[SEP] identifier[PREFIX_TITLE] operator[+] identifier[propertySuffix] operator[SEP] operator[SEP] identifier[writeProperty] operator[SEP] identifier[res] , identifier[CmsPropertyDefinition] operator[SEP] identifier[PROPERTY_TITLE] , identifier[newValue] , identifier[titleProperty] operator[SEP] operator[SEP] identifier[CmsProperty] identifier[descProperty] operator[=] identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[readPropertyObject] operator[SEP] identifier[res] , identifier[CmsPropertyDefinition] operator[SEP] identifier[PROPERTY_DESCRIPTION] , literal[boolean] operator[SEP] operator[SEP] identifier[newValue] operator[=] identifier[getJsp] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getParameter] operator[SEP] identifier[PREFIX_DESCRIPTION] operator[+] identifier[propertySuffix] operator[SEP] operator[SEP] identifier[writeProperty] operator[SEP] identifier[res] , identifier[CmsPropertyDefinition] operator[SEP] identifier[PROPERTY_DESCRIPTION] , identifier[newValue] , identifier[descProperty] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static FilterOperator toFilterOperator(ComparableFilter.Operator operator) {
if (operator == ComparableFilter.Operator.EQUAL_TO) {
return FilterOperator.EQUAL;
} else if (operator == ComparableFilter.Operator.GREATER_THAN) {
return FilterOperator.GREATER_THAN;
} else if (operator == ComparableFilter.Operator.GREATER_THAN_OR_EQUAL_TO) {
return FilterOperator.GREATER_THAN_OR_EQUAL;
} else if (operator == ComparableFilter.Operator.LESS_THAN) {
return FilterOperator.LESS_THAN;
} else if (operator == ComparableFilter.Operator.LESS_THAN_OR_EQUAL_TO) {
return FilterOperator.LESS_THAN_OR_EQUAL;
} else if (operator == ComparableFilter.Operator.NOT_EQUAL_TO) {
return FilterOperator.NOT_EQUAL;
} else {
throw new UnsupportedOperationException("Operator [" + operator
+ "] is not supported by Google App Engine Datastore");
}
} | class class_name[name] begin[{]
method[toFilterOperator, return_type[type[FilterOperator]], modifier[public static], parameter[operator]] begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.EQUAL_TO]]] begin[{]
return[member[FilterOperator.EQUAL]]
else begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.GREATER_THAN]]] begin[{]
return[member[FilterOperator.GREATER_THAN]]
else begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.GREATER_THAN_OR_EQUAL_TO]]] begin[{]
return[member[FilterOperator.GREATER_THAN_OR_EQUAL]]
else begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.LESS_THAN]]] begin[{]
return[member[FilterOperator.LESS_THAN]]
else begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.LESS_THAN_OR_EQUAL_TO]]] begin[{]
return[member[FilterOperator.LESS_THAN_OR_EQUAL]]
else begin[{]
if[binary_operation[member[.operator], ==, member[ComparableFilter.Operator.NOT_EQUAL_TO]]] begin[{]
return[member[FilterOperator.NOT_EQUAL]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Operator ["), operandr=MemberReference(member=operator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] is not supported by Google App Engine Datastore"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FilterOperator] identifier[toFilterOperator] operator[SEP] identifier[ComparableFilter] operator[SEP] identifier[Operator] identifier[operator] operator[SEP] {
Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[EQUAL_TO] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[EQUAL] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[GREATER_THAN] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[GREATER_THAN] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[GREATER_THAN_OR_EQUAL_TO] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[GREATER_THAN_OR_EQUAL] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[LESS_THAN] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[LESS_THAN] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[LESS_THAN_OR_EQUAL_TO] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[LESS_THAN_OR_EQUAL] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operator] operator[==] identifier[ComparableFilter] operator[SEP] identifier[Operator] operator[SEP] identifier[NOT_EQUAL_TO] operator[SEP] {
Keyword[return] identifier[FilterOperator] operator[SEP] identifier[NOT_EQUAL] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[operator] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public synchronized void flush()
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
trace.entry(this,
cclass,
"flush");
trace.exit(this,
cclass,
"flush");
}
} | class class_name[name] begin[{]
method[flush, return_type[void], modifier[synchronized public], parameter[]] begin[{]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.entry, parameter[THIS[], member[.cclass], literal["flush"]]]
call[trace.exit, parameter[THIS[], member[.cclass], literal["flush"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[flush] operator[SEP] operator[SEP] Keyword[throws] identifier[ObjectManagerException] {
Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[trace] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] operator[SEP] operator[SEP]
}
}
|
public OperationFuture<List<Server>> delete(ServerFilter filter) {
List<Server> serverRefs = find(filter)
.stream()
.map(ServerMetadata::asRefById)
.collect(toList());
return delete(serverRefs.toArray(new Server[serverRefs.size()]));
} | class class_name[name] begin[{]
method[delete, return_type[type[OperationFuture]], modifier[public], parameter[filter]] begin[{]
local_variable[type[List], serverRefs]
return[call[.delete, parameter[call[serverRefs.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=serverRefs, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Server, sub_type=None))]]]]]
end[}]
END[}] | Keyword[public] identifier[OperationFuture] operator[<] identifier[List] operator[<] identifier[Server] operator[>] operator[>] identifier[delete] operator[SEP] identifier[ServerFilter] identifier[filter] operator[SEP] {
identifier[List] operator[<] identifier[Server] operator[>] identifier[serverRefs] operator[=] identifier[find] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[ServerMetadata] operator[::] identifier[asRefById] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[delete] operator[SEP] identifier[serverRefs] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Server] operator[SEP] identifier[serverRefs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public User getActiveUser() {
SharedPreferences prefs = getStorage();
if (prefs.contains("uuid") && prefs.contains("name")) {
return new User(
prefs.getString("app_name", ""),
prefs.getString("name", ""),
prefs.getString("uuid", ""),
null);
} else {
return null;
}
} | class class_name[name] begin[{]
method[getActiveUser, return_type[type[User]], modifier[public], parameter[]] begin[{]
local_variable[type[SharedPreferences], prefs]
if[binary_operation[call[prefs.contains, parameter[literal["uuid"]]], &&, call[prefs.contains, parameter[literal["name"]]]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="app_name"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=prefs, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=prefs, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="uuid"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=prefs, selectors=[], type_arguments=None), 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=User, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[User] identifier[getActiveUser] operator[SEP] operator[SEP] {
identifier[SharedPreferences] identifier[prefs] operator[=] identifier[getStorage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prefs] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[prefs] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[User] operator[SEP] identifier[prefs] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[prefs] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[prefs] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[String] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public static alluxio.grpc.MountPointInfo toProto(MountPointInfo info) {
return alluxio.grpc.MountPointInfo.newBuilder().setUfsUri(info.getUfsUri())
.setUfsType(info.getUfsType()).setUfsCapacityBytes(info.getUfsCapacityBytes())
.setReadOnly(info.getReadOnly()).putAllProperties(info.getProperties())
.setShared(info.getShared()).build();
} | class class_name[name] begin[{]
method[toProto, return_type[type[alluxio]], modifier[public static], parameter[info]] begin[{]
return[call[alluxio.grpc.MountPointInfo.newBuilder, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[MountPointInfo] identifier[toProto] operator[SEP] identifier[MountPointInfo] identifier[info] operator[SEP] {
Keyword[return] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[MountPointInfo] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setUfsUri] operator[SEP] identifier[info] operator[SEP] identifier[getUfsUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setUfsType] operator[SEP] identifier[info] operator[SEP] identifier[getUfsType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setUfsCapacityBytes] operator[SEP] identifier[info] operator[SEP] identifier[getUfsCapacityBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setReadOnly] operator[SEP] identifier[info] operator[SEP] identifier[getReadOnly] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAllProperties] operator[SEP] identifier[info] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setShared] operator[SEP] identifier[info] operator[SEP] identifier[getShared] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<ExpressRoutePortInner> updateTagsAsync(String resourceGroupName, String expressRoutePortName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, expressRoutePortName).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[updateTagsAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, expressRoutePortName]] begin[{]
return[call[.updateTagsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.expressRoutePortName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ExpressRoutePortInner] operator[>] identifier[updateTagsAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[expressRoutePortName] operator[SEP] {
Keyword[return] identifier[updateTagsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[expressRoutePortName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[ExpressRoutePortInner] operator[>] , identifier[ExpressRoutePortInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[ExpressRoutePortInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[ExpressRoutePortInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public Method[] getAllMethods(Object o) {
Method[] methods = o.getClass().getDeclaredMethods();
AccessibleObject.setAccessible(methods, true);
return methods;
} | class class_name[name] begin[{]
method[getAllMethods, return_type[type[Method]], modifier[public], parameter[o]] begin[{]
local_variable[type[Method], methods]
call[AccessibleObject.setAccessible, parameter[member[.methods], literal[true]]]
return[member[.methods]]
end[}]
END[}] | Keyword[public] identifier[Method] operator[SEP] operator[SEP] identifier[getAllMethods] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
identifier[Method] operator[SEP] operator[SEP] identifier[methods] operator[=] identifier[o] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclaredMethods] operator[SEP] operator[SEP] operator[SEP] identifier[AccessibleObject] operator[SEP] identifier[setAccessible] operator[SEP] identifier[methods] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[methods] operator[SEP]
}
|
public boolean isReadOnly(ELContext context,
Object base,
Object property) {
if (context == null) {
throw new NullPointerException();
}
if ((base == null) && ("pageContext".equals(property) ||
"pageScope".equals(property)) ||
"requestScope".equals(property) ||
"sessionScope".equals(property) ||
"applicationScope".equals (property) ||
"param".equals (property) ||
"paramValues".equals (property) ||
"header".equals (property) ||
"headerValues".equals (property) ||
"initParam".equals (property) ||
"cookie".equals (property)) {
context.setPropertyResolved(true);
return true;
}
return false; // Doesn't matter
} | class class_name[name] begin[{]
method[isReadOnly, return_type[type[boolean]], modifier[public], parameter[context, base, property]] begin[{]
if[binary_operation[member[.context], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.base], ==, literal[null]], &&, binary_operation[literal["pageContext"], ||, literal["pageScope"]]], ||, literal["requestScope"]], ||, literal["sessionScope"]], ||, literal["applicationScope"]], ||, literal["param"]], ||, literal["paramValues"]], ||, literal["header"]], ||, literal["headerValues"]], ||, literal["initParam"]], ||, literal["cookie"]]] begin[{]
call[context.setPropertyResolved, parameter[literal[true]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isReadOnly] operator[SEP] identifier[ELContext] identifier[context] , identifier[Object] identifier[base] , identifier[Object] identifier[property] operator[SEP] {
Keyword[if] operator[SEP] identifier[context] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[base] operator[==] Other[null] operator[SEP] operator[&&] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[property] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[setPropertyResolved] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public int countByCP_T(long CProductId, String type) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_CP_T;
Object[] finderArgs = new Object[] { CProductId, type };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE);
query.append(_FINDER_COLUMN_CP_T_CPRODUCTID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_CP_T_TYPE_1);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_CP_T_TYPE_3);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_CP_T_TYPE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CProductId);
if (bindType) {
qPos.add(type);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | class class_name[name] begin[{]
method[countByCP_T, return_type[type[int]], modifier[public], parameter[CProductId, type]] begin[{]
local_variable[type[FinderPath], finderPath]
local_variable[type[Object], finderArgs]
local_variable[type[Long], count]
if[binary_operation[member[.count], ==, literal[null]]] begin[{]
local_variable[type[StringBundler], query]
call[query.append, parameter[member[._SQL_COUNT_CPDEFINITIONLINK_WHERE]]]
call[query.append, parameter[member[._FINDER_COLUMN_CP_T_CPRODUCTID_2]]]
local_variable[type[boolean], bindType]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
call[query.append, parameter[member[._FINDER_COLUMN_CP_T_TYPE_1]]]
else begin[{]
if[call[type.equals, parameter[literal[""]]]] begin[{]
call[query.append, parameter[member[._FINDER_COLUMN_CP_T_TYPE_3]]]
else begin[{]
assign[member[.bindType], literal[true]]
call[query.append, parameter[member[._FINDER_COLUMN_CP_T_TYPE_2]]]
end[}]
end[}]
local_variable[type[String], sql]
local_variable[type[Session], session]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=openSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=sql, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createQuery, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), name=q)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Query, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=QueryPos, selectors=[], type_arguments=None), name=qPos)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QueryPos, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CProductId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=qPos, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=bindType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=qPos, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=uniqueResult, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=finderPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=finderArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putResult, postfix_operators=[], prefix_operators=[], qualifier=finderCache, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=finderPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=finderArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeResult, postfix_operators=[], prefix_operators=[], qualifier=finderCache, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[call[count.intValue, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[countByCP_T] operator[SEP] Keyword[long] identifier[CProductId] , identifier[String] identifier[type] operator[SEP] {
identifier[FinderPath] identifier[finderPath] operator[=] identifier[FINDER_PATH_COUNT_BY_CP_T] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[finderArgs] operator[=] Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[CProductId] , identifier[type]
} operator[SEP] identifier[Long] identifier[count] operator[=] operator[SEP] identifier[Long] operator[SEP] identifier[finderCache] operator[SEP] identifier[getResult] operator[SEP] identifier[finderPath] , identifier[finderArgs] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] Other[null] operator[SEP] {
identifier[StringBundler] identifier[query] operator[=] Keyword[new] identifier[StringBundler] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[_SQL_COUNT_CPDEFINITIONLINK_WHERE] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[_FINDER_COLUMN_CP_T_CPRODUCTID_2] operator[SEP] operator[SEP] Keyword[boolean] identifier[bindType] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[_FINDER_COLUMN_CP_T_TYPE_1] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[_FINDER_COLUMN_CP_T_TYPE_3] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bindType] operator[=] literal[boolean] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[_FINDER_COLUMN_CP_T_TYPE_2] operator[SEP] operator[SEP]
}
identifier[String] identifier[sql] operator[=] identifier[query] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Session] identifier[session] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[session] operator[=] identifier[openSession] operator[SEP] operator[SEP] operator[SEP] identifier[Query] identifier[q] operator[=] identifier[session] operator[SEP] identifier[createQuery] operator[SEP] identifier[sql] operator[SEP] operator[SEP] identifier[QueryPos] identifier[qPos] operator[=] identifier[QueryPos] operator[SEP] identifier[getInstance] operator[SEP] identifier[q] operator[SEP] operator[SEP] identifier[qPos] operator[SEP] identifier[add] operator[SEP] identifier[CProductId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bindType] operator[SEP] {
identifier[qPos] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
identifier[count] operator[=] operator[SEP] identifier[Long] operator[SEP] identifier[q] operator[SEP] identifier[uniqueResult] operator[SEP] operator[SEP] operator[SEP] identifier[finderCache] operator[SEP] identifier[putResult] operator[SEP] identifier[finderPath] , identifier[finderArgs] , identifier[count] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[finderCache] operator[SEP] identifier[removeResult] operator[SEP] identifier[finderPath] , identifier[finderArgs] operator[SEP] operator[SEP] Keyword[throw] identifier[processException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[closeSession] operator[SEP] identifier[session] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[count] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <K, V> Map<K, V> filterEntries(
Map<K, V> unfiltered, Predicate<? super Entry<K, V>> entryPredicate) {
checkNotNull(entryPredicate);
return (unfiltered instanceof AbstractFilteredMap)
? filterFiltered((AbstractFilteredMap<K, V>) unfiltered, entryPredicate)
: new FilteredEntryMap<K, V>(checkNotNull(unfiltered), entryPredicate);
} | class class_name[name] begin[{]
method[filterEntries, return_type[type[Map]], modifier[public static], parameter[unfiltered, entryPredicate]] begin[{]
call[.checkNotNull, parameter[member[.entryPredicate]]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=unfiltered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=AbstractFilteredMap, sub_type=None), operator=instanceof), if_false=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=unfiltered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=entryPredicate, 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=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=FilteredEntryMap, sub_type=None)), if_true=MethodInvocation(arguments=[Cast(expression=MemberReference(member=unfiltered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=[], name=AbstractFilteredMap, sub_type=None)), MemberReference(member=entryPredicate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=filterFiltered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[filterEntries] operator[SEP] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[unfiltered] , identifier[Predicate] operator[<] operator[?] Keyword[super] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[entryPredicate] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[entryPredicate] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[unfiltered] Keyword[instanceof] identifier[AbstractFilteredMap] operator[SEP] operator[?] identifier[filterFiltered] operator[SEP] operator[SEP] identifier[AbstractFilteredMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[unfiltered] , identifier[entryPredicate] operator[SEP] operator[:] Keyword[new] identifier[FilteredEntryMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[unfiltered] operator[SEP] , identifier[entryPredicate] operator[SEP] operator[SEP]
}
|
private Throwable mapException(EJSDeployedSupport s, RemoteException ex) //d135584
{
try
{
if (ex instanceof CSIException) {
CSIException csiex = (CSIException) ex;
return mapCSIException(s, csiex);
}
else if (ex.detail instanceof CSIException)
{
CSIException csiex = (CSIException) ex.detail; //d177787
return mapCSIException(s, csiex);
}
else if (ex instanceof CreateFailureException)
{
// For consistency, just map/return the CreateFailureException
// even if it contains an EJBException, as in most cases the
// EJBException would just be wrapped in a plain RemoteException,
// which CreateFailureException already is. d187050
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex;
}
return getOrbUtils().mapException(ex);
}
else if (ex instanceof BeanNotReentrantException &&
(s.ivWrapper.ivInterface == BUSINESS_RMI_REMOTE ||
s.ivWrapper.ivInterface == SERVICE_ENDPOINT)) // d350987
{
// EJB 3.0 has defined an exception for this purpose. d366807.6
// This mapping is only done for business interfaces to insure
// compatibility with EJB 2.1 clients. 396839
BeanNotReentrantException bnre = (BeanNotReentrantException) ex;
EJBException caex = bnre.isTimeout() ? new ConcurrentAccessTimeoutException(ex.getMessage()) // d653777.1
: new ConcurrentAccessException(ex.getMessage());
caex.setStackTrace(ex.getStackTrace());
s.rootEx = caex;
return mapEJBException(s, caex);
}
else if (ex.detail instanceof EJBException)
{
EJBException ejbex = (EJBException) ex.detail;
return mapEJBException(s, ejbex);
}
else
{
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex;
}
return getOrbUtils().mapException(ex);
}
} catch (CSIException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".mapException", "119", this);
Tr.warning(tc, "UNABLE_TO_MAP_EXCEPTION_CNTR0013W"
, new Object[] { ex, e }); //p111002.5
return ex;
}
} | class class_name[name] begin[{]
method[mapException, return_type[type[Throwable]], modifier[private], parameter[s, ex]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=detail, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CreateFailureException, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=BeanNotReentrantException, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ivInterface, postfix_operators=[], prefix_operators=[], qualifier=s.ivWrapper, selectors=[]), operandr=MemberReference(member=BUSINESS_RMI_REMOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=ivInterface, postfix_operators=[], prefix_operators=[], qualifier=s.ivWrapper, selectors=[]), operandr=MemberReference(member=SERVICE_ENDPOINT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=detail, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=EJBException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=ivORB, postfix_operators=[], prefix_operators=['!'], qualifier=s.ivWrapper.ivInterface, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=getOrbUtils, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapException, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=detail, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=EJBException, sub_type=None)), name=ejbex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EJBException, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ejbex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapEJBException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BeanNotReentrantException, sub_type=None)), name=bnre)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanNotReentrantException, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[], member=isTimeout, postfix_operators=[], prefix_operators=[], qualifier=bnre, selectors=[], type_arguments=None), if_false=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConcurrentAccessException, sub_type=None)), if_true=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConcurrentAccessTimeoutException, sub_type=None))), name=caex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EJBException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None)], member=setStackTrace, postfix_operators=[], prefix_operators=[], qualifier=caex, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rootEx, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]), type==, value=MemberReference(member=caex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=caex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapEJBException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=ivORB, postfix_operators=[], prefix_operators=['!'], qualifier=s.ivWrapper.ivInterface, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=getOrbUtils, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapException, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=detail, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None)), name=csiex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=csiex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapCSIException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None)), name=csiex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CSIException, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=csiex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapCSIException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".mapException"), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="119"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UNABLE_TO_MAP_EXCEPTION_CNTR0013W"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CSIException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[Throwable] identifier[mapException] operator[SEP] identifier[EJSDeployedSupport] identifier[s] , identifier[RemoteException] identifier[ex] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[CSIException] operator[SEP] {
identifier[CSIException] identifier[csiex] operator[=] operator[SEP] identifier[CSIException] operator[SEP] identifier[ex] operator[SEP] Keyword[return] identifier[mapCSIException] operator[SEP] identifier[s] , identifier[csiex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ex] operator[SEP] identifier[detail] Keyword[instanceof] identifier[CSIException] operator[SEP] {
identifier[CSIException] identifier[csiex] operator[=] operator[SEP] identifier[CSIException] operator[SEP] identifier[ex] operator[SEP] identifier[detail] operator[SEP] Keyword[return] identifier[mapCSIException] operator[SEP] identifier[s] , identifier[csiex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[CreateFailureException] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[s] operator[SEP] identifier[ivWrapper] operator[SEP] identifier[ivInterface] operator[SEP] identifier[ivORB] operator[SEP] {
Keyword[return] identifier[ex] operator[SEP]
}
Keyword[return] identifier[getOrbUtils] operator[SEP] operator[SEP] operator[SEP] identifier[mapException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[BeanNotReentrantException] operator[&&] operator[SEP] identifier[s] operator[SEP] identifier[ivWrapper] operator[SEP] identifier[ivInterface] operator[==] identifier[BUSINESS_RMI_REMOTE] operator[||] identifier[s] operator[SEP] identifier[ivWrapper] operator[SEP] identifier[ivInterface] operator[==] identifier[SERVICE_ENDPOINT] operator[SEP] operator[SEP] {
identifier[BeanNotReentrantException] identifier[bnre] operator[=] operator[SEP] identifier[BeanNotReentrantException] operator[SEP] identifier[ex] operator[SEP] identifier[EJBException] identifier[caex] operator[=] identifier[bnre] operator[SEP] identifier[isTimeout] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[ConcurrentAccessTimeoutException] operator[SEP] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[ConcurrentAccessException] operator[SEP] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[caex] operator[SEP] identifier[setStackTrace] operator[SEP] identifier[ex] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[rootEx] operator[=] identifier[caex] operator[SEP] Keyword[return] identifier[mapEJBException] operator[SEP] identifier[s] , identifier[caex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ex] operator[SEP] identifier[detail] Keyword[instanceof] identifier[EJBException] operator[SEP] {
identifier[EJBException] identifier[ejbex] operator[=] operator[SEP] identifier[EJBException] operator[SEP] identifier[ex] operator[SEP] identifier[detail] operator[SEP] Keyword[return] identifier[mapEJBException] operator[SEP] identifier[s] , identifier[ejbex] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[s] operator[SEP] identifier[ivWrapper] operator[SEP] identifier[ivInterface] operator[SEP] identifier[ivORB] operator[SEP] {
Keyword[return] identifier[ex] operator[SEP]
}
Keyword[return] identifier[getOrbUtils] operator[SEP] operator[SEP] operator[SEP] identifier[mapException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[CSIException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , identifier[CLASS_NAME] operator[+] literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[ex] , identifier[e]
} operator[SEP] operator[SEP] Keyword[return] identifier[ex] operator[SEP]
}
}
|
public StringType addLineElement() {//2
StringType t = new StringType();
if (this.line == null)
this.line = new ArrayList<StringType>();
this.line.add(t);
return t;
} | class class_name[name] begin[{]
method[addLineElement, return_type[type[StringType]], modifier[public], parameter[]] begin[{]
local_variable[type[StringType], t]
if[binary_operation[THIS[member[None.line]], ==, literal[null]]] begin[{]
assign[THIS[member[None.line]], 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=StringType, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.line]call[None.add, parameter[member[.t]]]]
return[member[.t]]
end[}]
END[}] | Keyword[public] identifier[StringType] identifier[addLineElement] operator[SEP] operator[SEP] {
identifier[StringType] identifier[t] operator[=] Keyword[new] identifier[StringType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[line] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[line] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[StringType] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[line] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] identifier[t] operator[SEP]
}
|
public JTSGeometryExpression<Geometry> intersection(Expression<? extends Geometry> geometry) {
return JTSGeometryExpressions.geometryOperation(SpatialOps.INTERSECTION, mixin, geometry);
} | class class_name[name] begin[{]
method[intersection, return_type[type[JTSGeometryExpression]], modifier[public], parameter[geometry]] begin[{]
return[call[JTSGeometryExpressions.geometryOperation, parameter[member[SpatialOps.INTERSECTION], member[.mixin], member[.geometry]]]]
end[}]
END[}] | Keyword[public] identifier[JTSGeometryExpression] operator[<] identifier[Geometry] operator[>] identifier[intersection] operator[SEP] identifier[Expression] operator[<] operator[?] Keyword[extends] identifier[Geometry] operator[>] identifier[geometry] operator[SEP] {
Keyword[return] identifier[JTSGeometryExpressions] operator[SEP] identifier[geometryOperation] operator[SEP] identifier[SpatialOps] operator[SEP] identifier[INTERSECTION] , identifier[mixin] , identifier[geometry] operator[SEP] operator[SEP]
}
|
public static <T> File appendUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
return appendLines(list, path, CharsetUtil.CHARSET_UTF_8);
} | class class_name[name] begin[{]
method[appendUtf8Lines, return_type[type[File]], modifier[public static], parameter[list, path]] begin[{]
return[call[.appendLines, parameter[member[.list], member[.path], member[CharsetUtil.CHARSET_UTF_8]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[File] identifier[appendUtf8Lines] operator[SEP] identifier[Collection] operator[<] identifier[T] operator[>] identifier[list] , identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IORuntimeException] {
Keyword[return] identifier[appendLines] operator[SEP] identifier[list] , identifier[path] , identifier[CharsetUtil] operator[SEP] identifier[CHARSET_UTF_8] operator[SEP] operator[SEP]
}
|
public static <C> Module configModuleWithOverrides(final Class<C> configInterface, Named name, OverrideConsumer<C> overrideConsumer)
{
checkNotNull(configInterface);
checkNotNull(name);
checkNotNull(overrideConsumer);
return configModuleWithOverrides(configInterface, Optional.ofNullable(name), Optional.ofNullable(overrideConsumer));
} | class class_name[name] begin[{]
method[configModuleWithOverrides, return_type[type[Module]], modifier[public static], parameter[configInterface, name, overrideConsumer]] begin[{]
call[.checkNotNull, parameter[member[.configInterface]]]
call[.checkNotNull, parameter[member[.name]]]
call[.checkNotNull, parameter[member[.overrideConsumer]]]
return[call[.configModuleWithOverrides, parameter[member[.configInterface], call[Optional.ofNullable, parameter[member[.name]]], call[Optional.ofNullable, parameter[member[.overrideConsumer]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[C] operator[>] identifier[Module] identifier[configModuleWithOverrides] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[C] operator[>] identifier[configInterface] , identifier[Named] identifier[name] , identifier[OverrideConsumer] operator[<] identifier[C] operator[>] identifier[overrideConsumer] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[configInterface] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[overrideConsumer] operator[SEP] operator[SEP] Keyword[return] identifier[configModuleWithOverrides] operator[SEP] identifier[configInterface] , identifier[Optional] operator[SEP] identifier[ofNullable] operator[SEP] identifier[name] operator[SEP] , identifier[Optional] operator[SEP] identifier[ofNullable] operator[SEP] identifier[overrideConsumer] operator[SEP] operator[SEP] operator[SEP]
}
|
public Integer[] sequence(final Integer from, final Integer to, final Integer step) {
return NumberUtils.sequence(from, to, step);
} | class class_name[name] begin[{]
method[sequence, return_type[type[Integer]], modifier[public], parameter[from, to, step]] begin[{]
return[call[NumberUtils.sequence, parameter[member[.from], member[.to], member[.step]]]]
end[}]
END[}] | Keyword[public] identifier[Integer] operator[SEP] operator[SEP] identifier[sequence] operator[SEP] Keyword[final] identifier[Integer] identifier[from] , Keyword[final] identifier[Integer] identifier[to] , Keyword[final] identifier[Integer] identifier[step] operator[SEP] {
Keyword[return] identifier[NumberUtils] operator[SEP] identifier[sequence] operator[SEP] identifier[from] , identifier[to] , identifier[step] operator[SEP] operator[SEP]
}
|
public static String getCoreValueExpression(UIComponent component) {
ValueExpression valueExpression = component.getValueExpression("value");
if (null != valueExpression) {
String v = valueExpression.getExpressionString();
if (null != v) {
Matcher matcher = EL_EXPRESSION.matcher(v);
if (matcher.find()) {
String exp = matcher.group();
return exp.substring(2, exp.length() - 1);
}
return v;
}
}
return null;
} | class class_name[name] begin[{]
method[getCoreValueExpression, return_type[type[String]], modifier[public static], parameter[component]] begin[{]
local_variable[type[ValueExpression], valueExpression]
if[binary_operation[literal[null], !=, member[.valueExpression]]] begin[{]
local_variable[type[String], v]
if[binary_operation[literal[null], !=, member[.v]]] begin[{]
local_variable[type[Matcher], matcher]
if[call[matcher.find, parameter[]]] begin[{]
local_variable[type[String], exp]
return[call[exp.substring, parameter[literal[2], binary_operation[call[exp.length, parameter[]], -, literal[1]]]]]
else begin[{]
None
end[}]
return[member[.v]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getCoreValueExpression] operator[SEP] identifier[UIComponent] identifier[component] operator[SEP] {
identifier[ValueExpression] identifier[valueExpression] operator[=] identifier[component] operator[SEP] identifier[getValueExpression] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[valueExpression] operator[SEP] {
identifier[String] identifier[v] operator[=] identifier[valueExpression] operator[SEP] identifier[getExpressionString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[v] operator[SEP] {
identifier[Matcher] identifier[matcher] operator[=] identifier[EL_EXPRESSION] operator[SEP] identifier[matcher] operator[SEP] identifier[v] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[exp] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[exp] operator[SEP] identifier[substring] operator[SEP] Other[2] , identifier[exp] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[v] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
protected final void set(int pos, String value) {
value = StringUtils.trimToNull(value);
if (value != null)
this.values.put(pos, value);
else if (this.values.containsKey(pos))
this.values.remove(pos);
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[final protected], parameter[pos, value]] begin[{]
assign[member[.value], call[StringUtils.trimToNull, parameter[member[.value]]]]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
THIS[member[None.values]call[None.put, parameter[member[.pos], member[.value]]]]
else begin[{]
if[THIS[member[None.values]call[None.containsKey, parameter[member[.pos]]]]] begin[{]
THIS[member[None.values]call[None.remove, parameter[member[.pos]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[void] identifier[set] operator[SEP] Keyword[int] identifier[pos] , identifier[String] identifier[value] operator[SEP] {
identifier[value] operator[=] identifier[StringUtils] operator[SEP] identifier[trimToNull] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[pos] , identifier[value] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[containsKey] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[remove] operator[SEP] identifier[pos] operator[SEP] operator[SEP]
}
|
public void addSession(String id, Session session) {
poolGroupManager.addSession(id, session);
LOG.info("Session " + id +
" has been added to " + type + " scheduler");
} | class class_name[name] begin[{]
method[addSession, return_type[void], modifier[public], parameter[id, session]] begin[{]
call[poolGroupManager.addSession, parameter[member[.id], member[.session]]]
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Session "], +, member[.id]], +, literal[" has been added to "]], +, member[.type]], +, literal[" scheduler"]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addSession] operator[SEP] identifier[String] identifier[id] , identifier[Session] identifier[session] operator[SEP] {
identifier[poolGroupManager] operator[SEP] identifier[addSession] operator[SEP] identifier[id] , identifier[session] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[id] operator[+] literal[String] operator[+] identifier[type] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
void configurePort(String port) {
if (StringUtils.isNotBlank(port)) {
try {
this.port = Integer.parseInt(port);
log.info("Using port {}", this.port);
} catch (NumberFormatException e) {
log.info("Unable to parse server PORT variable ({}). Defaulting to port {}", port, this.port);
}
}
} | class class_name[name] begin[{]
method[configurePort, return_type[void], modifier[default], parameter[port]] begin[{]
if[call[StringUtils.isNotBlank, parameter[member[.port]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=port, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Using port {}"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=port, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to parse server PORT variable ({}). Defaulting to port {}"), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=port, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[configurePort] operator[SEP] identifier[String] identifier[port] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[port] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[port] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[port] , Keyword[this] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
}
}
|
public static void addService(ServerEnvironment serverEnvironment, ServiceTarget target) {
target.addService(SERVICE_NAME, new ServerEnvironmentService(serverEnvironment))
.install();
} | class class_name[name] begin[{]
method[addService, return_type[void], modifier[public static], parameter[serverEnvironment, target]] begin[{]
call[target.addService, parameter[member[.SERVICE_NAME], ClassCreator(arguments=[MemberReference(member=serverEnvironment, 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=ServerEnvironmentService, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addService] operator[SEP] identifier[ServerEnvironment] identifier[serverEnvironment] , identifier[ServiceTarget] identifier[target] operator[SEP] {
identifier[target] operator[SEP] identifier[addService] operator[SEP] identifier[SERVICE_NAME] , Keyword[new] identifier[ServerEnvironmentService] operator[SEP] identifier[serverEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[install] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ParseException create(List<ParseError> errors) {
if (errors.size() == 1) {
return new ParseException(errors.get(0).getMessage(), errors);
} else if (errors.size() > 1) {
return new ParseException(String.format("%d errors occured. First: %s",
errors.size(),
errors.get(0).getMessage()), errors);
} else {
return new ParseException("An unknown error occured", errors);
}
} | class class_name[name] begin[{]
method[create, return_type[type[ParseException]], modifier[public static], parameter[errors]] begin[{]
if[binary_operation[call[errors.size, parameter[]], ==, literal[1]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None))]
else begin[{]
if[binary_operation[call[errors.size, parameter[]], >, literal[1]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d errors occured. First: %s"), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An unknown error occured"), MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None))]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ParseException] identifier[create] operator[SEP] identifier[List] operator[<] identifier[ParseError] operator[>] identifier[errors] operator[SEP] {
Keyword[if] operator[SEP] identifier[errors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[return] Keyword[new] identifier[ParseException] operator[SEP] identifier[errors] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[errors] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[errors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[return] Keyword[new] identifier[ParseException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[errors] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[errors] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] , identifier[errors] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[ParseException] operator[SEP] literal[String] , identifier[errors] operator[SEP] operator[SEP]
}
}
|
public void setOnsubmit(java.lang.String onsubmit) {
getStateHelper().put(PropertyKeys.onsubmit, onsubmit);
handleAttribute("onsubmit", onsubmit);
} | class class_name[name] begin[{]
method[setOnsubmit, return_type[void], modifier[public], parameter[onsubmit]] begin[{]
call[.getStateHelper, parameter[]]
call[.handleAttribute, parameter[literal["onsubmit"], member[.onsubmit]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setOnsubmit] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[onsubmit] operator[SEP] {
identifier[getStateHelper] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[PropertyKeys] operator[SEP] identifier[onsubmit] , identifier[onsubmit] operator[SEP] operator[SEP] identifier[handleAttribute] operator[SEP] literal[String] , identifier[onsubmit] operator[SEP] operator[SEP]
}
|
@Override
public void removeByG_A(long groupId, boolean active) {
for (CommerceCountry commerceCountry : findByG_A(groupId, active,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCountry);
}
} | class class_name[name] begin[{]
method[removeByG_A, return_type[void], modifier[public], parameter[groupId, active]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=commerceCountry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=active, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ALL_POS, postfix_operators=[], prefix_operators=[], qualifier=QueryUtil, selectors=[]), MemberReference(member=ALL_POS, postfix_operators=[], prefix_operators=[], qualifier=QueryUtil, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=findByG_A, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=commerceCountry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CommerceCountry, sub_type=None))), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[removeByG_A] operator[SEP] Keyword[long] identifier[groupId] , Keyword[boolean] identifier[active] operator[SEP] {
Keyword[for] operator[SEP] identifier[CommerceCountry] identifier[commerceCountry] operator[:] identifier[findByG_A] operator[SEP] identifier[groupId] , identifier[active] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , Other[null] operator[SEP] operator[SEP] {
identifier[remove] operator[SEP] identifier[commerceCountry] operator[SEP] operator[SEP]
}
}
|
protected void fireDrawingEnd() {
final ListenerCollection<EventListener> list = this.listeners;
if (list != null) {
for (final DrawingListener listener : list.getListeners(DrawingListener.class)) {
listener.onDrawingEnd();
}
}
} | class class_name[name] begin[{]
method[fireDrawingEnd, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[ListenerCollection], list]
if[binary_operation[member[.list], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onDrawingEnd, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DrawingListener, sub_type=None))], member=getListeners, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DrawingListener, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[fireDrawingEnd] operator[SEP] operator[SEP] {
Keyword[final] identifier[ListenerCollection] operator[<] identifier[EventListener] operator[>] identifier[list] operator[=] Keyword[this] operator[SEP] identifier[listeners] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[DrawingListener] identifier[listener] operator[:] identifier[list] operator[SEP] identifier[getListeners] operator[SEP] identifier[DrawingListener] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[listener] operator[SEP] identifier[onDrawingEnd] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Nonnull
public static FileIOError createDir (@Nonnull final Path aDir)
{
ValueEnforcer.notNull (aDir, "Directory");
final Path aRealDir = _getUnifiedPath (aDir);
return FileOperations.createDir (aRealDir.toFile ());
// // Does the directory already exist?
// if (Files.exists (aRealDir))
// return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError
// (EFileIOOperation.CREATE_DIR, aRealDir);
//
// // Is the parent directory writable?
// final Path aParentDir = aRealDir.getParent ();
// if (aParentDir != null && Files.exists (aParentDir) && !Files.isWritable
// (aParentDir))
// return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError
// (EFileIOOperation.CREATE_DIR, aRealDir);
//
// return _perform (EFileIOOperation.CREATE_DIR, Files::createDirectory,
// aRealDir);
} | class class_name[name] begin[{]
method[createDir, return_type[type[FileIOError]], modifier[public static], parameter[aDir]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aDir], literal["Directory"]]]
local_variable[type[Path], aRealDir]
return[call[FileOperations.createDir, parameter[call[aRealDir.toFile, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[FileIOError] identifier[createDir] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Path] identifier[aDir] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aDir] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Path] identifier[aRealDir] operator[=] identifier[_getUnifiedPath] operator[SEP] identifier[aDir] operator[SEP] operator[SEP] Keyword[return] identifier[FileOperations] operator[SEP] identifier[createDir] operator[SEP] identifier[aRealDir] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String getAddress(HttpServletRequest request){
String path = request.getScheme()+"://"+request.getServerName();
//port
if(request.getScheme().equals("http")&&request.getServerPort()!=80)
path+=":"+request.getServerPort();
if(request.getScheme().equals("https")&&request.getServerPort()!=443)
path+=":"+request.getServerPort();
path+=request.getRequestURI();
return path;
} | class class_name[name] begin[{]
method[getAddress, return_type[type[String]], modifier[protected], parameter[request]] begin[{]
local_variable[type[String], path]
if[binary_operation[call[request.getScheme, parameter[]], &&, binary_operation[call[request.getServerPort, parameter[]], !=, literal[80]]]] begin[{]
assign[member[.path], binary_operation[literal[":"], +, call[request.getServerPort, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[request.getScheme, parameter[]], &&, binary_operation[call[request.getServerPort, parameter[]], !=, literal[443]]]] begin[{]
assign[member[.path], binary_operation[literal[":"], +, call[request.getServerPort, parameter[]]]]
else begin[{]
None
end[}]
assign[member[.path], call[request.getRequestURI, parameter[]]]
return[member[.path]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getAddress] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[request] operator[SEP] identifier[getServerName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[request] operator[SEP] identifier[getServerPort] operator[SEP] operator[SEP] operator[!=] Other[80] operator[SEP] identifier[path] operator[+=] literal[String] operator[+] identifier[request] operator[SEP] identifier[getServerPort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[request] operator[SEP] identifier[getServerPort] operator[SEP] operator[SEP] operator[!=] Other[443] operator[SEP] identifier[path] operator[+=] literal[String] operator[+] identifier[request] operator[SEP] identifier[getServerPort] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[+=] identifier[request] operator[SEP] identifier[getRequestURI] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP]
}
|
public static void bucketSort( int[] arr, int m )
{
int[] count = new int[m];
int j, i = 0;
//System.out.println(count[0]==0?"true":"false");
for ( j = 0; j < arr.length; j++ ) {
count[ arr[j] ]++;
}
//loop and filter the elements
for ( j = 0; j < m; j++ ) {
if ( count[j] > 0 ) {
while ( count[j]-- > 0 ) {
arr[i++] = j;
}
}
}
} | class class_name[name] begin[{]
method[bucketSort, return_type[void], modifier[public static], parameter[arr, m]] begin[{]
local_variable[type[int], count]
local_variable[type[int], j]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=arr, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), condition=BinaryOperation(operandl=MemberReference(member=count, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[bucketSort] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[arr] , Keyword[int] identifier[m] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[count] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[m] operator[SEP] operator[SEP] Keyword[int] identifier[j] , identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[arr] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[count] operator[SEP] identifier[arr] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[++] operator[SEP]
}
Keyword[for] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[m] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[count] operator[SEP] identifier[j] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[while] operator[SEP] identifier[count] operator[SEP] identifier[j] operator[SEP] operator[--] operator[>] Other[0] operator[SEP] {
identifier[arr] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[j] operator[SEP]
}
}
}
}
|
@Override
public boolean hasNext()
{
try
{
if(this.resultSet == null)
return false;
else if(!this.resultSet.next())
{
this.dispose();
return false;
}
return true;
}
catch (SQLException e)
{
dispose();
throw new CommunicationException(e.getMessage(),e);
}
} | class class_name[name] begin[{]
method[hasNext, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=resultSet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=This(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MemberReference(member=resultSet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=next, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=dispose, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=dispose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, 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=CommunicationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[resultSet] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[resultSet] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[dispose] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CommunicationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static <T extends Chunkable> byte[] chunkFrom(T chunkable, int chunkLength,
int chunkNum) {
int start = chunkNum * chunkLength;
return bytesFrom(chunkable, start, chunkLength);
} | class class_name[name] begin[{]
method[chunkFrom, return_type[type[byte]], modifier[public static], parameter[chunkable, chunkLength, chunkNum]] begin[{]
local_variable[type[int], start]
return[call[.bytesFrom, parameter[member[.chunkable], member[.start], member[.chunkLength]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Chunkable] operator[>] Keyword[byte] operator[SEP] operator[SEP] identifier[chunkFrom] operator[SEP] identifier[T] identifier[chunkable] , Keyword[int] identifier[chunkLength] , Keyword[int] identifier[chunkNum] operator[SEP] {
Keyword[int] identifier[start] operator[=] identifier[chunkNum] operator[*] identifier[chunkLength] operator[SEP] Keyword[return] identifier[bytesFrom] operator[SEP] identifier[chunkable] , identifier[start] , identifier[chunkLength] operator[SEP] operator[SEP]
}
|
public static long getLongParameter (
HttpServletRequest req, String name, long defval, String invalidDataMessage)
throws DataValidationException
{
String value = getParameter(req, name, false);
if (StringUtil.isBlank(value)) {
return defval;
}
return parseLongParameter(value, invalidDataMessage);
} | class class_name[name] begin[{]
method[getLongParameter, return_type[type[long]], modifier[public static], parameter[req, name, defval, invalidDataMessage]] begin[{]
local_variable[type[String], value]
if[call[StringUtil.isBlank, parameter[member[.value]]]] begin[{]
return[member[.defval]]
else begin[{]
None
end[}]
return[call[.parseLongParameter, parameter[member[.value], member[.invalidDataMessage]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[getLongParameter] operator[SEP] identifier[HttpServletRequest] identifier[req] , identifier[String] identifier[name] , Keyword[long] identifier[defval] , identifier[String] identifier[invalidDataMessage] operator[SEP] Keyword[throws] identifier[DataValidationException] {
identifier[String] identifier[value] operator[=] identifier[getParameter] operator[SEP] identifier[req] , identifier[name] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtil] operator[SEP] identifier[isBlank] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] identifier[defval] operator[SEP]
}
Keyword[return] identifier[parseLongParameter] operator[SEP] identifier[value] , identifier[invalidDataMessage] operator[SEP] operator[SEP]
}
|
private Path[] getMapFiles(FileSystem fs, boolean isLocal)
throws IOException {
List<Path> fileList = new ArrayList<Path>();
if (isLocal) {
// for local jobs
for(int i = 0; i < numMaps; ++i) {
fileList.add(mapOutputFile.getInputFile(i, getTaskID()));
}
} else {
// for non local jobs
for (FileStatus filestatus : mapOutputFilesOnDisk) {
fileList.add(filestatus.getPath());
}
}
return fileList.toArray(new Path[0]);
} | class class_name[name] begin[{]
method[getMapFiles, return_type[type[Path]], modifier[private], parameter[fs, isLocal]] begin[{]
local_variable[type[List], fileList]
if[member[.isLocal]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTaskID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getInputFile, postfix_operators=[], prefix_operators=[], qualifier=mapOutputFile, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fileList, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numMaps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=filestatus, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fileList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mapOutputFilesOnDisk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filestatus)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileStatus, sub_type=None))), label=None)
end[}]
return[call[fileList.toArray, parameter[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None))]]]
end[}]
END[}] | Keyword[private] identifier[Path] operator[SEP] operator[SEP] identifier[getMapFiles] operator[SEP] identifier[FileSystem] identifier[fs] , Keyword[boolean] identifier[isLocal] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[List] operator[<] identifier[Path] operator[>] identifier[fileList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Path] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isLocal] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numMaps] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[fileList] operator[SEP] identifier[add] operator[SEP] identifier[mapOutputFile] operator[SEP] identifier[getInputFile] operator[SEP] identifier[i] , identifier[getTaskID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[FileStatus] identifier[filestatus] operator[:] identifier[mapOutputFilesOnDisk] operator[SEP] {
identifier[fileList] operator[SEP] identifier[add] operator[SEP] identifier[filestatus] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[fileList] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Path] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
|
public EmbedBuilder setFooter(String text, String iconUrl)
{
//We only check if the text is null because its presence is what determines if the
// footer will appear in the embed.
if (text == null)
{
this.footer = null;
}
else
{
Checks.check(text.length() <= MessageEmbed.TEXT_MAX_LENGTH, "Text cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH);
urlCheck(iconUrl);
this.footer = new MessageEmbed.Footer(text, iconUrl, null);
}
return this;
} | class class_name[name] begin[{]
method[setFooter, return_type[type[EmbedBuilder]], modifier[public], parameter[text, iconUrl]] begin[{]
if[binary_operation[member[.text], ==, literal[null]]] begin[{]
assign[THIS[member[None.footer]], literal[null]]
else begin[{]
call[Checks.check, parameter[binary_operation[call[text.length, parameter[]], <=, member[MessageEmbed.TEXT_MAX_LENGTH]], literal["Text cannot be longer than %d characters."], member[MessageEmbed.TEXT_MAX_LENGTH]]]
call[.urlCheck, parameter[member[.iconUrl]]]
assign[THIS[member[None.footer]], ClassCreator(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iconUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MessageEmbed, sub_type=ReferenceType(arguments=None, dimensions=None, name=Footer, sub_type=None)))]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[EmbedBuilder] identifier[setFooter] operator[SEP] identifier[String] identifier[text] , identifier[String] identifier[iconUrl] operator[SEP] {
Keyword[if] operator[SEP] identifier[text] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[footer] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[Checks] operator[SEP] identifier[check] operator[SEP] identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<=] identifier[MessageEmbed] operator[SEP] identifier[TEXT_MAX_LENGTH] , literal[String] , identifier[MessageEmbed] operator[SEP] identifier[TEXT_MAX_LENGTH] operator[SEP] operator[SEP] identifier[urlCheck] operator[SEP] identifier[iconUrl] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[footer] operator[=] Keyword[new] identifier[MessageEmbed] operator[SEP] identifier[Footer] operator[SEP] identifier[text] , identifier[iconUrl] , Other[null] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) {
final Flux<ByteBuf> contents = context.httpRequest().body() == null
? Flux.just(getEmptyBuffer())
: context.httpRequest().body();
return contents.defaultIfEmpty(getEmptyBuffer())
.collect(() -> {
try {
return MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw Exceptions.propagate(e);
}
}, (messageDigest, byteBuffer) -> {
if (messageDigest != null) {
messageDigest.update(byteBuffer.nioBuffer());
}
})
.flatMap(messageDigest -> {
final HttpHeaders headers = context.httpRequest().headers();
final String contentHash = Base64.getEncoder().encodeToString(messageDigest.digest());
// All three of these headers are used by ConfigurationClientCredentials to generate the
// Authentication header value. So, we need to ensure that they exist.
headers.set(HOST_HEADER, context.httpRequest().url().getHost());
headers.set(CONTENT_HASH_HEADER, contentHash);
if (headers.value(DATE_HEADER) == null) {
String utcNow = OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.RFC_1123_DATE_TIME);
headers.set(DATE_HEADER, utcNow);
}
return next.process();
});
} | class class_name[name] begin[{]
method[process, return_type[type[Mono]], modifier[public], parameter[context, next]] begin[{]
local_variable[type[Flux], contents]
return[call[contents.defaultIfEmpty, parameter[call[.getEmptyBuffer, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Mono] operator[<] identifier[HttpResponse] operator[>] identifier[process] operator[SEP] identifier[HttpPipelineCallContext] identifier[context] , identifier[HttpPipelineNextPolicy] identifier[next] operator[SEP] {
Keyword[final] identifier[Flux] operator[<] identifier[ByteBuf] operator[>] identifier[contents] operator[=] identifier[context] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] identifier[Flux] operator[SEP] identifier[just] operator[SEP] identifier[getEmptyBuffer] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[context] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[contents] operator[SEP] identifier[defaultIfEmpty] operator[SEP] identifier[getEmptyBuffer] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[try] {
Keyword[return] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[e] operator[SEP] {
Keyword[throw] identifier[Exceptions] operator[SEP] identifier[propagate] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
} , operator[SEP] identifier[messageDigest] , identifier[byteBuffer] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[messageDigest] operator[!=] Other[null] operator[SEP] {
identifier[messageDigest] operator[SEP] identifier[update] operator[SEP] identifier[byteBuffer] operator[SEP] identifier[nioBuffer] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[messageDigest] operator[->] {
Keyword[final] identifier[HttpHeaders] identifier[headers] operator[=] identifier[context] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[contentHash] operator[=] identifier[Base64] operator[SEP] identifier[getEncoder] operator[SEP] operator[SEP] operator[SEP] identifier[encodeToString] operator[SEP] identifier[messageDigest] operator[SEP] identifier[digest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[set] operator[SEP] identifier[HOST_HEADER] , identifier[context] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[url] operator[SEP] operator[SEP] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[set] operator[SEP] identifier[CONTENT_HASH_HEADER] , identifier[contentHash] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[headers] operator[SEP] identifier[value] operator[SEP] identifier[DATE_HEADER] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[utcNow] operator[=] identifier[OffsetDateTime] operator[SEP] identifier[now] operator[SEP] identifier[ZoneOffset] operator[SEP] identifier[UTC] operator[SEP] operator[SEP] identifier[format] operator[SEP] identifier[DateTimeFormatter] operator[SEP] identifier[RFC_1123_DATE_TIME] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[set] operator[SEP] identifier[DATE_HEADER] , identifier[utcNow] operator[SEP] operator[SEP]
}
Keyword[return] identifier[next] operator[SEP] identifier[process] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public Iterable<? extends Element> analyze(Iterable<? extends Element> classes) {
enter(null); // ensure all classes have been entered
final ListBuffer<Element> results = new ListBuffer<>();
try {
if (classes == null) {
handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results);
} else {
Filter f = new Filter() {
@Override
public void process(Env<AttrContext> env) {
handleFlowResults(compiler.flow(compiler.attribute(env)), results);
}
};
f.run(compiler.todo, classes);
}
} finally {
compiler.log.flush();
}
return results;
} | class class_name[name] begin[{]
method[analyze, return_type[type[Iterable]], modifier[public], parameter[classes]] begin[{]
call[.enter, parameter[literal[null]]]
local_variable[type[ListBuffer], results]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=env, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None)], member=flow, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None), MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleFlowResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=process, parameters=[FormalParameter(annotations=[], modifiers=set(), name=env, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AttrContext, sub_type=None))], dimensions=[], name=Env, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Filter, sub_type=None)), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Filter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[]), MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=run, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[])], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None)], member=flow, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None), MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleFlowResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=compiler.log, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.results]]
end[}]
END[}] | Keyword[public] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[Element] operator[>] identifier[analyze] operator[SEP] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[Element] operator[>] identifier[classes] operator[SEP] {
identifier[enter] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[final] identifier[ListBuffer] operator[<] identifier[Element] operator[>] identifier[results] operator[=] Keyword[new] identifier[ListBuffer] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[classes] operator[==] Other[null] operator[SEP] {
identifier[handleFlowResults] operator[SEP] identifier[compiler] operator[SEP] identifier[flow] operator[SEP] identifier[compiler] operator[SEP] identifier[attribute] operator[SEP] identifier[compiler] operator[SEP] identifier[todo] operator[SEP] operator[SEP] , identifier[results] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Filter] identifier[f] operator[=] Keyword[new] identifier[Filter] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[process] operator[SEP] identifier[Env] operator[<] identifier[AttrContext] operator[>] identifier[env] operator[SEP] {
identifier[handleFlowResults] operator[SEP] identifier[compiler] operator[SEP] identifier[flow] operator[SEP] identifier[compiler] operator[SEP] identifier[attribute] operator[SEP] identifier[env] operator[SEP] operator[SEP] , identifier[results] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[f] operator[SEP] identifier[run] operator[SEP] identifier[compiler] operator[SEP] identifier[todo] , identifier[classes] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[compiler] operator[SEP] identifier[log] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[results] operator[SEP]
}
|
public byte[] drawTileBytes(int x, int y, int zoom) {
Bitmap bitmap = drawTile(x, y, zoom);
byte[] tileData = null;
// Convert the bitmap to bytes
if (bitmap != null) {
try {
tileData = BitmapConverter.toBytes(
bitmap, compressFormat);
} catch (IOException e) {
Log.e(FeatureTiles.class.getSimpleName(), "Failed to create tile. x: " + x + ", y: "
+ y + ", zoom: " + zoom, e);
} finally {
bitmap.recycle();
}
}
return tileData;
} | class class_name[name] begin[{]
method[drawTileBytes, return_type[type[byte]], modifier[public], parameter[x, y, zoom]] begin[{]
local_variable[type[Bitmap], bitmap]
local_variable[type[byte], tileData]
if[binary_operation[member[.bitmap], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tileData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bitmap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=compressFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBytes, postfix_operators=[], prefix_operators=[], qualifier=BitmapConverter, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[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=FeatureTiles, sub_type=None)), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to create tile. x: "), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", y: "), operator=+), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", zoom: "), operator=+), operandr=MemberReference(member=zoom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=e, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=recycle, postfix_operators=[], prefix_operators=[], qualifier=bitmap, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[member[.tileData]]
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[drawTileBytes] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[y] , Keyword[int] identifier[zoom] operator[SEP] {
identifier[Bitmap] identifier[bitmap] operator[=] identifier[drawTile] operator[SEP] identifier[x] , identifier[y] , identifier[zoom] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[tileData] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[bitmap] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[tileData] operator[=] identifier[BitmapConverter] operator[SEP] identifier[toBytes] operator[SEP] identifier[bitmap] , identifier[compressFormat] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[FeatureTiles] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[x] operator[+] literal[String] operator[+] identifier[y] operator[+] literal[String] operator[+] identifier[zoom] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[bitmap] operator[SEP] identifier[recycle] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[tileData] operator[SEP]
}
|
public ServiceFuture<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath, final ServiceCallback<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath), serviceCallback);
} | class class_name[name] begin[{]
method[beginListRoutesTableSummaryAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, crossConnectionName, peeringName, devicePath, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.beginListRoutesTableSummaryWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.crossConnectionName], member[.peeringName], member[.devicePath]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner] operator[>] identifier[beginListRoutesTableSummaryAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[crossConnectionName] , identifier[String] identifier[peeringName] , identifier[String] identifier[devicePath] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[beginListRoutesTableSummaryWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[crossConnectionName] , identifier[peeringName] , identifier[devicePath] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public static String msgToString(AbstractMessage message)
{
if (message == null) return STRING_NULL;
if (message instanceof JsMessage) return message + "[" + ((JsMessage)message).getSystemMessageId() + "]";
return message.toString();
} | class class_name[name] begin[{]
method[msgToString, return_type[type[String]], modifier[public static], parameter[message]] begin[{]
if[binary_operation[member[.message], ==, literal[null]]] begin[{]
return[member[.STRING_NULL]]
else begin[{]
None
end[}]
if[binary_operation[member[.message], instanceof, type[JsMessage]]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.message], +, literal["["]], +, Cast(expression=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsMessage, sub_type=None))], +, literal["]"]]]
else begin[{]
None
end[}]
return[call[message.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[msgToString] operator[SEP] identifier[AbstractMessage] identifier[message] operator[SEP] {
Keyword[if] operator[SEP] identifier[message] operator[==] Other[null] operator[SEP] Keyword[return] identifier[STRING_NULL] operator[SEP] Keyword[if] operator[SEP] identifier[message] Keyword[instanceof] identifier[JsMessage] operator[SEP] Keyword[return] identifier[message] operator[+] literal[String] operator[+] operator[SEP] operator[SEP] identifier[JsMessage] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[getSystemMessageId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[return] identifier[message] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Timebase valueOf(String rate)
{
if (rate.equalsIgnoreCase("PAL"))
{
return HZ_25;
}
else if (rate.equals("23.976"))
{
return NTSC_24;
}
else if (rate.equalsIgnoreCase("NTSC") || rate.equals("29.97"))
{
return NTSC;
}
else if (rate.equals("59.94"))
{
return NTSC_60;
}
else if (rate.equalsIgnoreCase("NTSC30"))
{
return HZ_30;
}
else
{
final String[] parts = rate.split(":");
final int denominator;
final int numerator;
if (parts.length == 2)
{
numerator = Integer.parseInt(parts[1]);
}
else if (parts.length == 1)
{
numerator = 1; // default to 1 when numerator is not provided
}
else
{
throw new IllegalArgumentException("Cannot parse encoded timebase: " + rate);
}
denominator = Integer.parseInt(parts[0]);
return new Timebase(numerator, denominator);
}
} | class class_name[name] begin[{]
method[valueOf, return_type[type[Timebase]], modifier[public static], parameter[rate]] begin[{]
if[call[rate.equalsIgnoreCase, parameter[literal["PAL"]]]] begin[{]
return[member[.HZ_25]]
else begin[{]
if[call[rate.equals, parameter[literal["23.976"]]]] begin[{]
return[member[.NTSC_24]]
else begin[{]
if[binary_operation[call[rate.equalsIgnoreCase, parameter[literal["NTSC"]]], ||, call[rate.equals, parameter[literal["29.97"]]]]] begin[{]
return[member[.NTSC]]
else begin[{]
if[call[rate.equals, parameter[literal["59.94"]]]] begin[{]
return[member[.NTSC_60]]
else begin[{]
if[call[rate.equalsIgnoreCase, parameter[literal["NTSC30"]]]] begin[{]
return[member[.HZ_30]]
else begin[{]
local_variable[type[String], parts]
local_variable[type[int], denominator]
local_variable[type[int], numerator]
if[binary_operation[member[parts.length], ==, literal[2]]] begin[{]
assign[member[.numerator], call[Integer.parseInt, parameter[member[.parts]]]]
else begin[{]
if[binary_operation[member[parts.length], ==, literal[1]]] begin[{]
assign[member[.numerator], literal[1]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot parse encoded timebase: "), operandr=MemberReference(member=rate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
assign[member[.denominator], call[Integer.parseInt, parameter[member[.parts]]]]
return[ClassCreator(arguments=[MemberReference(member=numerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=denominator, 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=Timebase, sub_type=None))]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Timebase] identifier[valueOf] operator[SEP] identifier[String] identifier[rate] operator[SEP] {
Keyword[if] operator[SEP] identifier[rate] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[HZ_25] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rate] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[NTSC_24] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rate] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[||] identifier[rate] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[NTSC] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rate] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[NTSC_60] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rate] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[HZ_30] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[rate] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[denominator] operator[SEP] Keyword[final] Keyword[int] identifier[numerator] operator[SEP] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[numerator] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[numerator] operator[=] Other[1] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[rate] operator[SEP] operator[SEP]
}
identifier[denominator] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Timebase] operator[SEP] identifier[numerator] , identifier[denominator] operator[SEP] operator[SEP]
}
}
|
final public XPathNode parse(MetadataMapper aMetaDataMapper) throws ParseException, AttributeNotSupportedException {
_metaDataMapper = aMetaDataMapper;
if (_metaDataMapper != null) {
checkLocation = true;
}
XPath();
{
if (true)
return node;
}
throw new Error("Missing return statement in function");
} | class class_name[name] begin[{]
method[parse, return_type[type[XPathNode]], modifier[final public], parameter[aMetaDataMapper]] begin[{]
assign[member[._metaDataMapper], member[.aMetaDataMapper]]
if[binary_operation[member[._metaDataMapper], !=, literal[null]]] begin[{]
assign[member[.checkLocation], literal[true]]
else begin[{]
None
end[}]
call[.XPath, parameter[]]
if[literal[true]] begin[{]
return[member[.node]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing return statement in function")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Error, sub_type=None)), label=None)
end[}]
END[}] | Keyword[final] Keyword[public] identifier[XPathNode] identifier[parse] operator[SEP] identifier[MetadataMapper] identifier[aMetaDataMapper] operator[SEP] Keyword[throws] identifier[ParseException] , identifier[AttributeNotSupportedException] {
identifier[_metaDataMapper] operator[=] identifier[aMetaDataMapper] operator[SEP] Keyword[if] operator[SEP] identifier[_metaDataMapper] operator[!=] Other[null] operator[SEP] {
identifier[checkLocation] operator[=] literal[boolean] operator[SEP]
}
identifier[XPath] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[boolean] operator[SEP] Keyword[return] identifier[node] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[Error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public AuthenticationService getAuthenticationService() {
AuthenticationService service = authnService.get();
if (service == null) {
if (isConfigurationDefinedInFile()) {
String id = getEffectiveSecurityConfiguration().getAuthenticationServiceId();
service = getAuthenticationService(id);
} else {
service = autoDetectService(KEY_AUTHENTICATION, authentication);
}
// remember the authentication service
authnService.set(service);
}
// since the saf delegation code might be invoked from the authentication service,
// activate the authentication service if it is available.
if (!authorization.isEmpty()) {
getAuthorizationService();
}
return service;
} | class class_name[name] begin[{]
method[getAuthenticationService, return_type[type[AuthenticationService]], modifier[public], parameter[]] begin[{]
local_variable[type[AuthenticationService], service]
if[binary_operation[member[.service], ==, literal[null]]] begin[{]
if[call[.isConfigurationDefinedInFile, parameter[]]] begin[{]
local_variable[type[String], id]
assign[member[.service], call[.getAuthenticationService, parameter[member[.id]]]]
else begin[{]
assign[member[.service], call[.autoDetectService, parameter[member[.KEY_AUTHENTICATION], member[.authentication]]]]
end[}]
call[authnService.set, parameter[member[.service]]]
else begin[{]
None
end[}]
if[call[authorization.isEmpty, parameter[]]] begin[{]
call[.getAuthorizationService, parameter[]]
else begin[{]
None
end[}]
return[member[.service]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[AuthenticationService] identifier[getAuthenticationService] operator[SEP] operator[SEP] {
identifier[AuthenticationService] identifier[service] operator[=] identifier[authnService] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[service] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[isConfigurationDefinedInFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[id] operator[=] identifier[getEffectiveSecurityConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getAuthenticationServiceId] operator[SEP] operator[SEP] operator[SEP] identifier[service] operator[=] identifier[getAuthenticationService] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[service] operator[=] identifier[autoDetectService] operator[SEP] identifier[KEY_AUTHENTICATION] , identifier[authentication] operator[SEP] operator[SEP]
}
identifier[authnService] operator[SEP] identifier[set] operator[SEP] identifier[service] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[authorization] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[getAuthorizationService] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[service] operator[SEP]
}
|
public void print(boolean b) throws IOException {
String msg;
if (b) {
msg = lStrings.getString("value.true");
} else {
msg = lStrings.getString("value.false");
}
print(msg);
} | class class_name[name] begin[{]
method[print, return_type[void], modifier[public], parameter[b]] begin[{]
local_variable[type[String], msg]
if[member[.b]] begin[{]
assign[member[.msg], call[lStrings.getString, parameter[literal["value.true"]]]]
else begin[{]
assign[member[.msg], call[lStrings.getString, parameter[literal["value.false"]]]]
end[}]
call[.print, parameter[member[.msg]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[print] operator[SEP] Keyword[boolean] identifier[b] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[msg] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[SEP] {
identifier[msg] operator[=] identifier[lStrings] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[msg] operator[=] identifier[lStrings] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[print] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
|
protected void createConversationState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createConversationState");
// Now create the Conversation wide ConversationState
ClientConversationState ccs = new ClientConversationState();
getConversation().setAttachment(ccs);
// Only create one if one does not already exist
ClientLinkLevelState clls = (ClientLinkLevelState) getConversation().getLinkLevelAttachment();
if (clls == null)
{
getConversation().setLinkLevelAttachment(new ClientLinkLevelState());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createConversationState");
} | class class_name[name] begin[{]
method[createConversationState, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["createConversationState"]]]
else begin[{]
None
end[}]
local_variable[type[ClientConversationState], ccs]
call[.getConversation, parameter[]]
local_variable[type[ClientLinkLevelState], clls]
if[binary_operation[member[.clls], ==, literal[null]]] begin[{]
call[.getConversation, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["createConversationState"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[createConversationState] 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] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[ClientConversationState] identifier[ccs] operator[=] Keyword[new] identifier[ClientConversationState] operator[SEP] operator[SEP] operator[SEP] identifier[getConversation] operator[SEP] operator[SEP] operator[SEP] identifier[setAttachment] operator[SEP] identifier[ccs] operator[SEP] operator[SEP] identifier[ClientLinkLevelState] identifier[clls] operator[=] operator[SEP] identifier[ClientLinkLevelState] operator[SEP] identifier[getConversation] operator[SEP] operator[SEP] operator[SEP] identifier[getLinkLevelAttachment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clls] operator[==] Other[null] operator[SEP] {
identifier[getConversation] operator[SEP] operator[SEP] operator[SEP] identifier[setLinkLevelAttachment] operator[SEP] Keyword[new] identifier[ClientLinkLevelState] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public boolean hasRemaining() {
if (isFCEnabled()) {
int remaining = this.fcLimit - position();
if (remaining < 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "hasRmeaining, less than 0");
}
RuntimeException rte = new RuntimeException("FCWsByteBufferImpl.hasRemaining(): value is less than 0");
FFDCFilter.processException(rte, CLASS_NAME + ".hasRemaining()", "1115", this);
throw rte;
}
return (remaining > 0);
}
return super.hasRemaining();
} | class class_name[name] begin[{]
method[hasRemaining, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[call[.isFCEnabled, parameter[]]] begin[{]
local_variable[type[int], remaining]
if[binary_operation[member[.remaining], <, literal[0]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["hasRmeaining, less than 0"]]]
else begin[{]
None
end[}]
local_variable[type[RuntimeException], rte]
call[FFDCFilter.processException, parameter[member[.rte], binary_operation[member[.CLASS_NAME], +, literal[".hasRemaining()"]], literal["1115"], THIS[]]]
ThrowStatement(expression=MemberReference(member=rte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
return[binary_operation[member[.remaining], >, literal[0]]]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[], member=hasRemaining, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasRemaining] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isFCEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[remaining] operator[=] Keyword[this] operator[SEP] identifier[fcLimit] operator[-] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[remaining] operator[<] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
identifier[RuntimeException] identifier[rte] operator[=] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[rte] , identifier[CLASS_NAME] operator[+] literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] Keyword[throw] identifier[rte] operator[SEP]
}
Keyword[return] operator[SEP] identifier[remaining] operator[>] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP]
}
|
public ArrayList<OvhContainer> project_serviceName_storage_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | class class_name[name] begin[{]
method[project_serviceName_storage_GET, return_type[type[ArrayList]], modifier[public], parameter[serviceName]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], member[.t5]]]]
end[}]
END[}] | Keyword[public] identifier[ArrayList] operator[<] identifier[OvhContainer] operator[>] identifier[project_serviceName_storage_GET] operator[SEP] identifier[String] identifier[serviceName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[t5] operator[SEP] operator[SEP]
}
|
public void marshall(DateRange dateRange, ProtocolMarshaller protocolMarshaller) {
if (dateRange == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dateRange.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(dateRange.getUnit(), UNIT_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[dateRange, protocolMarshaller]] begin[{]
if[binary_operation[member[.dateRange], ==, 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=getValue, postfix_operators=[], prefix_operators=[], qualifier=dateRange, selectors=[], type_arguments=None), MemberReference(member=VALUE_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=getUnit, postfix_operators=[], prefix_operators=[], qualifier=dateRange, selectors=[], type_arguments=None), MemberReference(member=UNIT_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[DateRange] identifier[dateRange] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[dateRange] 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[dateRange] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[VALUE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[dateRange] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] , identifier[UNIT_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]
}
}
|
private static boolean implementingObsoleteMethod(
MethodTree enclosingMethod, VisitorState state, Type type) {
MethodSymbol method = ASTHelpers.getSymbol(enclosingMethod);
if (method == null) {
return false;
}
if (ASTHelpers.findSuperMethods(method, state.getTypes()).isEmpty()) {
// not an override
return false;
}
if (!ASTHelpers.isSameType(method.getReturnType(), type, state)) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[implementingObsoleteMethod, return_type[type[boolean]], modifier[private static], parameter[enclosingMethod, state, type]] begin[{]
local_variable[type[MethodSymbol], method]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[call[ASTHelpers.findSuperMethods, parameter[member[.method], call[state.getTypes, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[call[ASTHelpers.isSameType, parameter[call[method.getReturnType, parameter[]], member[.type], member[.state]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[implementingObsoleteMethod] operator[SEP] identifier[MethodTree] identifier[enclosingMethod] , identifier[VisitorState] identifier[state] , identifier[Type] identifier[type] operator[SEP] {
identifier[MethodSymbol] identifier[method] operator[=] identifier[ASTHelpers] operator[SEP] identifier[getSymbol] operator[SEP] identifier[enclosingMethod] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ASTHelpers] operator[SEP] identifier[findSuperMethods] operator[SEP] identifier[method] , identifier[state] operator[SEP] identifier[getTypes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[ASTHelpers] operator[SEP] identifier[isSameType] operator[SEP] identifier[method] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] , identifier[type] , identifier[state] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void load2Entity(Object entity, Method setMethod, Object value) throws Exception {
try {
if (value != null) {
setMethod.invoke(entity, value);
}
} catch (Exception e) {
String sValue = value.toString();
String sValueClass = value.getClass().toString();
System.out.println("Error in " + setMethod.getName() + " invoke with param :" + sValue + " type is " +
sValueClass);
throw e;
}
} | class class_name[name] begin[{]
method[load2Entity, return_type[void], modifier[private], parameter[entity, setMethod, value]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, 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=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=setMethod, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), name=sValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=sValueClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error in "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=setMethod, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" invoke with param :"), operator=+), operandr=MemberReference(member=sValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" type is "), operator=+), operandr=MemberReference(member=sValueClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[load2Entity] operator[SEP] identifier[Object] identifier[entity] , identifier[Method] identifier[setMethod] , identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[setMethod] operator[SEP] identifier[invoke] operator[SEP] identifier[entity] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[String] identifier[sValue] operator[=] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[sValueClass] operator[=] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[setMethod] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[sValue] operator[+] literal[String] operator[+] identifier[sValueClass] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
private void radialGradient(Attributes attributes) throws SVGParseException
{
debug("<radialGradient>");
if (currentElement == null)
throw new SVGParseException("Invalid document. Root element must be <svg>");
SVG.SvgRadialGradient obj = new SVG.SvgRadialGradient();
obj.document = svgDocument;
obj.parent = currentElement;
parseAttributesCore(obj, attributes);
parseAttributesStyle(obj, attributes);
parseAttributesGradient(obj, attributes);
parseAttributesRadialGradient(obj, attributes);
currentElement.addChild(obj);
currentElement = obj;
} | class class_name[name] begin[{]
method[radialGradient, return_type[void], modifier[private], parameter[attributes]] begin[{]
call[.debug, parameter[literal["<radialGradient>"]]]
if[binary_operation[member[.currentElement], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid document. Root element must be <svg>")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SVGParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[SVG], obj]
assign[member[obj.document], member[.svgDocument]]
assign[member[obj.parent], member[.currentElement]]
call[.parseAttributesCore, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesStyle, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesGradient, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesRadialGradient, parameter[member[.obj], member[.attributes]]]
call[currentElement.addChild, parameter[member[.obj]]]
assign[member[.currentElement], member[.obj]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[radialGradient] operator[SEP] identifier[Attributes] identifier[attributes] operator[SEP] Keyword[throws] identifier[SVGParseException] {
identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentElement] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[SVGParseException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SVG] operator[SEP] identifier[SvgRadialGradient] identifier[obj] operator[=] Keyword[new] identifier[SVG] operator[SEP] identifier[SvgRadialGradient] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[document] operator[=] identifier[svgDocument] operator[SEP] identifier[obj] operator[SEP] identifier[parent] operator[=] identifier[currentElement] operator[SEP] identifier[parseAttributesCore] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesStyle] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesGradient] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesRadialGradient] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[currentElement] operator[SEP] identifier[addChild] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[currentElement] operator[=] identifier[obj] operator[SEP]
}
|
private YarnService buildYarnService(Config config, String applicationName, String applicationId,
YarnConfiguration yarnConfiguration, FileSystem fs)
throws Exception {
return new YarnService(config, applicationName, applicationId, yarnConfiguration, fs, this.eventBus);
} | class class_name[name] begin[{]
method[buildYarnService, return_type[type[YarnService]], modifier[private], parameter[config, applicationName, applicationId, yarnConfiguration, fs]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=applicationName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=applicationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=yarnConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=eventBus, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=YarnService, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[YarnService] identifier[buildYarnService] operator[SEP] identifier[Config] identifier[config] , identifier[String] identifier[applicationName] , identifier[String] identifier[applicationId] , identifier[YarnConfiguration] identifier[yarnConfiguration] , identifier[FileSystem] identifier[fs] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] Keyword[new] identifier[YarnService] operator[SEP] identifier[config] , identifier[applicationName] , identifier[applicationId] , identifier[yarnConfiguration] , identifier[fs] , Keyword[this] operator[SEP] identifier[eventBus] operator[SEP] operator[SEP]
}
|
public static <T> CollectionJsonDeserializer<T> newInstance( JsonDeserializer<T> deserializer ) {
return new CollectionJsonDeserializer<T>( deserializer );
} | class class_name[name] begin[{]
method[newInstance, return_type[type[CollectionJsonDeserializer]], modifier[public static], parameter[deserializer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=deserializer, 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=CollectionJsonDeserializer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[CollectionJsonDeserializer] operator[<] identifier[T] operator[>] identifier[newInstance] operator[SEP] identifier[JsonDeserializer] operator[<] identifier[T] operator[>] identifier[deserializer] operator[SEP] {
Keyword[return] Keyword[new] identifier[CollectionJsonDeserializer] operator[<] identifier[T] operator[>] operator[SEP] identifier[deserializer] operator[SEP] operator[SEP]
}
|
private int threshHoldExtractCluster(List<Integer> orderedFile, int[] designations)
{
int clustersFound = 0;
OnLineStatistics stats = new OnLineStatistics();
for(double r : reach_d)
if(!Double.isInfinite(r))
stats.add(r);
double thresh = stats.getMean()+stats.getStandardDeviation();
for(int i = 0; i < orderedFile.size(); i++)
{
if(reach_d[orderedFile.get(i)] >= thresh)
continue;
//Everything in between is part of the cluster
while(i < orderedFile.size() && reach_d[orderedFile.get(i)] < thresh)
designations[i++] = clustersFound;
//Climb up to the top of the hill, everything we climbed over is part of the cluster
while(i+1 < orderedFile.size() && reach_d[orderedFile.get(i)] < reach_d[orderedFile.get(i+1)])
designations[i++] = clustersFound;
clustersFound++;
}
return clustersFound;
} | class class_name[name] begin[{]
method[threshHoldExtractCluster, return_type[type[int]], modifier[private], parameter[orderedFile, designations]] begin[{]
local_variable[type[int], clustersFound]
local_variable[type[OnLineStatistics], stats]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInfinite, postfix_operators=[], prefix_operators=['!'], qualifier=Double, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=stats, selectors=[], type_arguments=None), label=None)), control=EnhancedForControl(iterable=MemberReference(member=reach_d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=r)], modifiers=set(), type=BasicType(dimensions=[], name=double))), label=None)
local_variable[type[double], thresh]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=reach_d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None))]), operandr=MemberReference(member=thresh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), WhileStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=designations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=clustersFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=reach_d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None))]), operandr=MemberReference(member=thresh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), label=None), WhileStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=designations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=clustersFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=reach_d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None))]), operandr=MemberReference(member=reach_d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None))]), operator=<), operator=&&), label=None), StatementExpression(expression=MemberReference(member=clustersFound, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=orderedFile, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.clustersFound]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[threshHoldExtractCluster] operator[SEP] identifier[List] operator[<] identifier[Integer] operator[>] identifier[orderedFile] , Keyword[int] operator[SEP] operator[SEP] identifier[designations] operator[SEP] {
Keyword[int] identifier[clustersFound] operator[=] Other[0] operator[SEP] identifier[OnLineStatistics] identifier[stats] operator[=] Keyword[new] identifier[OnLineStatistics] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[double] identifier[r] operator[:] identifier[reach_d] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Double] operator[SEP] identifier[isInfinite] operator[SEP] identifier[r] operator[SEP] operator[SEP] identifier[stats] operator[SEP] identifier[add] operator[SEP] identifier[r] operator[SEP] operator[SEP] Keyword[double] identifier[thresh] operator[=] identifier[stats] operator[SEP] identifier[getMean] operator[SEP] operator[SEP] operator[+] identifier[stats] operator[SEP] identifier[getStandardDeviation] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[orderedFile] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[reach_d] operator[SEP] identifier[orderedFile] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[>=] identifier[thresh] operator[SEP] Keyword[continue] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[<] identifier[orderedFile] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[&&] identifier[reach_d] operator[SEP] identifier[orderedFile] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[<] identifier[thresh] operator[SEP] identifier[designations] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[clustersFound] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[+] Other[1] operator[<] identifier[orderedFile] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[&&] identifier[reach_d] operator[SEP] identifier[orderedFile] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[<] identifier[reach_d] operator[SEP] identifier[orderedFile] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[designations] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[clustersFound] operator[SEP] identifier[clustersFound] operator[++] operator[SEP]
}
Keyword[return] identifier[clustersFound] operator[SEP]
}
|
private void setHeaders(final HttpServletResponse response,
final Root root) {
response.setHeader("content-type", "application/octet-stream");
response.setHeader("content-disposition",
"attachment; filename=" + getSaveFilename(root));
} | class class_name[name] begin[{]
method[setHeaders, return_type[void], modifier[private], parameter[response, root]] begin[{]
call[response.setHeader, parameter[literal["content-type"], literal["application/octet-stream"]]]
call[response.setHeader, parameter[literal["content-disposition"], binary_operation[literal["attachment; filename="], +, call[.getSaveFilename, parameter[member[.root]]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setHeaders] operator[SEP] Keyword[final] identifier[HttpServletResponse] identifier[response] , Keyword[final] identifier[Root] identifier[root] operator[SEP] {
identifier[response] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , literal[String] operator[+] identifier[getSaveFilename] operator[SEP] identifier[root] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void resetStaticState(Config config) {
Robolectric.reset();
if (!loggingInitialized) {
ShadowLog.setupLogging();
loggingInitialized = true;
}
} | class class_name[name] begin[{]
method[resetStaticState, return_type[void], modifier[public], parameter[config]] begin[{]
call[Robolectric.reset, parameter[]]
if[member[.loggingInitialized]] begin[{]
call[ShadowLog.setupLogging, parameter[]]
assign[member[.loggingInitialized], literal[true]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[resetStaticState] operator[SEP] identifier[Config] identifier[config] operator[SEP] {
identifier[Robolectric] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[loggingInitialized] operator[SEP] {
identifier[ShadowLog] operator[SEP] identifier[setupLogging] operator[SEP] operator[SEP] operator[SEP] identifier[loggingInitialized] operator[=] literal[boolean] operator[SEP]
}
}
|
void tryToDrainBuffers() {
if (evictionLock.tryLock()) {
try {
drainStatus.set(PROCESSING);
drainBuffers();
} finally {
drainStatus.compareAndSet(PROCESSING, IDLE);
evictionLock.unlock();
}
}
} | class class_name[name] begin[{]
method[tryToDrainBuffers, return_type[void], modifier[default], parameter[]] begin[{]
if[call[evictionLock.tryLock, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROCESSING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=drainStatus, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=drainBuffers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROCESSING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=IDLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareAndSet, postfix_operators=[], prefix_operators=[], qualifier=drainStatus, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=evictionLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[tryToDrainBuffers] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[evictionLock] operator[SEP] identifier[tryLock] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[drainStatus] operator[SEP] identifier[set] operator[SEP] identifier[PROCESSING] operator[SEP] operator[SEP] identifier[drainBuffers] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[drainStatus] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[PROCESSING] , identifier[IDLE] operator[SEP] operator[SEP] identifier[evictionLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static Result newBatchedExecuteRequest() {
Type[] types = new Type[]{ Type.SQL_VARCHAR };
Result result = newResult(ResultConstants.BATCHEXECDIRECT);
result.metaData = ResultMetaData.newSimpleResultMetaData(types);
return result;
} | class class_name[name] begin[{]
method[newBatchedExecuteRequest, return_type[type[Result]], modifier[public static], parameter[]] begin[{]
local_variable[type[Type], types]
local_variable[type[Result], result]
assign[member[result.metaData], call[ResultMetaData.newSimpleResultMetaData, parameter[member[.types]]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Result] identifier[newBatchedExecuteRequest] operator[SEP] operator[SEP] {
identifier[Type] operator[SEP] operator[SEP] identifier[types] operator[=] Keyword[new] identifier[Type] operator[SEP] operator[SEP] {
identifier[Type] operator[SEP] identifier[SQL_VARCHAR]
} operator[SEP] identifier[Result] identifier[result] operator[=] identifier[newResult] operator[SEP] identifier[ResultConstants] operator[SEP] identifier[BATCHEXECDIRECT] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[metaData] operator[=] identifier[ResultMetaData] operator[SEP] identifier[newSimpleResultMetaData] operator[SEP] identifier[types] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public void marshall(ComputeResource computeResource, ProtocolMarshaller protocolMarshaller) {
if (computeResource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(computeResource.getType(), TYPE_BINDING);
protocolMarshaller.marshall(computeResource.getMinvCpus(), MINVCPUS_BINDING);
protocolMarshaller.marshall(computeResource.getMaxvCpus(), MAXVCPUS_BINDING);
protocolMarshaller.marshall(computeResource.getDesiredvCpus(), DESIREDVCPUS_BINDING);
protocolMarshaller.marshall(computeResource.getInstanceTypes(), INSTANCETYPES_BINDING);
protocolMarshaller.marshall(computeResource.getImageId(), IMAGEID_BINDING);
protocolMarshaller.marshall(computeResource.getSubnets(), SUBNETS_BINDING);
protocolMarshaller.marshall(computeResource.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);
protocolMarshaller.marshall(computeResource.getEc2KeyPair(), EC2KEYPAIR_BINDING);
protocolMarshaller.marshall(computeResource.getInstanceRole(), INSTANCEROLE_BINDING);
protocolMarshaller.marshall(computeResource.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(computeResource.getPlacementGroup(), PLACEMENTGROUP_BINDING);
protocolMarshaller.marshall(computeResource.getBidPercentage(), BIDPERCENTAGE_BINDING);
protocolMarshaller.marshall(computeResource.getSpotIamFleetRole(), SPOTIAMFLEETROLE_BINDING);
protocolMarshaller.marshall(computeResource.getLaunchTemplate(), LAUNCHTEMPLATE_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[computeResource, protocolMarshaller]] begin[{]
if[binary_operation[member[.computeResource], ==, 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=getType, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=TYPE_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=getMinvCpus, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=MINVCPUS_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=getMaxvCpus, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=MAXVCPUS_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=getDesiredvCpus, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=DESIREDVCPUS_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=getInstanceTypes, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=INSTANCETYPES_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=getImageId, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=IMAGEID_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=getSubnets, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=SUBNETS_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=getSecurityGroupIds, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=SECURITYGROUPIDS_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=getEc2KeyPair, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=EC2KEYPAIR_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=getInstanceRole, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=INSTANCEROLE_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=getTags, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=TAGS_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=getPlacementGroup, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=PLACEMENTGROUP_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=getBidPercentage, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=BIDPERCENTAGE_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=getSpotIamFleetRole, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=SPOTIAMFLEETROLE_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=getLaunchTemplate, postfix_operators=[], prefix_operators=[], qualifier=computeResource, selectors=[], type_arguments=None), MemberReference(member=LAUNCHTEMPLATE_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[ComputeResource] identifier[computeResource] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[computeResource] 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[computeResource] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[TYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getMinvCpus] operator[SEP] operator[SEP] , identifier[MINVCPUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getMaxvCpus] operator[SEP] operator[SEP] , identifier[MAXVCPUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getDesiredvCpus] operator[SEP] operator[SEP] , identifier[DESIREDVCPUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getInstanceTypes] operator[SEP] operator[SEP] , identifier[INSTANCETYPES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getImageId] operator[SEP] operator[SEP] , identifier[IMAGEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getSubnets] operator[SEP] operator[SEP] , identifier[SUBNETS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getSecurityGroupIds] operator[SEP] operator[SEP] , identifier[SECURITYGROUPIDS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getEc2KeyPair] operator[SEP] operator[SEP] , identifier[EC2KEYPAIR_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getInstanceRole] operator[SEP] operator[SEP] , identifier[INSTANCEROLE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getTags] operator[SEP] operator[SEP] , identifier[TAGS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getPlacementGroup] operator[SEP] operator[SEP] , identifier[PLACEMENTGROUP_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getBidPercentage] operator[SEP] operator[SEP] , identifier[BIDPERCENTAGE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getSpotIamFleetRole] operator[SEP] operator[SEP] , identifier[SPOTIAMFLEETROLE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[computeResource] operator[SEP] identifier[getLaunchTemplate] operator[SEP] operator[SEP] , identifier[LAUNCHTEMPLATE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static boolean isEqual(final Object o1, final Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
if (o1.equals(o2)) {
return true;
}
switch (getTypeMark(o1, o2)) {
case BYTE:
case SHORT:
case INTEGER:
return ((Number) o1).intValue() == ((Number) o2).intValue();
case LONG:
return ((Number) o1).longValue() == ((Number) o2).longValue();
case BIG_INTEGER:
if (notDoubleOrFloat(o1, o2)) {
return toBigInteger(o1).compareTo(toBigInteger(o2)) == 0;
}
//Note: else upgrade to BigDecimal
case DOUBLE:
case FLOAT:
//Note: Floating point numbers should not be tested for equality.
case BIG_DECIMAL:
return toBigDecimal(o1).compareTo(toBigDecimal(o2)) == 0;
case CHAR:
return isEqual(charToInt(o1), charToInt(o2));
default:
}
return false;
} | class class_name[name] begin[{]
method[isEqual, return_type[type[boolean]], modifier[public static], parameter[o1, o2]] begin[{]
if[binary_operation[member[.o1], ==, member[.o2]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.o1], ==, literal[null]], ||, binary_operation[member[.o2], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[call[o1.equals, parameter[member[.o2]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['BYTE', 'SHORT', 'INTEGER'], statements=[ReturnStatement(expression=BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator===), label=None)]), SwitchStatementCase(case=['LONG'], statements=[ReturnStatement(expression=BinaryOperation(operandl=Cast(expression=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Cast(expression=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operator===), label=None)]), SwitchStatementCase(case=['BIG_INTEGER'], statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=notDoubleOrFloat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBigInteger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBigInteger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), label=None)]))]), SwitchStatementCase(case=['DOUBLE', 'FLOAT', 'BIG_DECIMAL'], statements=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), label=None)]), SwitchStatementCase(case=['CHAR'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=isEqual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[])], expression=MethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTypeMark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isEqual] operator[SEP] Keyword[final] identifier[Object] identifier[o1] , Keyword[final] identifier[Object] identifier[o2] operator[SEP] {
Keyword[if] operator[SEP] identifier[o1] operator[==] identifier[o2] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[o1] operator[==] Other[null] operator[||] identifier[o2] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[o1] operator[SEP] identifier[equals] operator[SEP] identifier[o2] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[getTypeMark] operator[SEP] identifier[o1] , identifier[o2] operator[SEP] operator[SEP] {
Keyword[case] identifier[BYTE] operator[:] Keyword[case] identifier[SHORT] operator[:] Keyword[case] identifier[INTEGER] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[==] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[LONG] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[==] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[o2] operator[SEP] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[BIG_INTEGER] operator[:] Keyword[if] operator[SEP] identifier[notDoubleOrFloat] operator[SEP] identifier[o1] , identifier[o2] operator[SEP] operator[SEP] {
Keyword[return] identifier[toBigInteger] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[toBigInteger] operator[SEP] identifier[o2] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP]
}
Keyword[case] identifier[DOUBLE] operator[:] Keyword[case] identifier[FLOAT] operator[:] Keyword[case] identifier[BIG_DECIMAL] operator[:] Keyword[return] identifier[toBigDecimal] operator[SEP] identifier[o1] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[toBigDecimal] operator[SEP] identifier[o2] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[case] identifier[CHAR] operator[:] Keyword[return] identifier[isEqual] operator[SEP] identifier[charToInt] operator[SEP] identifier[o1] operator[SEP] , identifier[charToInt] operator[SEP] identifier[o2] operator[SEP] operator[SEP] operator[SEP] Keyword[default] operator[:]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void awaitState(State expectedState) throws Exception {
while (this.lifeCycle.getState() != expectedState) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// We do not know why this happened.
// We do not know how to handle it, either.
throw e;
}
}
} | class class_name[name] begin[{]
method[awaitState, return_type[void], modifier[private], parameter[expectedState]] begin[{]
while[binary_operation[THIS[member[None.lifeCycle]call[None.getState, parameter[]]], !=, member[.expectedState]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[awaitState] operator[SEP] identifier[State] identifier[expectedState] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[while] operator[SEP] Keyword[this] operator[SEP] identifier[lifeCycle] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[!=] identifier[expectedState] operator[SEP] {
Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
}
}
|
private String getWebSocketURL(HttpRequest req) {
String protocol = Constants.WS_SCHEME;
if (secureConnection) {
protocol = Constants.WSS_SCHEME;
}
return protocol + "://" + req.headers().get("Host") + req.uri();
} | class class_name[name] begin[{]
method[getWebSocketURL, return_type[type[String]], modifier[private], parameter[req]] begin[{]
local_variable[type[String], protocol]
if[member[.secureConnection]] begin[{]
assign[member[.protocol], member[Constants.WSS_SCHEME]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[binary_operation[member[.protocol], +, literal["://"]], +, call[req.headers, parameter[]]], +, call[req.uri, parameter[]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getWebSocketURL] operator[SEP] identifier[HttpRequest] identifier[req] operator[SEP] {
identifier[String] identifier[protocol] operator[=] identifier[Constants] operator[SEP] identifier[WS_SCHEME] operator[SEP] Keyword[if] operator[SEP] identifier[secureConnection] operator[SEP] {
identifier[protocol] operator[=] identifier[Constants] operator[SEP] identifier[WSS_SCHEME] operator[SEP]
}
Keyword[return] identifier[protocol] operator[+] literal[String] operator[+] identifier[req] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[+] identifier[req] operator[SEP] identifier[uri] operator[SEP] operator[SEP] operator[SEP]
}
|
public static RecordingUpdater updater(final String pathAccountSid,
final String pathConferenceSid,
final String pathSid,
final Recording.Status status) {
return new RecordingUpdater(pathAccountSid, pathConferenceSid, pathSid, status);
} | class class_name[name] begin[{]
method[updater, return_type[type[RecordingUpdater]], modifier[public static], parameter[pathAccountSid, pathConferenceSid, pathSid, status]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=pathAccountSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathConferenceSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, 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=RecordingUpdater, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RecordingUpdater] identifier[updater] operator[SEP] Keyword[final] identifier[String] identifier[pathAccountSid] , Keyword[final] identifier[String] identifier[pathConferenceSid] , Keyword[final] identifier[String] identifier[pathSid] , Keyword[final] identifier[Recording] operator[SEP] identifier[Status] identifier[status] operator[SEP] {
Keyword[return] Keyword[new] identifier[RecordingUpdater] operator[SEP] identifier[pathAccountSid] , identifier[pathConferenceSid] , identifier[pathSid] , identifier[status] operator[SEP] operator[SEP]
}
|
private IAtomContainer buildChain(int length, boolean isMainCyclic) {
IAtomContainer currentChain;
if (length > 0) {
//If is cyclic
if (isMainCyclic) {
//Rely on CDK's ring class constructor to generate our cyclic molecules.
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
currentChain.add(currentMolecule.getBuilder().newInstance(IRing.class, length, "C"));
} //Else must not be cyclic
else {
currentChain = makeAlkane(length);
}
} else {
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
}
return currentChain;
} | class class_name[name] begin[{]
method[buildChain, return_type[type[IAtomContainer]], modifier[private], parameter[length, isMainCyclic]] begin[{]
local_variable[type[IAtomContainer], currentChain]
if[binary_operation[member[.length], >, literal[0]]] begin[{]
if[member[.isMainCyclic]] begin[{]
assign[member[.currentChain], call[currentMolecule.getBuilder, parameter[]]]
call[currentChain.add, parameter[call[currentMolecule.getBuilder, parameter[]]]]
else begin[{]
assign[member[.currentChain], call[.makeAlkane, parameter[member[.length]]]]
end[}]
else begin[{]
assign[member[.currentChain], call[currentMolecule.getBuilder, parameter[]]]
end[}]
return[member[.currentChain]]
end[}]
END[}] | Keyword[private] identifier[IAtomContainer] identifier[buildChain] operator[SEP] Keyword[int] identifier[length] , Keyword[boolean] identifier[isMainCyclic] operator[SEP] {
identifier[IAtomContainer] identifier[currentChain] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[isMainCyclic] operator[SEP] {
identifier[currentChain] operator[=] identifier[currentMolecule] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[currentChain] operator[SEP] identifier[add] operator[SEP] identifier[currentMolecule] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IRing] operator[SEP] Keyword[class] , identifier[length] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[currentChain] operator[=] identifier[makeAlkane] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[currentChain] operator[=] identifier[currentMolecule] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainer] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[return] identifier[currentChain] operator[SEP]
}
|
@Override
public boolean checkMgtKeyInUse(String CorpNum, int ItemCode, String MgtKey)
throws PopbillException {
if (MgtKey == null || MgtKey.isEmpty())
throw new PopbillException(-99999999, "๊ด๋ฆฌ๋ฒํธ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.");
try{
StatementInfo info = httpget("/Statement/" + ItemCode + "/" + MgtKey,
CorpNum, null, StatementInfo.class);
return (info.getItemKey() == null || info.getItemKey().isEmpty()) == false;
} catch(PopbillException PE){
if(PE.getCode() == -12000004)
return false;
throw PE;
}
} | class class_name[name] begin[{]
method[checkMgtKeyInUse, return_type[type[boolean]], modifier[public], parameter[CorpNum, ItemCode, MgtKey]] begin[{]
if[binary_operation[binary_operation[member[.MgtKey], ==, literal[null]], ||, call[MgtKey.isEmpty, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=99999999), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="๊ด๋ฆฌ๋ฒํธ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PopbillException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/Statement/"), operandr=MemberReference(member=ItemCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=MgtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=CorpNum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StatementInfo, sub_type=None))], member=httpget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StatementInfo, sub_type=None)), ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getItemKey, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=getItemKey, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), operator===), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCode, postfix_operators=[], prefix_operators=[], qualifier=PE, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=12000004), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)), ThrowStatement(expression=MemberReference(member=PE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=PE, types=['PopbillException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[checkMgtKeyInUse] operator[SEP] identifier[String] identifier[CorpNum] , Keyword[int] identifier[ItemCode] , identifier[String] identifier[MgtKey] operator[SEP] Keyword[throws] identifier[PopbillException] {
Keyword[if] operator[SEP] identifier[MgtKey] operator[==] Other[null] operator[||] identifier[MgtKey] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[PopbillException] operator[SEP] operator[-] Other[99999999] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[StatementInfo] identifier[info] operator[=] identifier[httpget] operator[SEP] literal[String] operator[+] identifier[ItemCode] operator[+] literal[String] operator[+] identifier[MgtKey] , identifier[CorpNum] , Other[null] , identifier[StatementInfo] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[info] operator[SEP] identifier[getItemKey] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[info] operator[SEP] identifier[getItemKey] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PopbillException] identifier[PE] operator[SEP] {
Keyword[if] operator[SEP] identifier[PE] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[==] operator[-] Other[12000004] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[throw] identifier[PE] operator[SEP]
}
}
|
void onSurfaceChanged(int width, int height) {
Log.v(TAG, "onSurfaceChanged");
final VrAppSettings.EyeBufferParams.DepthFormat depthFormat = mApplication.getAppSettings().getEyeBufferParams().getDepthFormat();
mApplication.getConfigurationManager().configureRendering(VrAppSettings.EyeBufferParams.DepthFormat.DEPTH_24_STENCIL_8 == depthFormat);
} | class class_name[name] begin[{]
method[onSurfaceChanged, return_type[void], modifier[default], parameter[width, height]] begin[{]
call[Log.v, parameter[member[.TAG], literal["onSurfaceChanged"]]]
local_variable[type[VrAppSettings], depthFormat]
call[mApplication.getConfigurationManager, parameter[]]
end[}]
END[}] | Keyword[void] identifier[onSurfaceChanged] operator[SEP] Keyword[int] identifier[width] , Keyword[int] identifier[height] operator[SEP] {
identifier[Log] operator[SEP] identifier[v] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[VrAppSettings] operator[SEP] identifier[EyeBufferParams] operator[SEP] identifier[DepthFormat] identifier[depthFormat] operator[=] identifier[mApplication] operator[SEP] identifier[getAppSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getEyeBufferParams] operator[SEP] operator[SEP] operator[SEP] identifier[getDepthFormat] operator[SEP] operator[SEP] operator[SEP] identifier[mApplication] operator[SEP] identifier[getConfigurationManager] operator[SEP] operator[SEP] operator[SEP] identifier[configureRendering] operator[SEP] identifier[VrAppSettings] operator[SEP] identifier[EyeBufferParams] operator[SEP] identifier[DepthFormat] operator[SEP] identifier[DEPTH_24_STENCIL_8] operator[==] identifier[depthFormat] operator[SEP] operator[SEP]
}
|
public static BigRational bernoulli(int n) {
if (n < 0) {
throw new ArithmeticException("Illegal bernoulli(n) for n < 0: n = " + n);
}
if (n == 1) {
return valueOf(-1, 2);
} else if (n % 2 == 1) {
return ZERO;
}
synchronized (bernoulliCache) {
int index = n / 2;
if (bernoulliCache.size() <= index) {
for (int i = bernoulliCache.size(); i <= index; i++) {
BigRational b = calculateBernoulli(i * 2);
bernoulliCache.add(b);
}
}
return bernoulliCache.get(index);
}
} | class class_name[name] begin[{]
method[bernoulli, return_type[type[BigRational]], modifier[public static], parameter[n]] begin[{]
if[binary_operation[member[.n], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal bernoulli(n) for n < 0: n = "), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArithmeticException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.n], ==, literal[1]]] begin[{]
return[call[.valueOf, parameter[literal[1], literal[2]]]]
else begin[{]
if[binary_operation[binary_operation[member[.n], %, literal[2]], ==, literal[1]]] begin[{]
return[member[.ZERO]]
else begin[{]
None
end[}]
end[}]
SYNCHRONIZED[member[.bernoulliCache]] BEGIN[{]
local_variable[type[int], index]
if[binary_operation[call[bernoulliCache.size, parameter[]], <=, member[.index]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=*)], member=calculateBernoulli, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=b)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigRational, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=bernoulliCache, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bernoulliCache, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[call[bernoulliCache.get, parameter[member[.index]]]]
END[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigRational] identifier[bernoulli] operator[SEP] Keyword[int] identifier[n] operator[SEP] {
Keyword[if] operator[SEP] identifier[n] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArithmeticException] operator[SEP] literal[String] operator[+] identifier[n] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[n] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[valueOf] operator[SEP] operator[-] Other[1] , Other[2] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[n] operator[%] Other[2] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[ZERO] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[bernoulliCache] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[n] operator[/] Other[2] operator[SEP] Keyword[if] operator[SEP] identifier[bernoulliCache] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<=] identifier[index] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[bernoulliCache] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<=] identifier[index] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[BigRational] identifier[b] operator[=] identifier[calculateBernoulli] operator[SEP] identifier[i] operator[*] Other[2] operator[SEP] operator[SEP] identifier[bernoulliCache] operator[SEP] identifier[add] operator[SEP] identifier[b] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[bernoulliCache] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
}
|
public static NetworkConfig fromJsonStream(InputStream configStream) throws InvalidArgumentException, NetworkConfigurationException {
logger.trace("NetworkConfig.fromJsonStream...");
// Sanity check
if (configStream == null) {
throw new InvalidArgumentException("configStream must be specified");
}
// Read the input stream and convert to JSON
try (JsonReader reader = Json.createReader(configStream)) {
JsonObject jsonConfig = (JsonObject) reader.read();
return fromJsonObject(jsonConfig);
}
} | class class_name[name] begin[{]
method[fromJsonStream, return_type[type[NetworkConfig]], modifier[public static], parameter[configStream]] begin[{]
call[logger.trace, parameter[literal["NetworkConfig.fromJsonStream..."]]]
if[binary_operation[member[.configStream], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="configStream must be specified")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), name=jsonConfig)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=jsonConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromJsonObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=JsonReader, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=configStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createReader, postfix_operators=[], prefix_operators=[], qualifier=Json, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] Keyword[static] identifier[NetworkConfig] identifier[fromJsonStream] operator[SEP] identifier[InputStream] identifier[configStream] operator[SEP] Keyword[throws] identifier[InvalidArgumentException] , identifier[NetworkConfigurationException] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[configStream] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] operator[SEP] identifier[JsonReader] identifier[reader] operator[=] identifier[Json] operator[SEP] identifier[createReader] operator[SEP] identifier[configStream] operator[SEP] operator[SEP] {
identifier[JsonObject] identifier[jsonConfig] operator[=] operator[SEP] identifier[JsonObject] operator[SEP] identifier[reader] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[fromJsonObject] operator[SEP] identifier[jsonConfig] operator[SEP] operator[SEP]
}
}
|
public static MimeBodyPart newAttachmentBodyPart( String content, String contentId, String mimeType, String fileName)
throws MessagingException, IOException
{
MimeBodyPart mimeBodyPart = new MimeBodyPart();
// log.debug("Creating an attachment for content '{}', mimeType '{}', fileName '{}'.", new Object[] {content, mimeType, fileName});
mimeBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(content, mimeType + UTF_8_CHARACTER_SET)));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT);
if( fileName != null ) {
mimeBodyPart.setFileName(fileName);
}
return mimeBodyPart;
} | class class_name[name] begin[{]
method[newAttachmentBodyPart, return_type[type[MimeBodyPart]], modifier[public static], parameter[content, contentId, mimeType, fileName]] begin[{]
local_variable[type[MimeBodyPart], mimeBodyPart]
call[mimeBodyPart.setDataHandler, parameter[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=UTF_8_CHARACTER_SET, 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=ByteArrayDataSource, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataHandler, sub_type=None))]]
if[binary_operation[member[.contentId], !=, literal[null]]] begin[{]
call[mimeBodyPart.setHeader, parameter[literal["Content-ID"], member[.contentId]]]
else begin[{]
None
end[}]
call[mimeBodyPart.setDisposition, parameter[member[.DISPOSITION_ATTACHMENT]]]
if[binary_operation[member[.fileName], !=, literal[null]]] begin[{]
call[mimeBodyPart.setFileName, parameter[member[.fileName]]]
else begin[{]
None
end[}]
return[member[.mimeBodyPart]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MimeBodyPart] identifier[newAttachmentBodyPart] operator[SEP] identifier[String] identifier[content] , identifier[String] identifier[contentId] , identifier[String] identifier[mimeType] , identifier[String] identifier[fileName] operator[SEP] Keyword[throws] identifier[MessagingException] , identifier[IOException] {
identifier[MimeBodyPart] identifier[mimeBodyPart] operator[=] Keyword[new] identifier[MimeBodyPart] operator[SEP] operator[SEP] operator[SEP] identifier[mimeBodyPart] operator[SEP] identifier[setDataHandler] operator[SEP] Keyword[new] identifier[DataHandler] operator[SEP] Keyword[new] identifier[ByteArrayDataSource] operator[SEP] identifier[content] , identifier[mimeType] operator[+] identifier[UTF_8_CHARACTER_SET] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[contentId] operator[!=] Other[null] operator[SEP] {
identifier[mimeBodyPart] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , identifier[contentId] operator[SEP] operator[SEP]
}
identifier[mimeBodyPart] operator[SEP] identifier[setDisposition] operator[SEP] identifier[DISPOSITION_ATTACHMENT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fileName] operator[!=] Other[null] operator[SEP] {
identifier[mimeBodyPart] operator[SEP] identifier[setFileName] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mimeBodyPart] operator[SEP]
}
|
@Override
void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
boolean quoted = buffer.startsWith("\"");
if (candidates.size() == 1) {
// Escaping must occur in all cases.
// if quoted, only " will be escaped.
EscapeSelector escSelector = quoted
? QUOTES_ONLY_ESCAPE_SELECTOR : ESCAPE_SELECTOR;
candidates.set(0, Util.escapeString(candidates.get(0), escSelector));
}
} | class class_name[name] begin[{]
method[completeCandidates, return_type[void], modifier[default], parameter[ctx, buffer, cursor, candidates]] begin[{]
local_variable[type[boolean], quoted]
if[binary_operation[call[candidates.size, parameter[]], ==, literal[1]]] begin[{]
local_variable[type[EscapeSelector], escSelector]
call[candidates.set, parameter[literal[0], call[Util.escapeString, parameter[call[candidates.get, parameter[literal[0]]], member[.escSelector]]]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[void] identifier[completeCandidates] operator[SEP] identifier[CommandContext] identifier[ctx] , identifier[String] identifier[buffer] , Keyword[int] identifier[cursor] , identifier[List] operator[<] identifier[String] operator[>] identifier[candidates] operator[SEP] {
Keyword[boolean] identifier[quoted] operator[=] identifier[buffer] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[candidates] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[EscapeSelector] identifier[escSelector] operator[=] identifier[quoted] operator[?] identifier[QUOTES_ONLY_ESCAPE_SELECTOR] operator[:] identifier[ESCAPE_SELECTOR] operator[SEP] identifier[candidates] operator[SEP] identifier[set] operator[SEP] Other[0] , identifier[Util] operator[SEP] identifier[escapeString] operator[SEP] identifier[candidates] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[escSelector] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e)
{
Entry[] tab = table;
int len = tab.length;
while (e != null)
{
if (e.key == key)
return e.value;
i = nextIndex(i, len);
e = tab[i];
}
return null;
} | class class_name[name] begin[{]
method[getEntryAfterMiss, return_type[type[Object]], modifier[private], parameter[key, i, e]] begin[{]
local_variable[type[Entry], tab]
local_variable[type[int], len]
while[binary_operation[member[.e], !=, literal[null]]] begin[{]
if[binary_operation[member[e.key], ==, member[.key]]] begin[{]
return[member[e.value]]
else begin[{]
None
end[}]
assign[member[.i], call[.nextIndex, parameter[member[.i], member[.len]]]]
assign[member[.e], member[.tab]]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[getEntryAfterMiss] operator[SEP] identifier[TransactionLocal] identifier[key] , Keyword[int] identifier[i] , identifier[Entry] identifier[e] operator[SEP] {
identifier[Entry] operator[SEP] operator[SEP] identifier[tab] operator[=] identifier[table] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[tab] operator[SEP] identifier[length] operator[SEP] Keyword[while] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[key] operator[==] identifier[key] operator[SEP] Keyword[return] identifier[e] operator[SEP] identifier[value] operator[SEP] identifier[i] operator[=] identifier[nextIndex] operator[SEP] identifier[i] , identifier[len] operator[SEP] operator[SEP] identifier[e] operator[=] identifier[tab] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected BaseTile computeFringeTile (int tx, int ty)
{
return _ctx.getTileManager().getAutoFringer().getFringeTile(_model, tx, ty, _fringes,
_masks);
} | class class_name[name] begin[{]
method[computeFringeTile, return_type[type[BaseTile]], modifier[protected], parameter[tx, ty]] begin[{]
return[call[_ctx.getTileManager, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[BaseTile] identifier[computeFringeTile] operator[SEP] Keyword[int] identifier[tx] , Keyword[int] identifier[ty] operator[SEP] {
Keyword[return] identifier[_ctx] operator[SEP] identifier[getTileManager] operator[SEP] operator[SEP] operator[SEP] identifier[getAutoFringer] operator[SEP] operator[SEP] operator[SEP] identifier[getFringeTile] operator[SEP] identifier[_model] , identifier[tx] , identifier[ty] , identifier[_fringes] , identifier[_masks] operator[SEP] operator[SEP]
}
|
public void removeEMF(String applicationToken)
{
if (emfMap != null)
{
EntityManagerFactory emf = emfMap.get(applicationToken);
if (emf != null)
{
emf.close();
}
emfMap.remove(applicationToken);
}
} | class class_name[name] begin[{]
method[removeEMF, return_type[void], modifier[public], parameter[applicationToken]] begin[{]
if[binary_operation[member[.emfMap], !=, literal[null]]] begin[{]
local_variable[type[EntityManagerFactory], emf]
if[binary_operation[member[.emf], !=, literal[null]]] begin[{]
call[emf.close, parameter[]]
else begin[{]
None
end[}]
call[emfMap.remove, parameter[member[.applicationToken]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeEMF] operator[SEP] identifier[String] identifier[applicationToken] operator[SEP] {
Keyword[if] operator[SEP] identifier[emfMap] operator[!=] Other[null] operator[SEP] {
identifier[EntityManagerFactory] identifier[emf] operator[=] identifier[emfMap] operator[SEP] identifier[get] operator[SEP] identifier[applicationToken] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[emf] operator[!=] Other[null] operator[SEP] {
identifier[emf] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[emfMap] operator[SEP] identifier[remove] operator[SEP] identifier[applicationToken] operator[SEP] operator[SEP]
}
}
|
public Descriptor replaceAllCalls(PSequence<Call<?, ?>> calls) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | class class_name[name] begin[{]
method[replaceAllCalls, return_type[type[Descriptor]], modifier[public], parameter[calls]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=calls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathParamSerializers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=messageSerializers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serializerFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exceptionSerializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=autoAcl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=acls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=headerFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=locatableService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=circuitBreaker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=topicCalls, 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=Descriptor, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Descriptor] identifier[replaceAllCalls] operator[SEP] identifier[PSequence] operator[<] identifier[Call] operator[<] operator[?] , operator[?] operator[>] operator[>] identifier[calls] operator[SEP] {
Keyword[return] Keyword[new] identifier[Descriptor] operator[SEP] identifier[name] , identifier[calls] , identifier[pathParamSerializers] , identifier[messageSerializers] , identifier[serializerFactory] , identifier[exceptionSerializer] , identifier[autoAcl] , identifier[acls] , identifier[headerFilter] , identifier[locatableService] , identifier[circuitBreaker] , identifier[topicCalls] operator[SEP] operator[SEP]
}
|
public static void writeSchema(String outputPath, Schema schema, JavaSparkContext sc) throws IOException {
writeStringToFile(outputPath, schema.toString(), sc);
} | class class_name[name] begin[{]
method[writeSchema, return_type[void], modifier[public static], parameter[outputPath, schema, sc]] begin[{]
call[.writeStringToFile, parameter[member[.outputPath], call[schema.toString, parameter[]], member[.sc]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeSchema] operator[SEP] identifier[String] identifier[outputPath] , identifier[Schema] identifier[schema] , identifier[JavaSparkContext] identifier[sc] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeStringToFile] operator[SEP] identifier[outputPath] , identifier[schema] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[sc] operator[SEP] operator[SEP]
}
|
@Override
public List<BlogEntry.Category> getCategories() throws BlogClientException {
if (entriesCollection == null) {
throw new BlogClientException("No primary entry collection");
}
return entriesCollection.getCategories();
} | class class_name[name] begin[{]
method[getCategories, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.entriesCollection], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No primary entry collection")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BlogClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[entriesCollection.getCategories, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[BlogEntry] operator[SEP] identifier[Category] operator[>] identifier[getCategories] operator[SEP] operator[SEP] Keyword[throws] identifier[BlogClientException] {
Keyword[if] operator[SEP] identifier[entriesCollection] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BlogClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[entriesCollection] operator[SEP] identifier[getCategories] 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.