code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public double horizontalForce(Double T, double d)
{
return AE*Math.sqrt(Math.pow(T/AE+1, 2)-2*w*d/AE)-AE;
} | class class_name[name] begin[{]
method[horizontalForce, return_type[type[double]], modifier[public], parameter[T, d]] begin[{]
return[binary_operation[binary_operation[member[.AE], *, call[Math.sqrt, parameter[binary_operation[call[Math.pow, parameter[binary_operation[binary_operation[member[.T], /, member[.AE]], +, literal[1]], literal[2]]], -, binary_operation[binary_operation[binary_operation[literal[2], *, member[.w]], *, member[.d]], /, member[.AE]]]]]], -, member[.AE]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[horizontalForce] operator[SEP] identifier[Double] identifier[T] , Keyword[double] identifier[d] operator[SEP] {
Keyword[return] identifier[AE] operator[*] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[T] operator[/] identifier[AE] operator[+] Other[1] , Other[2] operator[SEP] operator[-] Other[2] operator[*] identifier[w] operator[*] identifier[d] operator[/] identifier[AE] operator[SEP] operator[-] identifier[AE] operator[SEP]
}
|
public static <C extends Comparable> boolean isLessThan(final Range<C> range, final C value) {
checkNotNull(range);
checkNotNull(value);
if (!range.hasUpperBound()) {
return false;
}
if (range.upperBoundType() == BoundType.OPEN && range.upperEndpoint().equals(value)) {
return true;
}
return range.upperEndpoint().compareTo(value) < 0;
} | class class_name[name] begin[{]
method[isLessThan, return_type[type[boolean]], modifier[public static], parameter[range, value]] begin[{]
call[.checkNotNull, parameter[member[.range]]]
call[.checkNotNull, parameter[member[.value]]]
if[call[range.hasUpperBound, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[range.upperBoundType, parameter[]], ==, member[BoundType.OPEN]], &&, call[range.upperEndpoint, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[binary_operation[call[range.upperEndpoint, parameter[]], <, literal[0]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[C] Keyword[extends] identifier[Comparable] operator[>] Keyword[boolean] identifier[isLessThan] operator[SEP] Keyword[final] identifier[Range] operator[<] identifier[C] operator[>] identifier[range] , Keyword[final] identifier[C] identifier[value] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[range] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[range] operator[SEP] identifier[hasUpperBound] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[range] operator[SEP] identifier[upperBoundType] operator[SEP] operator[SEP] operator[==] identifier[BoundType] operator[SEP] identifier[OPEN] operator[&&] identifier[range] operator[SEP] identifier[upperEndpoint] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[range] operator[SEP] identifier[upperEndpoint] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[value] operator[SEP] operator[<] Other[0] operator[SEP]
}
|
protected void fillStatement(PreparedStatement stmt, Object[] params)
throws SQLException {
fillStatement(stmt, params, null);
} | class class_name[name] begin[{]
method[fillStatement, return_type[void], modifier[protected], parameter[stmt, params]] begin[{]
call[.fillStatement, parameter[member[.stmt], member[.params], literal[null]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[fillStatement] operator[SEP] identifier[PreparedStatement] identifier[stmt] , identifier[Object] operator[SEP] operator[SEP] identifier[params] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[fillStatement] operator[SEP] identifier[stmt] , identifier[params] , Other[null] operator[SEP] operator[SEP]
}
|
private URI datasetURNtoURI(String datasetURN) {
try {
return new URI(PathUtils.mergePaths(new Path(this.storeRoot), new Path(datasetURN)).toString());
}catch (URISyntaxException e) {
log.error("Dataset with URN:" + datasetURN + " cannot be converted into URI. Skip the dataset");
return null;
}
} | class class_name[name] begin[{]
method[datasetURNtoURI, return_type[type[URI]], modifier[private], parameter[datasetURN]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=storeRoot, 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=Path, sub_type=None)), ClassCreator(arguments=[MemberReference(member=datasetURN, 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=Path, sub_type=None))], member=mergePaths, postfix_operators=[], prefix_operators=[], qualifier=PathUtils, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Dataset with URN:"), operandr=MemberReference(member=datasetURN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" cannot be converted into URI. Skip the dataset"), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[URI] identifier[datasetURNtoURI] operator[SEP] identifier[String] identifier[datasetURN] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[URI] operator[SEP] identifier[PathUtils] operator[SEP] identifier[mergePaths] operator[SEP] Keyword[new] identifier[Path] operator[SEP] Keyword[this] operator[SEP] identifier[storeRoot] operator[SEP] , Keyword[new] identifier[Path] operator[SEP] identifier[datasetURN] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[datasetURN] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public String getPrefix(int index) {
if (index < 0 || index >= mAttrCount) {
throwIndex(index);
}
return mAttributes[index].mPrefix;
} | class class_name[name] begin[{]
method[getPrefix, return_type[type[String]], modifier[public], parameter[index]] begin[{]
if[binary_operation[binary_operation[member[.index], <, literal[0]], ||, binary_operation[member[.index], >=, member[.mAttrCount]]]] begin[{]
call[.throwIndex, parameter[member[.index]]]
else begin[{]
None
end[}]
return[member[.mAttributes]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getPrefix] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[<] Other[0] operator[||] identifier[index] operator[>=] identifier[mAttrCount] operator[SEP] {
identifier[throwIndex] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mAttributes] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[mPrefix] operator[SEP]
}
|
public byte[] toByteArray() {
int size = getSize();
final ByteBuffer buff = ByteBuffer.allocate(size);
// add revision
buff.put(revision.getValue());
// add reserved
buff.put((byte) 0x00);
// add size (2 bytes reversed)
byte[] sizeSRC = NumberFacility.getBytes(size);
buff.put(sizeSRC[3]);
buff.put(sizeSRC[2]);
// add ace count (2 bytes reversed)
byte[] aceCountSRC = NumberFacility.getBytes(getAceCount());
buff.put(aceCountSRC[3]);
buff.put(aceCountSRC[2]);
// add reserved (2 bytes)
buff.put((byte) 0x00);
buff.put((byte) 0x00);
// add aces
for (ACE ace : aces) {
buff.put(ace.toByteArray());
}
return buff.array();
} | class class_name[name] begin[{]
method[toByteArray, return_type[type[byte]], modifier[public], parameter[]] begin[{]
local_variable[type[int], size]
local_variable[type[ByteBuffer], buff]
call[buff.put, parameter[call[revision.getValue, parameter[]]]]
call[buff.put, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x00), type=BasicType(dimensions=[], name=byte))]]
local_variable[type[byte], sizeSRC]
call[buff.put, parameter[member[.sizeSRC]]]
call[buff.put, parameter[member[.sizeSRC]]]
local_variable[type[byte], aceCountSRC]
call[buff.put, parameter[member[.aceCountSRC]]]
call[buff.put, parameter[member[.aceCountSRC]]]
call[buff.put, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x00), type=BasicType(dimensions=[], name=byte))]]
call[buff.put, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x00), type=BasicType(dimensions=[], name=byte))]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=ace, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=buff, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=aces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ace)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ACE, sub_type=None))), label=None)
return[call[buff.array, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ByteBuffer] identifier[buff] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[revision] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] literal[Integer] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[sizeSRC] operator[=] identifier[NumberFacility] operator[SEP] identifier[getBytes] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[sizeSRC] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[sizeSRC] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[aceCountSRC] operator[=] identifier[NumberFacility] operator[SEP] identifier[getBytes] operator[SEP] identifier[getAceCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[aceCountSRC] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[aceCountSRC] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] literal[Integer] operator[SEP] operator[SEP] identifier[buff] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] literal[Integer] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ACE] identifier[ace] operator[:] identifier[aces] operator[SEP] {
identifier[buff] operator[SEP] identifier[put] operator[SEP] identifier[ace] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[buff] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
public IfcVoidingFeatureTypeEnum createIfcVoidingFeatureTypeEnumFromString(EDataType eDataType,
String initialValue) {
IfcVoidingFeatureTypeEnum result = IfcVoidingFeatureTypeEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createIfcVoidingFeatureTypeEnumFromString, return_type[type[IfcVoidingFeatureTypeEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcVoidingFeatureTypeEnum], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[IfcVoidingFeatureTypeEnum] identifier[createIfcVoidingFeatureTypeEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcVoidingFeatureTypeEnum] identifier[result] operator[=] identifier[IfcVoidingFeatureTypeEnum] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public Result<Series> createSeries(Series series) {
checkNotNull(series);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
uri = builder.build();
} catch (URISyntaxException e) {
String message = "Could not build URI";
throw new IllegalArgumentException(message, e);
}
Result<Series> result = null;
String body = null;
try {
body = Json.dumps(series);
} catch (JsonProcessingException e) {
String message = "Error serializing the body of the request. More detail: " + e.getMessage();
result = new Result<Series>(null, GENERIC_ERROR_CODE, message);
return result;
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.POST, body);
result = execute(request, Series.class);
return result;
} | class class_name[name] begin[{]
method[createSeries, return_type[type[Result]], modifier[public], parameter[series]] begin[{]
call[.checkNotNull, parameter[member[.series]]]
local_variable[type[URI], uri]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/%s/series/"), MemberReference(member=API_VERSION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URIBuilder, sub_type=None)), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URIBuilder, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not build URI"), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
local_variable[type[Result], result]
local_variable[type[String], body]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=series, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=dumps, postfix_operators=[], prefix_operators=[], qualifier=Json, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error serializing the body of the request. More detail: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=GENERIC_ERROR_CODE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Series, sub_type=None))], dimensions=None, name=Result, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonProcessingException']))], finally_block=None, label=None, resources=None)
local_variable[type[HttpRequest], request]
assign[member[.result], call[.execute, parameter[member[.request], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Series, sub_type=None))]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Result] operator[<] identifier[Series] operator[>] identifier[createSeries] operator[SEP] identifier[Series] identifier[series] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[series] operator[SEP] operator[SEP] identifier[URI] identifier[uri] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[URIBuilder] identifier[builder] operator[=] Keyword[new] identifier[URIBuilder] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[API_VERSION] operator[SEP] operator[SEP] operator[SEP] identifier[uri] operator[=] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[message] , identifier[e] operator[SEP] operator[SEP]
}
identifier[Result] operator[<] identifier[Series] operator[>] identifier[result] operator[=] Other[null] operator[SEP] identifier[String] identifier[body] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[body] operator[=] identifier[Json] operator[SEP] identifier[dumps] operator[SEP] identifier[series] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonProcessingException] identifier[e] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[Result] operator[<] identifier[Series] operator[>] operator[SEP] Other[null] , identifier[GENERIC_ERROR_CODE] , identifier[message] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
identifier[HttpRequest] identifier[request] operator[=] identifier[buildRequest] operator[SEP] identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[HttpMethod] operator[SEP] identifier[POST] , identifier[body] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[execute] operator[SEP] identifier[request] , identifier[Series] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public INDArray get(INDArrayIndex... indexes) {
//check for row/column vector and point index being 0
if (indexes.length == 1 && indexes[0] instanceof NDArrayIndexAll || (indexes.length == 2 && (isRowVector()
&& indexes[0] instanceof PointIndex && indexes[0].offset() == 0
&& indexes[1] instanceof NDArrayIndexAll
|| isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0
&& indexes[0] instanceof NDArrayIndexAll)))
return this;
indexes = NDArrayIndex.resolve(javaShapeInformation, indexes);
throw new UnsupportedOperationException("Not implemeted");
} | class class_name[name] begin[{]
method[get, return_type[type[INDArray]], modifier[public], parameter[indexes]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[indexes.length], ==, literal[1]], &&, binary_operation[member[.indexes], instanceof, type[NDArrayIndexAll]]], ||, binary_operation[binary_operation[member[indexes.length], ==, literal[2]], &&, binary_operation[binary_operation[binary_operation[binary_operation[call[.isRowVector, parameter[]], &&, binary_operation[member[.indexes], instanceof, type[PointIndex]]], &&, binary_operation[member[.indexes], ==, literal[0]]], &&, binary_operation[member[.indexes], instanceof, type[NDArrayIndexAll]]], ||, binary_operation[binary_operation[binary_operation[call[.isColumnVector, parameter[]], &&, binary_operation[member[.indexes], instanceof, type[PointIndex]]], &&, binary_operation[member[.indexes], ==, literal[0]]], &&, binary_operation[member[.indexes], instanceof, type[NDArrayIndexAll]]]]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
assign[member[.indexes], call[NDArrayIndex.resolve, parameter[member[.javaShapeInformation], member[.indexes]]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not implemeted")], 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[}] | annotation[@] identifier[Override] Keyword[public] identifier[INDArray] identifier[get] operator[SEP] identifier[INDArrayIndex] operator[...] identifier[indexes] operator[SEP] {
Keyword[if] operator[SEP] identifier[indexes] operator[SEP] identifier[length] operator[==] Other[1] operator[&&] identifier[indexes] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[NDArrayIndexAll] operator[||] operator[SEP] identifier[indexes] operator[SEP] identifier[length] operator[==] Other[2] operator[&&] operator[SEP] identifier[isRowVector] operator[SEP] operator[SEP] operator[&&] identifier[indexes] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[PointIndex] operator[&&] identifier[indexes] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[offset] operator[SEP] operator[SEP] operator[==] Other[0] operator[&&] identifier[indexes] operator[SEP] Other[1] operator[SEP] Keyword[instanceof] identifier[NDArrayIndexAll] operator[||] identifier[isColumnVector] operator[SEP] operator[SEP] operator[&&] identifier[indexes] operator[SEP] Other[1] operator[SEP] Keyword[instanceof] identifier[PointIndex] operator[&&] identifier[indexes] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[offset] operator[SEP] operator[SEP] operator[==] Other[0] operator[&&] identifier[indexes] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[NDArrayIndexAll] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[indexes] operator[=] identifier[NDArrayIndex] operator[SEP] identifier[resolve] operator[SEP] identifier[javaShapeInformation] , identifier[indexes] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public ColumnResult<SqlResultSetMapping<T>> getOrCreateColumnResult()
{
List<Node> nodeList = childNode.get("column-result");
if (nodeList != null && nodeList.size() > 0)
{
return new ColumnResultImpl<SqlResultSetMapping<T>>(this, "column-result", childNode, nodeList.get(0));
}
return createColumnResult();
} | class class_name[name] begin[{]
method[getOrCreateColumnResult, return_type[type[ColumnResult]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="column-result"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=SqlResultSetMapping, sub_type=None))], dimensions=None, name=ColumnResultImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createColumnResult, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[ColumnResult] operator[<] identifier[SqlResultSetMapping] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateColumnResult] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[ColumnResultImpl] operator[<] identifier[SqlResultSetMapping] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createColumnResult] operator[SEP] operator[SEP] operator[SEP]
}
|
public StringExpression geometryType() {
if (geometryType == null) {
geometryType = Expressions.stringOperation(SpatialOps.GEOMETRY_TYPE, mixin);
}
return geometryType;
} | class class_name[name] begin[{]
method[geometryType, return_type[type[StringExpression]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.geometryType], ==, literal[null]]] begin[{]
assign[member[.geometryType], call[Expressions.stringOperation, parameter[member[SpatialOps.GEOMETRY_TYPE], member[.mixin]]]]
else begin[{]
None
end[}]
return[member[.geometryType]]
end[}]
END[}] | Keyword[public] identifier[StringExpression] identifier[geometryType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[geometryType] operator[==] Other[null] operator[SEP] {
identifier[geometryType] operator[=] identifier[Expressions] operator[SEP] identifier[stringOperation] operator[SEP] identifier[SpatialOps] operator[SEP] identifier[GEOMETRY_TYPE] , identifier[mixin] operator[SEP] operator[SEP]
}
Keyword[return] identifier[geometryType] operator[SEP]
}
|
public String readPeptide(String peptide) throws FastaFormatException,
org.helm.notation2.parser.exceptionparser.NotationException, ChemistryException {
return SequenceConverter.readPeptide(peptide).toHELM2();
} | class class_name[name] begin[{]
method[readPeptide, return_type[type[String]], modifier[public], parameter[peptide]] begin[{]
return[call[SequenceConverter.readPeptide, parameter[member[.peptide]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[readPeptide] operator[SEP] identifier[String] identifier[peptide] operator[SEP] Keyword[throws] identifier[FastaFormatException] , identifier[org] operator[SEP] identifier[helm] operator[SEP] identifier[notation2] operator[SEP] identifier[parser] operator[SEP] identifier[exceptionparser] operator[SEP] identifier[NotationException] , identifier[ChemistryException] {
Keyword[return] identifier[SequenceConverter] operator[SEP] identifier[readPeptide] operator[SEP] identifier[peptide] operator[SEP] operator[SEP] identifier[toHELM2] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void setConfiguration(
final Properties config
)
throws ValidityException
{
String pattern = config.getProperty( "pattern" );
if (pattern == null) {
throw new ValidityException( "no 'pattern' parameter" );
}
try {
_formatter = new SimpleDateFormat( pattern );
//throws IllegalArgumentException
} catch (Exception ex) {
throw new ValidityException( "invalid 'pattern' parameter: "
+ ex.getMessage() );
}
} | class class_name[name] begin[{]
method[setConfiguration, return_type[void], modifier[public], parameter[config]] begin[{]
local_variable[type[String], pattern]
if[binary_operation[member[.pattern], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no 'pattern' parameter")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidityException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=pattern, 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=SimpleDateFormat, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid 'pattern' parameter: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidityException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setConfiguration] operator[SEP] Keyword[final] identifier[Properties] identifier[config] operator[SEP] Keyword[throws] identifier[ValidityException] {
identifier[String] identifier[pattern] operator[=] identifier[config] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pattern] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValidityException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[_formatter] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] identifier[pattern] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValidityException] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private boolean waitForPermissionIfNecessary(final long timeoutInNanos, final long nanosToWait) {
boolean canAcquireImmediately = nanosToWait <= 0;
boolean canAcquireInTime = timeoutInNanos >= nanosToWait;
if (canAcquireImmediately) {
return true;
}
if (canAcquireInTime) {
return waitForPermission(nanosToWait);
}
waitForPermission(timeoutInNanos);
return false;
} | class class_name[name] begin[{]
method[waitForPermissionIfNecessary, return_type[type[boolean]], modifier[private], parameter[timeoutInNanos, nanosToWait]] begin[{]
local_variable[type[boolean], canAcquireImmediately]
local_variable[type[boolean], canAcquireInTime]
if[member[.canAcquireImmediately]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[member[.canAcquireInTime]] begin[{]
return[call[.waitForPermission, parameter[member[.nanosToWait]]]]
else begin[{]
None
end[}]
call[.waitForPermission, parameter[member[.timeoutInNanos]]]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[waitForPermissionIfNecessary] operator[SEP] Keyword[final] Keyword[long] identifier[timeoutInNanos] , Keyword[final] Keyword[long] identifier[nanosToWait] operator[SEP] {
Keyword[boolean] identifier[canAcquireImmediately] operator[=] identifier[nanosToWait] operator[<=] Other[0] operator[SEP] Keyword[boolean] identifier[canAcquireInTime] operator[=] identifier[timeoutInNanos] operator[>=] identifier[nanosToWait] operator[SEP] Keyword[if] operator[SEP] identifier[canAcquireImmediately] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[canAcquireInTime] operator[SEP] {
Keyword[return] identifier[waitForPermission] operator[SEP] identifier[nanosToWait] operator[SEP] operator[SEP]
}
identifier[waitForPermission] operator[SEP] identifier[timeoutInNanos] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
Path dumpXmlReport(Report report) {
if (!settings.getBoolean(PROPERTY_GENERATE_XML).orElse(false)) {
return null;
}
try {
final String reportAsString = reportToString(report);
final Path reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML);
LOG.info("PMD output report: " + reportFile.toString());
return reportFile;
} catch (IOException e) {
throw new IllegalStateException("Fail to save the PMD report", e);
}
} | class class_name[name] begin[{]
method[dumpXmlReport, return_type[type[Path]], modifier[default], parameter[report]] begin[{]
if[call[settings.getBoolean, parameter[member[.PROPERTY_GENERATE_XML]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=report, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportToString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=reportAsString)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=reportAsString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PMD_RESULT_XML, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeToWorkingDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=reportFile)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PMD output report: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=reportFile, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=reportFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to save the PMD report"), 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=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | identifier[Path] identifier[dumpXmlReport] operator[SEP] identifier[Report] identifier[report] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[settings] operator[SEP] identifier[getBoolean] operator[SEP] identifier[PROPERTY_GENERATE_XML] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] literal[boolean] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[try] {
Keyword[final] identifier[String] identifier[reportAsString] operator[=] identifier[reportToString] operator[SEP] identifier[report] operator[SEP] operator[SEP] Keyword[final] identifier[Path] identifier[reportFile] operator[=] identifier[writeToWorkingDirectory] operator[SEP] identifier[reportAsString] , identifier[PMD_RESULT_XML] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[reportFile] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[reportFile] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
public CassandraJavaPairRDD<K, V> perPartitionLimit(Long rowsNumber) {
CassandraRDD<Tuple2<K, V>> newRDD = rdd().perPartitionLimit(rowsNumber);
return wrap(newRDD);
} | class class_name[name] begin[{]
method[perPartitionLimit, return_type[type[CassandraJavaPairRDD]], modifier[public], parameter[rowsNumber]] begin[{]
local_variable[type[CassandraRDD], newRDD]
return[call[.wrap, parameter[member[.newRDD]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[CassandraJavaPairRDD] operator[<] identifier[K] , identifier[V] operator[>] identifier[perPartitionLimit] operator[SEP] identifier[Long] identifier[rowsNumber] operator[SEP] {
identifier[CassandraRDD] operator[<] identifier[Tuple2] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[newRDD] operator[=] identifier[rdd] operator[SEP] operator[SEP] operator[SEP] identifier[perPartitionLimit] operator[SEP] identifier[rowsNumber] operator[SEP] operator[SEP] Keyword[return] identifier[wrap] operator[SEP] identifier[newRDD] operator[SEP] operator[SEP]
}
|
public static Indexer create(String mapTxt) {
Context cx = Context.enter();
try {
return new Indexer(mapTxt, cx);
} finally {
Context.exit();
}
} | class class_name[name] begin[{]
method[create, return_type[type[Indexer]], modifier[public static], parameter[mapTxt]] begin[{]
local_variable[type[Context], cx]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=mapTxt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cx, 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=Indexer, sub_type=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Indexer] identifier[create] operator[SEP] identifier[String] identifier[mapTxt] operator[SEP] {
identifier[Context] identifier[cx] operator[=] identifier[Context] operator[SEP] identifier[enter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] Keyword[new] identifier[Indexer] operator[SEP] identifier[mapTxt] , identifier[cx] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[Context] operator[SEP] identifier[exit] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static ConnectionType getConnectionType(byte type) {
switch (type) {
case TYPE_OUTBOUND:
return OUTBOUND;
case TYPE_OUTBOUND_CR_TO_REMOTE:
return OUTBOUND_CR_TO_REMOTE;
case TYPE_OUTBOUND_SR_TO_CR_REMOTE:
return OUTBOUND_SR_TO_CR_REMOTE;
case TYPE_INBOUND:
return INBOUND;
case TYPE_INBOUND_CR:
return INBOUND_CR;
case TYPE_INTERNAL_CR_SR:
return INTERNAL_CR_SR;
}
return null;
} | class class_name[name] begin[{]
method[getConnectionType, return_type[type[ConnectionType]], modifier[public static], parameter[type]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['TYPE_OUTBOUND'], statements=[ReturnStatement(expression=MemberReference(member=OUTBOUND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['TYPE_OUTBOUND_CR_TO_REMOTE'], statements=[ReturnStatement(expression=MemberReference(member=OUTBOUND_CR_TO_REMOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['TYPE_OUTBOUND_SR_TO_CR_REMOTE'], statements=[ReturnStatement(expression=MemberReference(member=OUTBOUND_SR_TO_CR_REMOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['TYPE_INBOUND'], statements=[ReturnStatement(expression=MemberReference(member=INBOUND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['TYPE_INBOUND_CR'], statements=[ReturnStatement(expression=MemberReference(member=INBOUND_CR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['TYPE_INTERNAL_CR_SR'], statements=[ReturnStatement(expression=MemberReference(member=INTERNAL_CR_SR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ConnectionType] identifier[getConnectionType] operator[SEP] Keyword[byte] identifier[type] operator[SEP] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[TYPE_OUTBOUND] operator[:] Keyword[return] identifier[OUTBOUND] operator[SEP] Keyword[case] identifier[TYPE_OUTBOUND_CR_TO_REMOTE] operator[:] Keyword[return] identifier[OUTBOUND_CR_TO_REMOTE] operator[SEP] Keyword[case] identifier[TYPE_OUTBOUND_SR_TO_CR_REMOTE] operator[:] Keyword[return] identifier[OUTBOUND_SR_TO_CR_REMOTE] operator[SEP] Keyword[case] identifier[TYPE_INBOUND] operator[:] Keyword[return] identifier[INBOUND] operator[SEP] Keyword[case] identifier[TYPE_INBOUND_CR] operator[:] Keyword[return] identifier[INBOUND_CR] operator[SEP] Keyword[case] identifier[TYPE_INTERNAL_CR_SR] operator[:] Keyword[return] identifier[INTERNAL_CR_SR] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static SetOperation wrap(final Memory srcMem, final long seed) {
final byte famID = srcMem.getByte(FAMILY_BYTE);
final Family family = idToFamily(famID);
final int serVer = srcMem.getByte(SER_VER_BYTE);
if (serVer != 3) {
throw new SketchesArgumentException("SerVer must be 3: " + serVer);
}
switch (family) {
case UNION : {
return UnionImpl.wrapInstance(srcMem, seed);
}
case INTERSECTION : {
return IntersectionImplR.wrapInstance(srcMem, seed);
}
default:
throw new SketchesArgumentException("SetOperation cannot wrap family: " + family.toString());
}
} | class class_name[name] begin[{]
method[wrap, return_type[type[SetOperation]], modifier[public static], parameter[srcMem, seed]] begin[{]
local_variable[type[byte], famID]
local_variable[type[Family], family]
local_variable[type[int], serVer]
if[binary_operation[member[.serVer], !=, literal[3]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SerVer must be 3: "), operandr=MemberReference(member=serVer, 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=SketchesArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['UNION'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=srcMem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrapInstance, postfix_operators=[], prefix_operators=[], qualifier=UnionImpl, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=['INTERSECTION'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=srcMem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrapInstance, postfix_operators=[], prefix_operators=[], qualifier=IntersectionImplR, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SetOperation cannot wrap family: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=family, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SketchesArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=family, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SetOperation] identifier[wrap] operator[SEP] Keyword[final] identifier[Memory] identifier[srcMem] , Keyword[final] Keyword[long] identifier[seed] operator[SEP] {
Keyword[final] Keyword[byte] identifier[famID] operator[=] identifier[srcMem] operator[SEP] identifier[getByte] operator[SEP] identifier[FAMILY_BYTE] operator[SEP] operator[SEP] Keyword[final] identifier[Family] identifier[family] operator[=] identifier[idToFamily] operator[SEP] identifier[famID] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[serVer] operator[=] identifier[srcMem] operator[SEP] identifier[getByte] operator[SEP] identifier[SER_VER_BYTE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serVer] operator[!=] Other[3] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SketchesArgumentException] operator[SEP] literal[String] operator[+] identifier[serVer] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[family] operator[SEP] {
Keyword[case] identifier[UNION] operator[:] {
Keyword[return] identifier[UnionImpl] operator[SEP] identifier[wrapInstance] operator[SEP] identifier[srcMem] , identifier[seed] operator[SEP] operator[SEP]
}
Keyword[case] identifier[INTERSECTION] operator[:] {
Keyword[return] identifier[IntersectionImplR] operator[SEP] identifier[wrapInstance] operator[SEP] identifier[srcMem] , identifier[seed] operator[SEP] operator[SEP]
}
Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[SketchesArgumentException] operator[SEP] literal[String] operator[+] identifier[family] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public final BufferedImage decode() throws IOException {
if (!validPNG) {
return null;
}
ColorModel cmodel = new ComponentColorModel(COLOR_SPACE, BITS, false, false, Transparency.OPAQUE, DATA_TYPE);
SampleModel smodel = new ComponentSampleModel(DATA_TYPE, width, height, 3, width * 3, BAND_OFFSETS);
byte[] bytes = new byte[width * height * 3];// must new each time!
byte[][] data = new byte[][] { bytes };
ByteBuffer buffer = ByteBuffer.wrap(bytes);
decode(buffer, TextureFormat.RGB);
DataBufferByte dbuf = new DataBufferByte(data, bytes.length, OFFSET);
WritableRaster raster = Raster.createWritableRaster(smodel, dbuf, null);
BufferedImage bi = new BufferedImage(cmodel, raster, false, null);
bi.flush();
return bi;
} | class class_name[name] begin[{]
method[decode, return_type[type[BufferedImage]], modifier[final public], parameter[]] begin[{]
if[member[.validPNG]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ColorModel], cmodel]
local_variable[type[SampleModel], smodel]
local_variable[type[byte], bytes]
local_variable[type[byte], data]
local_variable[type[ByteBuffer], buffer]
call[.decode, parameter[member[.buffer], member[TextureFormat.RGB]]]
local_variable[type[DataBufferByte], dbuf]
local_variable[type[WritableRaster], raster]
local_variable[type[BufferedImage], bi]
call[bi.flush, parameter[]]
return[member[.bi]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[BufferedImage] identifier[decode] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[validPNG] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[ColorModel] identifier[cmodel] operator[=] Keyword[new] identifier[ComponentColorModel] operator[SEP] identifier[COLOR_SPACE] , identifier[BITS] , literal[boolean] , literal[boolean] , identifier[Transparency] operator[SEP] identifier[OPAQUE] , identifier[DATA_TYPE] operator[SEP] operator[SEP] identifier[SampleModel] identifier[smodel] operator[=] Keyword[new] identifier[ComponentSampleModel] operator[SEP] identifier[DATA_TYPE] , identifier[width] , identifier[height] , Other[3] , identifier[width] operator[*] Other[3] , identifier[BAND_OFFSETS] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[width] operator[*] identifier[height] operator[*] Other[3] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[bytes]
} operator[SEP] identifier[ByteBuffer] identifier[buffer] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] identifier[decode] operator[SEP] identifier[buffer] , identifier[TextureFormat] operator[SEP] identifier[RGB] operator[SEP] operator[SEP] identifier[DataBufferByte] identifier[dbuf] operator[=] Keyword[new] identifier[DataBufferByte] operator[SEP] identifier[data] , identifier[bytes] operator[SEP] identifier[length] , identifier[OFFSET] operator[SEP] operator[SEP] identifier[WritableRaster] identifier[raster] operator[=] identifier[Raster] operator[SEP] identifier[createWritableRaster] operator[SEP] identifier[smodel] , identifier[dbuf] , Other[null] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[bi] operator[=] Keyword[new] identifier[BufferedImage] operator[SEP] identifier[cmodel] , identifier[raster] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[bi] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[bi] operator[SEP]
}
|
public void setRuleId(String v) {
if (GrammarError_Type.featOkTst
&& ((GrammarError_Type) jcasType).casFeat_ruleId == null)
jcasType.jcas.throwFeatMissing("ruleId", "cogroo.uima.GrammarError");
jcasType.ll_cas.ll_setStringValue(addr,
((GrammarError_Type) jcasType).casFeatCode_ruleId, v);
} | class class_name[name] begin[{]
method[setRuleId, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[GrammarError_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrammarError_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["ruleId"], literal["cogroo.uima.GrammarError"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrammarError_Type, sub_type=None)), member[.v]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setRuleId] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[GrammarError_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[GrammarError_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_ruleId] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[GrammarError_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_ruleId] , identifier[v] operator[SEP] operator[SEP]
}
|
public static Basic2DMatrix diagonal(int size, double diagonal) {
double[][] array = new double[size][size];
for (int i = 0; i < size; i++) {
array[i][i] = diagonal;
}
return new Basic2DMatrix(array);
} | class class_name[name] begin[{]
method[diagonal, return_type[type[Basic2DMatrix]], modifier[public static], parameter[size, diagonal]] begin[{]
local_variable[type[double], array]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=diagonal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=array, 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=Basic2DMatrix, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Basic2DMatrix] identifier[diagonal] operator[SEP] Keyword[int] identifier[size] , Keyword[double] identifier[diagonal] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[array] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[diagonal] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Basic2DMatrix] operator[SEP] identifier[array] operator[SEP] operator[SEP]
}
|
public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException {
try {
prepareRequest(deleteMessageRequest);
amazonSQSClient.deleteMessage(deleteMessageRequest);
} catch (AmazonClientException e) {
throw handleException(e, "deleteMessage");
}
} | class class_name[name] begin[{]
method[deleteMessage, return_type[void], modifier[public], parameter[deleteMessageRequest]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=deleteMessageRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=deleteMessageRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deleteMessage, postfix_operators=[], prefix_operators=[], qualifier=amazonSQSClient, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="deleteMessage")], member=handleException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AmazonClientException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deleteMessage] operator[SEP] identifier[DeleteMessageRequest] identifier[deleteMessageRequest] operator[SEP] Keyword[throws] identifier[JMSException] {
Keyword[try] {
identifier[prepareRequest] operator[SEP] identifier[deleteMessageRequest] operator[SEP] operator[SEP] identifier[amazonSQSClient] operator[SEP] identifier[deleteMessage] operator[SEP] identifier[deleteMessageRequest] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AmazonClientException] identifier[e] operator[SEP] {
Keyword[throw] identifier[handleException] operator[SEP] identifier[e] , literal[String] operator[SEP] operator[SEP]
}
}
|
public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualTo(T lowerBound) {
return new GreaterThanEqualToOperator<>(lowerBound);
} | class class_name[name] begin[{]
method[greaterThanEqualTo, return_type[type[RelationalOperator]], modifier[public static], parameter[lowerBound]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=lowerBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=GreaterThanEqualToOperator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Comparable] operator[<] identifier[T] operator[>] operator[>] identifier[RelationalOperator] operator[<] identifier[T] operator[>] identifier[greaterThanEqualTo] operator[SEP] identifier[T] identifier[lowerBound] operator[SEP] {
Keyword[return] Keyword[new] identifier[GreaterThanEqualToOperator] operator[<] operator[>] operator[SEP] identifier[lowerBound] operator[SEP] operator[SEP]
}
|
@Override
protected WebResponse newWebResponse(final WebRequest webRequest,
final HttpServletResponse httpServletResponse)
{
return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse)
{
@Override
public String encodeRedirectURL(final CharSequence url)
{
return isRobot(webRequest) ? url.toString() : super.encodeRedirectURL(url);
}
@Override
public String encodeURL(final CharSequence url)
{
return isRobot(webRequest) ? url.toString() : super.encodeURL(url);
}
private boolean isRobot(final WebRequest request)
{
final String agent = webRequest.getHeader("User-Agent");
return BotAgentInspector.isAgent(agent);
}
};
} | class class_name[name] begin[{]
method[newWebResponse, return_type[type[WebResponse]], modifier[protected], parameter[webRequest, httpServletResponse]] begin[{]
return[ClassCreator(arguments=[Cast(expression=MemberReference(member=webRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ServletWebRequest, sub_type=None)), MemberReference(member=httpServletResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=webRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isRobot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=SuperMethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeRedirectURL, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)), label=None)], documentation=None, modifiers={'public'}, name=encodeRedirectURL, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=url, type=ReferenceType(arguments=None, dimensions=[], name=CharSequence, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=webRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isRobot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=SuperMethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeURL, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)), label=None)], documentation=None, modifiers={'public'}, name=encodeURL, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=url, type=ReferenceType(arguments=None, dimensions=[], name=CharSequence, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="User-Agent")], member=getHeader, postfix_operators=[], prefix_operators=[], qualifier=webRequest, selectors=[], type_arguments=None), name=agent)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=agent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAgent, postfix_operators=[], prefix_operators=[], qualifier=BotAgentInspector, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'private'}, name=isRobot, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=request, type=ReferenceType(arguments=None, dimensions=[], name=WebRequest, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServletWebResponse, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[WebResponse] identifier[newWebResponse] operator[SEP] Keyword[final] identifier[WebRequest] identifier[webRequest] , Keyword[final] identifier[HttpServletResponse] identifier[httpServletResponse] operator[SEP] {
Keyword[return] Keyword[new] identifier[ServletWebResponse] operator[SEP] operator[SEP] identifier[ServletWebRequest] operator[SEP] identifier[webRequest] , identifier[httpServletResponse] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[encodeRedirectURL] operator[SEP] Keyword[final] identifier[CharSequence] identifier[url] operator[SEP] {
Keyword[return] identifier[isRobot] operator[SEP] identifier[webRequest] operator[SEP] operator[?] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] Keyword[super] operator[SEP] identifier[encodeRedirectURL] operator[SEP] identifier[url] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[encodeURL] operator[SEP] Keyword[final] identifier[CharSequence] identifier[url] operator[SEP] {
Keyword[return] identifier[isRobot] operator[SEP] identifier[webRequest] operator[SEP] operator[?] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] Keyword[super] operator[SEP] identifier[encodeURL] operator[SEP] identifier[url] operator[SEP] operator[SEP]
}
Keyword[private] Keyword[boolean] identifier[isRobot] operator[SEP] Keyword[final] identifier[WebRequest] identifier[request] operator[SEP] {
Keyword[final] identifier[String] identifier[agent] operator[=] identifier[webRequest] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[BotAgentInspector] operator[SEP] identifier[isAgent] operator[SEP] identifier[agent] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public void quickLoad(Component component) throws Exception {
if (component.isAggregating()) {
logger.trace("Needn't real load aggregating component {}", component);
loadedFeatures.put(component, FeatureResolver.AggregatingFlag);
} else if (component.isPlain()) {
logger.trace("Needn't real load plain component {}", component);
loadedFeatures.put(component, FeatureResolver.PlainFlag);
} else {
if (isLoading(component)) return;
long start = System.currentTimeMillis();
loading(component);
ComponentResource resource = component.getResource();
if (resource == null) {
throw new IOException("The component " + component + " without resource");
}
logger.info("Loading {}", component);
List<FeatureResolver> resolvers = new ArrayList<FeatureResolver>(featureResolvers.size());
for (FeatureResolver featureResolver : featureResolvers) {
featureResolver.applyDefaults(component);
if (featureResolver.hasFeature(component)) {
resolvers.add(featureResolver);
}
}
for (FeatureResolver featureResolver : resolvers) {
featureResolver.beforeResolve(component);
}
for (FeatureResolver featureResolver : resolvers) {
featureResolver.resolve(component);
}
for (FeatureResolver featureResolver : resolvers) {
featureResolver.afterResolve(component);
}
loaded(component);
logger.info("Loaded {} ({})", component, formatDurationHMS(System.currentTimeMillis() - start));
}
} | class class_name[name] begin[{]
method[quickLoad, return_type[void], modifier[public], parameter[component]] begin[{]
if[call[component.isAggregating, parameter[]]] begin[{]
call[logger.trace, parameter[literal["Needn't real load aggregating component {}"], member[.component]]]
call[loadedFeatures.put, parameter[member[.component], member[FeatureResolver.AggregatingFlag]]]
else begin[{]
if[call[component.isPlain, parameter[]]] begin[{]
call[logger.trace, parameter[literal["Needn't real load plain component {}"], member[.component]]]
call[loadedFeatures.put, parameter[member[.component], member[FeatureResolver.PlainFlag]]]
else begin[{]
if[call[.isLoading, parameter[member[.component]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], start]
call[.loading, parameter[member[.component]]]
local_variable[type[ComponentResource], resource]
if[binary_operation[member[.resource], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The component "), operandr=MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" without resource"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[logger.info, parameter[literal["Loading {}"], member[.component]]]
local_variable[type[List], resolvers]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyDefaults, postfix_operators=[], prefix_operators=[], qualifier=featureResolver, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasFeature, postfix_operators=[], prefix_operators=[], qualifier=featureResolver, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=featureResolver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=resolvers, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=featureResolvers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=featureResolver)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FeatureResolver, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=beforeResolve, postfix_operators=[], prefix_operators=[], qualifier=featureResolver, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=resolvers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=featureResolver)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FeatureResolver, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolve, postfix_operators=[], prefix_operators=[], qualifier=featureResolver, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=resolvers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=featureResolver)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FeatureResolver, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterResolve, postfix_operators=[], prefix_operators=[], qualifier=featureResolver, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=resolvers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=featureResolver)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FeatureResolver, sub_type=None))), label=None)
call[.loaded, parameter[member[.component]]]
call[logger.info, parameter[literal["Loaded {} ({})"], member[.component], call[.formatDurationHMS, parameter[binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.start]]]]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[quickLoad] operator[SEP] identifier[Component] identifier[component] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[component] operator[SEP] identifier[isAggregating] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[component] operator[SEP] operator[SEP] identifier[loadedFeatures] operator[SEP] identifier[put] operator[SEP] identifier[component] , identifier[FeatureResolver] operator[SEP] identifier[AggregatingFlag] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[component] operator[SEP] identifier[isPlain] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[component] operator[SEP] operator[SEP] identifier[loadedFeatures] operator[SEP] identifier[put] operator[SEP] identifier[component] , identifier[FeatureResolver] operator[SEP] identifier[PlainFlag] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[isLoading] operator[SEP] identifier[component] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[loading] operator[SEP] identifier[component] operator[SEP] operator[SEP] identifier[ComponentResource] identifier[resource] operator[=] identifier[component] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resource] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[component] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[component] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[FeatureResolver] operator[>] identifier[resolvers] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[FeatureResolver] operator[>] operator[SEP] identifier[featureResolvers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FeatureResolver] identifier[featureResolver] operator[:] identifier[featureResolvers] operator[SEP] {
identifier[featureResolver] operator[SEP] identifier[applyDefaults] operator[SEP] identifier[component] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[featureResolver] operator[SEP] identifier[hasFeature] operator[SEP] identifier[component] operator[SEP] operator[SEP] {
identifier[resolvers] operator[SEP] identifier[add] operator[SEP] identifier[featureResolver] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[FeatureResolver] identifier[featureResolver] operator[:] identifier[resolvers] operator[SEP] {
identifier[featureResolver] operator[SEP] identifier[beforeResolve] operator[SEP] identifier[component] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[FeatureResolver] identifier[featureResolver] operator[:] identifier[resolvers] operator[SEP] {
identifier[featureResolver] operator[SEP] identifier[resolve] operator[SEP] identifier[component] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[FeatureResolver] identifier[featureResolver] operator[:] identifier[resolvers] operator[SEP] {
identifier[featureResolver] operator[SEP] identifier[afterResolve] operator[SEP] identifier[component] operator[SEP] operator[SEP]
}
identifier[loaded] operator[SEP] identifier[component] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[component] , identifier[formatDurationHMS] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public AuthenticationRequest setRealm(String realm) {
if (hasLegacyPath()) {
Log.w(TAG, "Not setting the 'realm' parameter as the request is using a Legacy Authorization API endpoint that doesn't support it.");
return this;
}
addParameter(REALM_KEY, realm);
return this;
} | class class_name[name] begin[{]
method[setRealm, return_type[type[AuthenticationRequest]], modifier[public], parameter[realm]] begin[{]
if[call[.hasLegacyPath, parameter[]]] begin[{]
call[Log.w, parameter[member[.TAG], literal["Not setting the 'realm' parameter as the request is using a Legacy Authorization API endpoint that doesn't support it."]]]
return[THIS[]]
else begin[{]
None
end[}]
call[.addParameter, parameter[member[.REALM_KEY], member[.realm]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[AuthenticationRequest] identifier[setRealm] operator[SEP] identifier[String] identifier[realm] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasLegacyPath] operator[SEP] operator[SEP] operator[SEP] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
identifier[addParameter] operator[SEP] identifier[REALM_KEY] , identifier[realm] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static double median(AssociativeArray2D survivalFunction) {
Double ApointTi = null;
Double BpointTi = null;
int n = survivalFunction.size();
if(n==0) {
throw new IllegalArgumentException("The provided collection can't be empty.");
}
for(Map.Entry<Object, AssociativeArray> entry : survivalFunction.entrySet()) {
Object ti = entry.getKey();
AssociativeArray row = entry.getValue();
Double Sti = row.getDouble("Sti");
if(Sti==null) {
continue; //skip censored
}
Double point = Double.valueOf(ti.toString());
if(Math.abs(Sti-0.5) < 0.0000001) {
return point; //we found extactly the point
}
else if(Sti>0.5) {
ApointTi=point; //keep the point just before the 0.5 probability
}
else {
BpointTi=point; //keep the first point after the 0.5 probability and exit loop
break;
}
}
if(n==1) {
return (ApointTi!=null)?ApointTi:BpointTi;
}
else if(ApointTi == null || BpointTi == null) {
throw new IllegalArgumentException("Invalid A and B points."); //we should never get here
}
double ApointTiValue = TypeInference.toDouble(survivalFunction.get2d(ApointTi.toString(), "Sti"));
double BpointTiValue = TypeInference.toDouble(survivalFunction.get2d(BpointTi.toString(), "Sti"));
double median=BpointTi-(BpointTiValue-0.5)*(BpointTi-ApointTi)/(BpointTiValue-ApointTiValue);
return median;
} | class class_name[name] begin[{]
method[median, return_type[type[double]], modifier[public static], parameter[survivalFunction]] begin[{]
local_variable[type[Double], ApointTi]
local_variable[type[Double], BpointTi]
local_variable[type[int], n]
if[binary_operation[member[.n], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The provided collection can't be empty.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=ti)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=row)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AssociativeArray, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Sti")], member=getDouble, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None), name=Sti)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=Sti, 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=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=ti, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), name=point)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=Sti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0000001), operator=<), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=Sti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=BpointTi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ApointTi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=survivalFunction, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AssociativeArray, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
if[binary_operation[member[.n], ==, literal[1]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=ApointTi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=BpointTi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=ApointTi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
if[binary_operation[binary_operation[member[.ApointTi], ==, literal[null]], ||, binary_operation[member[.BpointTi], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid A and B points.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
local_variable[type[double], ApointTiValue]
local_variable[type[double], BpointTiValue]
local_variable[type[double], median]
return[member[.median]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[median] operator[SEP] identifier[AssociativeArray2D] identifier[survivalFunction] operator[SEP] {
identifier[Double] identifier[ApointTi] operator[=] Other[null] operator[SEP] identifier[Double] identifier[BpointTi] operator[=] Other[null] operator[SEP] Keyword[int] identifier[n] operator[=] identifier[survivalFunction] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Object] , identifier[AssociativeArray] operator[>] identifier[entry] operator[:] identifier[survivalFunction] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[ti] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[AssociativeArray] identifier[row] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[Double] identifier[Sti] operator[=] identifier[row] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Sti] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[Double] identifier[point] operator[=] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[ti] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[Sti] operator[-] literal[Float] operator[SEP] operator[<] literal[Float] operator[SEP] {
Keyword[return] identifier[point] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Sti] operator[>] literal[Float] operator[SEP] {
identifier[ApointTi] operator[=] identifier[point] operator[SEP]
}
Keyword[else] {
identifier[BpointTi] operator[=] identifier[point] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[n] operator[==] Other[1] operator[SEP] {
Keyword[return] operator[SEP] identifier[ApointTi] operator[!=] Other[null] operator[SEP] operator[?] identifier[ApointTi] operator[:] identifier[BpointTi] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ApointTi] operator[==] Other[null] operator[||] identifier[BpointTi] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[double] identifier[ApointTiValue] operator[=] identifier[TypeInference] operator[SEP] identifier[toDouble] operator[SEP] identifier[survivalFunction] operator[SEP] identifier[get2d] operator[SEP] identifier[ApointTi] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[BpointTiValue] operator[=] identifier[TypeInference] operator[SEP] identifier[toDouble] operator[SEP] identifier[survivalFunction] operator[SEP] identifier[get2d] operator[SEP] identifier[BpointTi] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[median] operator[=] identifier[BpointTi] operator[-] operator[SEP] identifier[BpointTiValue] operator[-] literal[Float] operator[SEP] operator[*] operator[SEP] identifier[BpointTi] operator[-] identifier[ApointTi] operator[SEP] operator[/] operator[SEP] identifier[BpointTiValue] operator[-] identifier[ApointTiValue] operator[SEP] operator[SEP] Keyword[return] identifier[median] operator[SEP]
}
|
public static Session create(SessionStore sessionStore, HttpRequest<?> request) {
Session session = sessionStore.newSession();
request.getAttributes().put(HttpSessionFilter.SESSION_ATTRIBUTE, session);
return session;
} | class class_name[name] begin[{]
method[create, return_type[type[Session]], modifier[public static], parameter[sessionStore, request]] begin[{]
local_variable[type[Session], session]
call[request.getAttributes, parameter[]]
return[member[.session]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Session] identifier[create] operator[SEP] identifier[SessionStore] identifier[sessionStore] , identifier[HttpRequest] operator[<] operator[?] operator[>] identifier[request] operator[SEP] {
identifier[Session] identifier[session] operator[=] identifier[sessionStore] operator[SEP] identifier[newSession] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[HttpSessionFilter] operator[SEP] identifier[SESSION_ATTRIBUTE] , identifier[session] operator[SEP] operator[SEP] Keyword[return] identifier[session] operator[SEP]
}
|
@Beta
public static <A, B, R> Stream<R> zip(
Stream<A> streamA, Stream<B> streamB, BiFunction<? super A, ? super B, R> function) {
checkNotNull(streamA);
checkNotNull(streamB);
checkNotNull(function);
boolean isParallel = streamA.isParallel() || streamB.isParallel(); // same as Stream.concat
Spliterator<A> splitrA = streamA.spliterator();
Spliterator<B> splitrB = streamB.spliterator();
int characteristics =
splitrA.characteristics()
& splitrB.characteristics()
& (Spliterator.SIZED | Spliterator.ORDERED);
Iterator<A> itrA = Spliterators.iterator(splitrA);
Iterator<B> itrB = Spliterators.iterator(splitrB);
return StreamSupport.stream(
new AbstractSpliterator<R>(
Math.min(splitrA.estimateSize(), splitrB.estimateSize()), characteristics) {
@Override
public boolean tryAdvance(Consumer<? super R> action) {
if (itrA.hasNext() && itrB.hasNext()) {
action.accept(function.apply(itrA.next(), itrB.next()));
return true;
}
return false;
}
},
isParallel)
.onClose(streamA::close)
.onClose(streamB::close);
} | class class_name[name] begin[{]
method[zip, return_type[type[Stream]], modifier[public static], parameter[streamA, streamB, function]] begin[{]
call[.checkNotNull, parameter[member[.streamA]]]
call[.checkNotNull, parameter[member[.streamB]]]
call[.checkNotNull, parameter[member[.function]]]
local_variable[type[boolean], isParallel]
local_variable[type[Spliterator], splitrA]
local_variable[type[Spliterator], splitrB]
local_variable[type[int], characteristics]
local_variable[type[Iterator], itrA]
local_variable[type[Iterator], itrB]
return[call[StreamSupport.stream, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=estimateSize, postfix_operators=[], prefix_operators=[], qualifier=splitrA, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=estimateSize, postfix_operators=[], prefix_operators=[], qualifier=splitrB, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), MemberReference(member=characteristics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=itrA, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=itrB, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=itrA, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=itrB, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=function, selectors=[], type_arguments=None)], member=accept, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], documentation=None, modifiers={'public'}, name=tryAdvance, parameters=[FormalParameter(annotations=[], modifiers=set(), name=action, type=ReferenceType(arguments=[TypeArgument(pattern_type=super, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=[], name=Consumer, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=AbstractSpliterator, sub_type=None)), member[.isParallel]]]]
end[}]
END[}] | annotation[@] identifier[Beta] Keyword[public] Keyword[static] operator[<] identifier[A] , identifier[B] , identifier[R] operator[>] identifier[Stream] operator[<] identifier[R] operator[>] identifier[zip] operator[SEP] identifier[Stream] operator[<] identifier[A] operator[>] identifier[streamA] , identifier[Stream] operator[<] identifier[B] operator[>] identifier[streamB] , identifier[BiFunction] operator[<] operator[?] Keyword[super] identifier[A] , operator[?] Keyword[super] identifier[B] , identifier[R] operator[>] identifier[function] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[streamA] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[streamB] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[function] operator[SEP] operator[SEP] Keyword[boolean] identifier[isParallel] operator[=] identifier[streamA] operator[SEP] identifier[isParallel] operator[SEP] operator[SEP] operator[||] identifier[streamB] operator[SEP] identifier[isParallel] operator[SEP] operator[SEP] operator[SEP] identifier[Spliterator] operator[<] identifier[A] operator[>] identifier[splitrA] operator[=] identifier[streamA] operator[SEP] identifier[spliterator] operator[SEP] operator[SEP] operator[SEP] identifier[Spliterator] operator[<] identifier[B] operator[>] identifier[splitrB] operator[=] identifier[streamB] operator[SEP] identifier[spliterator] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[characteristics] operator[=] identifier[splitrA] operator[SEP] identifier[characteristics] operator[SEP] operator[SEP] operator[&] identifier[splitrB] operator[SEP] identifier[characteristics] operator[SEP] operator[SEP] operator[&] operator[SEP] identifier[Spliterator] operator[SEP] identifier[SIZED] operator[|] identifier[Spliterator] operator[SEP] identifier[ORDERED] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[A] operator[>] identifier[itrA] operator[=] identifier[Spliterators] operator[SEP] identifier[iterator] operator[SEP] identifier[splitrA] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[B] operator[>] identifier[itrB] operator[=] identifier[Spliterators] operator[SEP] identifier[iterator] operator[SEP] identifier[splitrB] operator[SEP] operator[SEP] Keyword[return] identifier[StreamSupport] operator[SEP] identifier[stream] operator[SEP] Keyword[new] identifier[AbstractSpliterator] operator[<] identifier[R] operator[>] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[splitrA] operator[SEP] identifier[estimateSize] operator[SEP] operator[SEP] , identifier[splitrB] operator[SEP] identifier[estimateSize] operator[SEP] operator[SEP] operator[SEP] , identifier[characteristics] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[tryAdvance] operator[SEP] identifier[Consumer] operator[<] operator[?] Keyword[super] identifier[R] operator[>] identifier[action] operator[SEP] {
Keyword[if] operator[SEP] identifier[itrA] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[&&] identifier[itrB] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[action] operator[SEP] identifier[accept] operator[SEP] identifier[function] operator[SEP] identifier[apply] operator[SEP] identifier[itrA] operator[SEP] identifier[next] operator[SEP] operator[SEP] , identifier[itrB] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
} , identifier[isParallel] operator[SEP] operator[SEP] identifier[onClose] operator[SEP] identifier[streamA] operator[::] identifier[close] operator[SEP] operator[SEP] identifier[onClose] operator[SEP] identifier[streamB] operator[::] identifier[close] operator[SEP] operator[SEP]
}
|
public <T> Stream maxBy(String inputFieldName, Comparator<T> comparator) {
Aggregator<ComparisonAggregator.State> max = new MaxWithComparator<>(inputFieldName, comparator);
return comparableAggregateStream(inputFieldName, max);
} | class class_name[name] begin[{]
method[maxBy, return_type[type[Stream]], modifier[public], parameter[inputFieldName, comparator]] begin[{]
local_variable[type[Aggregator], max]
return[call[.comparableAggregateStream, parameter[member[.inputFieldName], member[.max]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[Stream] identifier[maxBy] operator[SEP] identifier[String] identifier[inputFieldName] , identifier[Comparator] operator[<] identifier[T] operator[>] identifier[comparator] operator[SEP] {
identifier[Aggregator] operator[<] identifier[ComparisonAggregator] operator[SEP] identifier[State] operator[>] identifier[max] operator[=] Keyword[new] identifier[MaxWithComparator] operator[<] operator[>] operator[SEP] identifier[inputFieldName] , identifier[comparator] operator[SEP] operator[SEP] Keyword[return] identifier[comparableAggregateStream] operator[SEP] identifier[inputFieldName] , identifier[max] operator[SEP] operator[SEP]
}
|
public static void setLogLevel(Level level) {
// all other ubench loggers inherit from here.
LOGGER.finer("Changing logging from " + LOGGER.getLevel());
LOGGER.setLevel(level);
if (!LOGGER.getUseParentHandlers()) {
LOGGER.setLevel(level);
Stream.of(LOGGER.getHandlers()).forEach(h -> h.setLevel(level));
}
LOGGER.finer("Changed logging to " + LOGGER.getLevel());
} | class class_name[name] begin[{]
method[setLogLevel, return_type[void], modifier[public static], parameter[level]] begin[{]
call[LOGGER.finer, parameter[binary_operation[literal["Changing logging from "], +, call[LOGGER.getLevel, parameter[]]]]]
call[LOGGER.setLevel, parameter[member[.level]]]
if[call[LOGGER.getUseParentHandlers, parameter[]]] begin[{]
call[LOGGER.setLevel, parameter[member[.level]]]
call[Stream.of, parameter[call[LOGGER.getHandlers, parameter[]]]]
else begin[{]
None
end[}]
call[LOGGER.finer, parameter[binary_operation[literal["Changed logging to "], +, call[LOGGER.getLevel, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setLogLevel] operator[SEP] identifier[Level] identifier[level] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[finer] operator[SEP] literal[String] operator[+] identifier[LOGGER] operator[SEP] identifier[getLevel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[setLevel] operator[SEP] identifier[level] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[LOGGER] operator[SEP] identifier[getUseParentHandlers] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[setLevel] operator[SEP] identifier[level] operator[SEP] operator[SEP] identifier[Stream] operator[SEP] identifier[of] operator[SEP] identifier[LOGGER] operator[SEP] identifier[getHandlers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[h] operator[->] identifier[h] operator[SEP] identifier[setLevel] operator[SEP] identifier[level] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[finer] operator[SEP] literal[String] operator[+] identifier[LOGGER] operator[SEP] identifier[getLevel] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void reset() {
this.rawPatterns.clear();
this.compiledPatterns.clear();
this.inlineFormat = DEFAULT_INLINE_FORMAT;
this.blockFormat = null;
this.outlineOutputTag = DEFAULT_OUTLINE_OUTPUT_TAG;
this.dynamicNameExtractionPattern = DEFAULT_TAG_NAME_PATTERN;
this.lineContinuation = DEFAULT_LINE_CONTINUATION;
} | class class_name[name] begin[{]
method[reset, return_type[void], modifier[public], parameter[]] begin[{]
THIS[member[None.rawPatterns]call[None.clear, parameter[]]]
THIS[member[None.compiledPatterns]call[None.clear, parameter[]]]
assign[THIS[member[None.inlineFormat]], member[.DEFAULT_INLINE_FORMAT]]
assign[THIS[member[None.blockFormat]], literal[null]]
assign[THIS[member[None.outlineOutputTag]], member[.DEFAULT_OUTLINE_OUTPUT_TAG]]
assign[THIS[member[None.dynamicNameExtractionPattern]], member[.DEFAULT_TAG_NAME_PATTERN]]
assign[THIS[member[None.lineContinuation]], member[.DEFAULT_LINE_CONTINUATION]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[reset] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[rawPatterns] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[compiledPatterns] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[inlineFormat] operator[=] identifier[DEFAULT_INLINE_FORMAT] operator[SEP] Keyword[this] operator[SEP] identifier[blockFormat] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[outlineOutputTag] operator[=] identifier[DEFAULT_OUTLINE_OUTPUT_TAG] operator[SEP] Keyword[this] operator[SEP] identifier[dynamicNameExtractionPattern] operator[=] identifier[DEFAULT_TAG_NAME_PATTERN] operator[SEP] Keyword[this] operator[SEP] identifier[lineContinuation] operator[=] identifier[DEFAULT_LINE_CONTINUATION] operator[SEP]
}
|
public static List<HostAddress> resolveXMPPServiceDomain(DnsName domain, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
return resolveDomain(domain, DomainType.client, failedAddresses, dnssecMode);
} | class class_name[name] begin[{]
method[resolveXMPPServiceDomain, return_type[type[List]], modifier[public static], parameter[domain, failedAddresses, dnssecMode]] begin[{]
return[call[.resolveDomain, parameter[member[.domain], member[DomainType.client], member[.failedAddresses], member[.dnssecMode]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[HostAddress] operator[>] identifier[resolveXMPPServiceDomain] operator[SEP] identifier[DnsName] identifier[domain] , identifier[List] operator[<] identifier[HostAddress] operator[>] identifier[failedAddresses] , identifier[DnssecMode] identifier[dnssecMode] operator[SEP] {
Keyword[return] identifier[resolveDomain] operator[SEP] identifier[domain] , identifier[DomainType] operator[SEP] identifier[client] , identifier[failedAddresses] , identifier[dnssecMode] operator[SEP] operator[SEP]
}
|
public void setProcessorFeatures(java.util.Collection<ProcessorFeature> processorFeatures) {
if (processorFeatures == null) {
this.processorFeatures = null;
return;
}
this.processorFeatures = new com.amazonaws.internal.SdkInternalList<ProcessorFeature>(processorFeatures);
} | class class_name[name] begin[{]
method[setProcessorFeatures, return_type[void], modifier[public], parameter[processorFeatures]] begin[{]
if[binary_operation[member[.processorFeatures], ==, literal[null]]] begin[{]
assign[THIS[member[None.processorFeatures]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.processorFeatures]], ClassCreator(arguments=[MemberReference(member=processorFeatures, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ProcessorFeature, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setProcessorFeatures] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[ProcessorFeature] operator[>] identifier[processorFeatures] operator[SEP] {
Keyword[if] operator[SEP] identifier[processorFeatures] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[processorFeatures] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[processorFeatures] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[ProcessorFeature] operator[>] operator[SEP] identifier[processorFeatures] operator[SEP] operator[SEP]
}
|
public ByteBuffer clearAllLocal(ByteBuffer context)
{
int count = Math.abs(context.getShort(context.position()));
if (count == 0)
return context; // no local or global shards present.
List<Short> globalShardIndexes = new ArrayList<>(count);
for (int i = 0; i < count; i++)
{
short elt = context.getShort(context.position() + HEADER_SIZE_LENGTH + i * HEADER_ELT_LENGTH);
if (elt < 0)
globalShardIndexes.add(elt);
}
if (count == globalShardIndexes.size())
return context; // no local shards detected.
// allocate a smaller BB for the cleared context - with no local header elts.
ByteBuffer cleared = ByteBuffer.allocate(context.remaining() - (count - globalShardIndexes.size()) * HEADER_ELT_LENGTH);
cleared.putShort(cleared.position(), (short) globalShardIndexes.size());
for (int i = 0; i < globalShardIndexes.size(); i++)
cleared.putShort(cleared.position() + HEADER_SIZE_LENGTH + i * HEADER_ELT_LENGTH, globalShardIndexes.get(i));
int origHeaderLength = headerLength(context);
ByteBufferUtil.arrayCopy(context,
context.position() + origHeaderLength,
cleared,
cleared.position() + headerLength(cleared),
context.remaining() - origHeaderLength);
return cleared;
} | class class_name[name] begin[{]
method[clearAllLocal, return_type[type[ByteBuffer]], modifier[public], parameter[context]] begin[{]
local_variable[type[int], count]
if[binary_operation[member[.count], ==, literal[0]]] begin[{]
return[member[.context]]
else begin[{]
None
end[}]
local_variable[type[List], globalShardIndexes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), operandr=MemberReference(member=HEADER_SIZE_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=HEADER_ELT_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+)], member=getShort, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), name=elt)], modifiers=set(), type=BasicType(dimensions=[], name=short)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=elt, 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=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=elt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=globalShardIndexes, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.count], ==, call[globalShardIndexes.size, parameter[]]]] begin[{]
return[member[.context]]
else begin[{]
None
end[}]
local_variable[type[ByteBuffer], cleared]
call[cleared.putShort, parameter[call[cleared.position, parameter[]], Cast(expression=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=globalShardIndexes, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=cleared, selectors=[], type_arguments=None), operandr=MemberReference(member=HEADER_SIZE_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=HEADER_ELT_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=globalShardIndexes, selectors=[], type_arguments=None)], member=putShort, postfix_operators=[], prefix_operators=[], qualifier=cleared, selectors=[], type_arguments=None), 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=globalShardIndexes, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[int], origHeaderLength]
call[ByteBufferUtil.arrayCopy, parameter[member[.context], binary_operation[call[context.position, parameter[]], +, member[.origHeaderLength]], member[.cleared], binary_operation[call[cleared.position, parameter[]], +, call[.headerLength, parameter[member[.cleared]]]], binary_operation[call[context.remaining, parameter[]], -, member[.origHeaderLength]]]]
return[member[.cleared]]
end[}]
END[}] | Keyword[public] identifier[ByteBuffer] identifier[clearAllLocal] operator[SEP] identifier[ByteBuffer] identifier[context] operator[SEP] {
Keyword[int] identifier[count] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[context] operator[SEP] identifier[getShort] operator[SEP] identifier[context] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] Other[0] operator[SEP] Keyword[return] identifier[context] operator[SEP] identifier[List] operator[<] identifier[Short] operator[>] identifier[globalShardIndexes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[count] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[short] identifier[elt] operator[=] identifier[context] operator[SEP] identifier[getShort] operator[SEP] identifier[context] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[HEADER_SIZE_LENGTH] operator[+] identifier[i] operator[*] identifier[HEADER_ELT_LENGTH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elt] operator[<] Other[0] operator[SEP] identifier[globalShardIndexes] operator[SEP] identifier[add] operator[SEP] identifier[elt] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[count] operator[==] identifier[globalShardIndexes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[context] operator[SEP] identifier[ByteBuffer] identifier[cleared] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] identifier[context] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[count] operator[-] identifier[globalShardIndexes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[*] identifier[HEADER_ELT_LENGTH] operator[SEP] operator[SEP] identifier[cleared] operator[SEP] identifier[putShort] operator[SEP] identifier[cleared] operator[SEP] identifier[position] operator[SEP] operator[SEP] , operator[SEP] Keyword[short] operator[SEP] identifier[globalShardIndexes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[globalShardIndexes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[cleared] operator[SEP] identifier[putShort] operator[SEP] identifier[cleared] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[HEADER_SIZE_LENGTH] operator[+] identifier[i] operator[*] identifier[HEADER_ELT_LENGTH] , identifier[globalShardIndexes] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[origHeaderLength] operator[=] identifier[headerLength] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[ByteBufferUtil] operator[SEP] identifier[arrayCopy] operator[SEP] identifier[context] , identifier[context] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[origHeaderLength] , identifier[cleared] , identifier[cleared] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[headerLength] operator[SEP] identifier[cleared] operator[SEP] , identifier[context] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[-] identifier[origHeaderLength] operator[SEP] operator[SEP] Keyword[return] identifier[cleared] operator[SEP]
}
|
private void applyOverviewDocumentExtension(Context context) {
extensionRegistry.getOverviewDocumentExtensions().forEach(extension -> extension.apply(context));
} | class class_name[name] begin[{]
method[applyOverviewDocumentExtension, return_type[void], modifier[private], parameter[context]] begin[{]
call[extensionRegistry.getOverviewDocumentExtensions, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[applyOverviewDocumentExtension] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
identifier[extensionRegistry] operator[SEP] identifier[getOverviewDocumentExtensions] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[extension] operator[->] identifier[extension] operator[SEP] identifier[apply] operator[SEP] identifier[context] operator[SEP] operator[SEP] operator[SEP]
}
|
public void register(Object value) {
if (JSONzip.probe) {
int integer = find(value);
if (integer >= 0) {
JSONzip.log("\nDuplicate key " + value);
}
}
if (this.length >= this.capacity) {
compact();
}
this.list[this.length] = value;
this.map.put(value, this.length);
this.ticks[this.length] = 1;
if (JSONzip.probe) {
JSONzip.log("<" + this.length + " " + value + "> ");
}
this.length += 1;
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[public], parameter[value]] begin[{]
if[member[JSONzip.probe]] begin[{]
local_variable[type[int], integer]
if[binary_operation[member[.integer], >=, literal[0]]] begin[{]
call[JSONzip.log, parameter[binary_operation[literal["\nDuplicate key "], +, member[.value]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.length]], >=, THIS[member[None.capacity]]]] begin[{]
call[.compact, parameter[]]
else begin[{]
None
end[}]
assign[THIS[member[None.list]ArraySelector(index=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]))], member[.value]]
THIS[member[None.map]call[None.put, parameter[member[.value], THIS[member[None.length]]]]]
assign[THIS[member[None.ticks]ArraySelector(index=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]))], literal[1]]
if[member[JSONzip.probe]] begin[{]
call[JSONzip.log, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["<"], +, THIS[member[None.length]]], +, literal[" "]], +, member[.value]], +, literal["> "]]]]
else begin[{]
None
end[}]
assign[THIS[member[None.length]], literal[1]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[register] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[JSONzip] operator[SEP] identifier[probe] operator[SEP] {
Keyword[int] identifier[integer] operator[=] identifier[find] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[integer] operator[>=] Other[0] operator[SEP] {
identifier[JSONzip] operator[SEP] identifier[log] operator[SEP] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[length] operator[>=] Keyword[this] operator[SEP] identifier[capacity] operator[SEP] {
identifier[compact] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[list] operator[SEP] Keyword[this] operator[SEP] identifier[length] operator[SEP] operator[=] identifier[value] operator[SEP] Keyword[this] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[value] , Keyword[this] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[ticks] operator[SEP] Keyword[this] operator[SEP] identifier[length] operator[SEP] operator[=] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[JSONzip] operator[SEP] identifier[probe] operator[SEP] {
identifier[JSONzip] operator[SEP] identifier[log] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[length] operator[+] literal[String] operator[+] identifier[value] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[length] operator[+=] Other[1] operator[SEP]
}
|
public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) throws SQLException {
try {
setParameter(parameterIndex, new ReaderParameter(reader, length));
} catch (IOException e) {
throw SQLExceptionMapper.getSQLException("Could not read stream: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[setCharacterStream, return_type[void], modifier[public], parameter[parameterIndex, reader, length]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameterIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, 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=ReaderParameter, sub_type=None))], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not read stream: "), 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=[])], member=getSQLException, postfix_operators=[], prefix_operators=[], qualifier=SQLExceptionMapper, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCharacterStream] operator[SEP] Keyword[final] Keyword[int] identifier[parameterIndex] , Keyword[final] identifier[Reader] identifier[reader] , Keyword[final] Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[try] {
identifier[setParameter] operator[SEP] identifier[parameterIndex] , Keyword[new] identifier[ReaderParameter] operator[SEP] identifier[reader] , identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] identifier[SQLExceptionMapper] operator[SEP] identifier[getSQLException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected final void setKetamaNodes(List<MemcachedNode> nodes) {
TreeMap<Long, MemcachedNode> newNodeMap = new TreeMap<Long, MemcachedNode>();
final int numReps = config.getNodeRepetitions();
for (MemcachedNode node : nodes) {
// Ketama does some special work with md5 where it reuses chunks.
if (hashingAlgorithm == DefaultHashAlgorithm.KETAMA_HASH) {
for (int i = 0; i < numReps / 4; i++) {
final String hashString = config.getKeyForNode(node, i);
byte[] digest = DefaultHashAlgorithm.computeMd5(hashString);
if (log.isDebugEnabled()) log.debug("digest : " + digest);
for (int h = 0; h < 4; h++) {
long k = ((long) (digest[3 + h * 4] & 0xFF) << 24)
| ((long) (digest[2 + h * 4] & 0xFF) << 16)
| ((long) (digest[1 + h * 4] & 0xFF) << 8)
| (digest[h * 4] & 0xFF);
newNodeMap.put(Long.valueOf(k), node);
if (log.isDebugEnabled()) log.debug("Key : " + hashString + " ; hash : " + k + "; node " + node );
}
}
} else {
for (int i = 0; i < numReps; i++) {
final Long hashL = Long.valueOf(hashingAlgorithm.hash(config.getKeyForNode(node, i)));
newNodeMap.put(hashL, node);
}
}
}
if (log.isDebugEnabled()) log.debug("NewNodeMapSize : " + newNodeMap.size() + "; MapSize : " + (numReps * nodes.size()));
if (log.isTraceEnabled()) {
for (Long key : newNodeMap.keySet()) {
log.trace("Hash : " + key + "; Node : " + newNodeMap.get(key));
}
}
ketamaNodes = newNodeMap;
} | class class_name[name] begin[{]
method[setKetamaNodes, return_type[void], modifier[final protected], parameter[nodes]] begin[{]
local_variable[type[TreeMap], newNodeMap]
local_variable[type[int], numReps]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hashingAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=KETAMA_HASH, postfix_operators=[], prefix_operators=[], qualifier=DefaultHashAlgorithm, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getKeyForNode, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None)], member=hash, postfix_operators=[], prefix_operators=[], qualifier=hashingAlgorithm, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), name=hashL)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hashL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=newNodeMap, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numReps, 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)]), label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getKeyForNode, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), name=hashString)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=hashString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeMd5, postfix_operators=[], prefix_operators=[], qualifier=DefaultHashAlgorithm, selectors=[], type_arguments=None), name=digest)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="digest : "), operandr=MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Cast(expression=BinaryOperation(operandl=MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operandr=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=*), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=long)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=<<), operandr=BinaryOperation(operandl=Cast(expression=BinaryOperation(operandl=MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=*), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=long)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=<<), operator=|), operandr=BinaryOperation(operandl=Cast(expression=BinaryOperation(operandl=MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=*), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=long)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<), operator=|), operandr=BinaryOperation(operandl=MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=*))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), operator=|), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=long)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=newNodeMap, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Key : "), operandr=MemberReference(member=hashString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ; hash : "), operator=+), operandr=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; node "), operator=+), operandr=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=h)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=h, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=numReps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=/), 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=nodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MemcachedNode, sub_type=None))), label=None)
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[binary_operation[binary_operation[binary_operation[literal["NewNodeMapSize : "], +, call[newNodeMap.size, parameter[]]], +, literal["; MapSize : "]], +, binary_operation[member[.numReps], *, call[nodes.size, parameter[]]]]]]
else begin[{]
None
end[}]
if[call[log.isTraceEnabled, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Hash : "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; Node : "), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=newNodeMap, selectors=[], type_arguments=None), operator=+)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=newNodeMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))), label=None)
else begin[{]
None
end[}]
assign[member[.ketamaNodes], member[.newNodeMap]]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[void] identifier[setKetamaNodes] operator[SEP] identifier[List] operator[<] identifier[MemcachedNode] operator[>] identifier[nodes] operator[SEP] {
identifier[TreeMap] operator[<] identifier[Long] , identifier[MemcachedNode] operator[>] identifier[newNodeMap] operator[=] Keyword[new] identifier[TreeMap] operator[<] identifier[Long] , identifier[MemcachedNode] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[numReps] operator[=] identifier[config] operator[SEP] identifier[getNodeRepetitions] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MemcachedNode] identifier[node] operator[:] identifier[nodes] operator[SEP] {
Keyword[if] operator[SEP] identifier[hashingAlgorithm] operator[==] identifier[DefaultHashAlgorithm] operator[SEP] identifier[KETAMA_HASH] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numReps] operator[/] Other[4] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[String] identifier[hashString] operator[=] identifier[config] operator[SEP] identifier[getKeyForNode] operator[SEP] identifier[node] , identifier[i] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[digest] operator[=] identifier[DefaultHashAlgorithm] operator[SEP] identifier[computeMd5] operator[SEP] identifier[hashString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[digest] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[h] operator[=] Other[0] operator[SEP] identifier[h] operator[<] Other[4] operator[SEP] identifier[h] operator[++] operator[SEP] {
Keyword[long] identifier[k] operator[=] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[digest] operator[SEP] Other[3] operator[+] identifier[h] operator[*] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[24] operator[SEP] operator[|] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[digest] operator[SEP] Other[2] operator[+] identifier[h] operator[*] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] operator[|] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[digest] operator[SEP] Other[1] operator[+] identifier[h] operator[*] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[|] operator[SEP] identifier[digest] operator[SEP] identifier[h] operator[*] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[newNodeMap] operator[SEP] identifier[put] operator[SEP] identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[k] operator[SEP] , identifier[node] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[hashString] operator[+] literal[String] operator[+] identifier[k] operator[+] literal[String] operator[+] identifier[node] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numReps] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[Long] identifier[hashL] operator[=] identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[hashingAlgorithm] operator[SEP] identifier[hash] operator[SEP] identifier[config] operator[SEP] identifier[getKeyForNode] operator[SEP] identifier[node] , identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[newNodeMap] operator[SEP] identifier[put] operator[SEP] identifier[hashL] , identifier[node] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[newNodeMap] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] operator[SEP] identifier[numReps] operator[*] identifier[nodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Long] identifier[key] operator[:] identifier[newNodeMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[newNodeMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[ketamaNodes] operator[=] identifier[newNodeMap] operator[SEP]
}
|
public Object getField(Object instance, String fieldname, boolean isStatic) throws IllegalAccessException {
FieldReaderWriter fieldReaderWriter = locateField(fieldname);
if (isStatic && !fieldReaderWriter.isStatic()) {
throw new IncompatibleClassChangeError("Expected static field "
+ fieldReaderWriter.theField.getDeclaringTypeName()
+ "." + fieldReaderWriter.theField.getName());
}
else if (!isStatic && fieldReaderWriter.isStatic()) {
throw new IncompatibleClassChangeError("Expected non-static field "
+ fieldReaderWriter.theField.getDeclaringTypeName()
+ "." + fieldReaderWriter.theField.getName());
}
Object o = null;
if (fieldReaderWriter.isStatic()) {
o = fieldReaderWriter.getStaticFieldValue(getClazz(), null);
}
else {
o = fieldReaderWriter.getValue(instance, null);
}
return o;
} | class class_name[name] begin[{]
method[getField, return_type[type[Object]], modifier[public], parameter[instance, fieldname, isStatic]] begin[{]
local_variable[type[FieldReaderWriter], fieldReaderWriter]
if[binary_operation[member[.isStatic], &&, call[fieldReaderWriter.isStatic, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected static field "), operandr=MethodInvocation(arguments=[], member=getDeclaringTypeName, postfix_operators=[], prefix_operators=[], qualifier=fieldReaderWriter.theField, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=fieldReaderWriter.theField, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IncompatibleClassChangeError, sub_type=None)), label=None)
else begin[{]
if[binary_operation[member[.isStatic], &&, call[fieldReaderWriter.isStatic, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected non-static field "), operandr=MethodInvocation(arguments=[], member=getDeclaringTypeName, postfix_operators=[], prefix_operators=[], qualifier=fieldReaderWriter.theField, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=fieldReaderWriter.theField, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IncompatibleClassChangeError, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
local_variable[type[Object], o]
if[call[fieldReaderWriter.isStatic, parameter[]]] begin[{]
assign[member[.o], call[fieldReaderWriter.getStaticFieldValue, parameter[call[.getClazz, parameter[]], literal[null]]]]
else begin[{]
assign[member[.o], call[fieldReaderWriter.getValue, parameter[member[.instance], literal[null]]]]
end[}]
return[member[.o]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[getField] operator[SEP] identifier[Object] identifier[instance] , identifier[String] identifier[fieldname] , Keyword[boolean] identifier[isStatic] operator[SEP] Keyword[throws] identifier[IllegalAccessException] {
identifier[FieldReaderWriter] identifier[fieldReaderWriter] operator[=] identifier[locateField] operator[SEP] identifier[fieldname] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isStatic] operator[&&] operator[!] identifier[fieldReaderWriter] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IncompatibleClassChangeError] operator[SEP] literal[String] operator[+] identifier[fieldReaderWriter] operator[SEP] identifier[theField] operator[SEP] identifier[getDeclaringTypeName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[fieldReaderWriter] operator[SEP] identifier[theField] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[isStatic] operator[&&] identifier[fieldReaderWriter] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IncompatibleClassChangeError] operator[SEP] literal[String] operator[+] identifier[fieldReaderWriter] operator[SEP] identifier[theField] operator[SEP] identifier[getDeclaringTypeName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[fieldReaderWriter] operator[SEP] identifier[theField] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] identifier[o] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[fieldReaderWriter] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] operator[SEP] {
identifier[o] operator[=] identifier[fieldReaderWriter] operator[SEP] identifier[getStaticFieldValue] operator[SEP] identifier[getClazz] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[o] operator[=] identifier[fieldReaderWriter] operator[SEP] identifier[getValue] operator[SEP] identifier[instance] , Other[null] operator[SEP] operator[SEP]
}
Keyword[return] identifier[o] operator[SEP]
}
|
@Override
public final void setItsId(final SeGoodsPriceId pItsId) {
this.itsId = pItsId;
if (this.itsId != null) {
this.priceCategory = this.itsId.getPriceCategory();
this.item = this.itsId.getItem();
} else {
this.priceCategory = null;
this.item = null;
}
} | class class_name[name] begin[{]
method[setItsId, return_type[void], modifier[final public], parameter[pItsId]] begin[{]
assign[THIS[member[None.itsId]], member[.pItsId]]
if[binary_operation[THIS[member[None.itsId]], !=, literal[null]]] begin[{]
assign[THIS[member[None.priceCategory]], THIS[member[None.itsId]call[None.getPriceCategory, parameter[]]]]
assign[THIS[member[None.item]], THIS[member[None.itsId]call[None.getItem, parameter[]]]]
else begin[{]
assign[THIS[member[None.priceCategory]], literal[null]]
assign[THIS[member[None.item]], literal[null]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setItsId] operator[SEP] Keyword[final] identifier[SeGoodsPriceId] identifier[pItsId] operator[SEP] {
Keyword[this] operator[SEP] identifier[itsId] operator[=] identifier[pItsId] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[itsId] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[priceCategory] operator[=] Keyword[this] operator[SEP] identifier[itsId] operator[SEP] identifier[getPriceCategory] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[item] operator[=] Keyword[this] operator[SEP] identifier[itsId] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[priceCategory] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[item] operator[=] Other[null] operator[SEP]
}
}
|
public static ApruveResponse<SubscriptionAdjustmentDeleteResponse> delete(
String subscriptionId, String adjustmentId) {
return ApruveClient.getInstance().delete(
getSubscriptionAdjustmentsPath(subscriptionId) + adjustmentId,
SubscriptionAdjustmentDeleteResponse.class);
} | class class_name[name] begin[{]
method[delete, return_type[type[ApruveResponse]], modifier[public static], parameter[subscriptionId, adjustmentId]] begin[{]
return[call[ApruveClient.getInstance, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ApruveResponse] operator[<] identifier[SubscriptionAdjustmentDeleteResponse] operator[>] identifier[delete] operator[SEP] identifier[String] identifier[subscriptionId] , identifier[String] identifier[adjustmentId] operator[SEP] {
Keyword[return] identifier[ApruveClient] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[delete] operator[SEP] identifier[getSubscriptionAdjustmentsPath] operator[SEP] identifier[subscriptionId] operator[SEP] operator[+] identifier[adjustmentId] , identifier[SubscriptionAdjustmentDeleteResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public final Object convertValue(Object value, IType intrType)
{
//==================================================================================
// Null handling
//==================================================================================
if( intrType == null )
{
return null;
}
//## todo: This is a horrible hack
//## todo: The only known case where this is necessary is when we have an array of parameterized java type e.g., List<String>[]
intrType = getBoundingTypeOfTypeVariable( intrType );
if( value == null )
{
return intrType.isPrimitive() ? convertNullAsPrimitive( intrType, true ) : null;
}
IType runtimeType = TypeSystem.getFromObject( value );
//==================================================================================
// IPlaceholder type handling
//==================================================================================
if( (intrType instanceof IPlaceholder && ((IPlaceholder)intrType).isPlaceholder()) ||
(runtimeType instanceof IPlaceholder && ((IPlaceholder)runtimeType).isPlaceholder()) )
{
return value;
}
//==================================================================================
// Runtime polymorphism (with java array semantics)
//==================================================================================
if( intrType == runtimeType )
{
return value;
}
if( intrType.equals( runtimeType ) )
{
return value;
}
if( intrType.isAssignableFrom( runtimeType ) )
{
value = extractObjectArray( intrType, value );
return value;
}
if( intrType.isArray() && runtimeType.isArray() )
{
if( intrType.getComponentType().isAssignableFrom( runtimeType.getComponentType() ) )
{
value = extractObjectArray( intrType, value );
return value;
}
else if( intrType instanceof IGosuArrayClass &&
value instanceof IGosuObject[] )
{
return value;
}
}
// Proxy coercion. The proxy class generated for Java classes is not a super type of the Gosu class.
// The following check allows coercion of the Gosu class to the Gosu proxy class needed for the super call.
if( intrType instanceof IJavaType &&
IGosuClass.ProxyUtil.isProxy( intrType ) &&
runtimeType instanceof IGosuClass &&
intrType.getSupertype() != null &&
intrType.getSupertype().isAssignableFrom( runtimeType ) )
{
return value;
}
// Check Java world types
//noinspection deprecation,unchecked
if( intrType instanceof IJavaType &&
((IJavaType)intrType).getIntrinsicClass().isAssignableFrom( value.getClass() ) )
{
return value;
}
// casts to structs are dynamic, pass value through unchanged
if( intrType instanceof IGosuClass && ((IGosuClass)intrType).isStructure() )
{
return value;
}
//==================================================================================
// Coercion
//==================================================================================
Object convertedValue = coerce( intrType, runtimeType, value );
if( convertedValue != null )
{
return convertedValue;
}
else
{
//If the null arose from an actual coercion, return it
if( canCoerce( intrType, runtimeType ) )
{
return convertedValue;
}
else
{
//otherwise, return the value itself uncoerced (See comment above)
if( !runtimeType.isArray() )
{
return NO_DICE;
}
return value;
}
}
} | class class_name[name] begin[{]
method[convertValue, return_type[type[Object]], modifier[final public], parameter[value, intrType]] begin[{]
if[binary_operation[member[.intrType], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
assign[member[.intrType], call[.getBoundingTypeOfTypeVariable, parameter[member[.intrType]]]]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isPrimitive, postfix_operators=[], prefix_operators=[], qualifier=intrType, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[MemberReference(member=intrType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=convertNullAsPrimitive, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
else begin[{]
None
end[}]
local_variable[type[IType], runtimeType]
if[binary_operation[binary_operation[binary_operation[member[.intrType], instanceof, type[IPlaceholder]], &&, Cast(expression=MemberReference(member=intrType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IPlaceholder, sub_type=None))], ||, binary_operation[binary_operation[member[.runtimeType], instanceof, type[IPlaceholder]], &&, Cast(expression=MemberReference(member=runtimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IPlaceholder, sub_type=None))]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
if[binary_operation[member[.intrType], ==, member[.runtimeType]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
if[call[intrType.equals, parameter[member[.runtimeType]]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
if[call[intrType.isAssignableFrom, parameter[member[.runtimeType]]]] begin[{]
assign[member[.value], call[.extractObjectArray, parameter[member[.intrType], member[.value]]]]
return[member[.value]]
else begin[{]
None
end[}]
if[binary_operation[call[intrType.isArray, parameter[]], &&, call[runtimeType.isArray, parameter[]]]] begin[{]
if[call[intrType.getComponentType, parameter[]]] begin[{]
assign[member[.value], call[.extractObjectArray, parameter[member[.intrType], member[.value]]]]
return[member[.value]]
else begin[{]
if[binary_operation[binary_operation[member[.intrType], instanceof, type[IGosuArrayClass]], &&, binary_operation[member[.value], instanceof, type[IGosuObject]]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.intrType], instanceof, type[IJavaType]], &&, call[IGosuClass.ProxyUtil.isProxy, parameter[member[.intrType]]]], &&, binary_operation[member[.runtimeType], instanceof, type[IGosuClass]]], &&, binary_operation[call[intrType.getSupertype, parameter[]], !=, literal[null]]], &&, call[intrType.getSupertype, parameter[]]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.intrType], instanceof, type[IJavaType]], &&, Cast(expression=MemberReference(member=intrType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IJavaType, sub_type=None))]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.intrType], instanceof, type[IGosuClass]], &&, Cast(expression=MemberReference(member=intrType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IGosuClass, sub_type=None))]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
local_variable[type[Object], convertedValue]
if[binary_operation[member[.convertedValue], !=, literal[null]]] begin[{]
return[member[.convertedValue]]
else begin[{]
if[call[.canCoerce, parameter[member[.intrType], member[.runtimeType]]]] begin[{]
return[member[.convertedValue]]
else begin[{]
if[call[runtimeType.isArray, parameter[]]] begin[{]
return[member[.NO_DICE]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Object] identifier[convertValue] operator[SEP] identifier[Object] identifier[value] , identifier[IType] identifier[intrType] operator[SEP] {
Keyword[if] operator[SEP] identifier[intrType] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[intrType] operator[=] identifier[getBoundingTypeOfTypeVariable] operator[SEP] identifier[intrType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[intrType] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[?] identifier[convertNullAsPrimitive] operator[SEP] identifier[intrType] , literal[boolean] operator[SEP] operator[:] Other[null] operator[SEP]
}
identifier[IType] identifier[runtimeType] operator[=] identifier[TypeSystem] operator[SEP] identifier[getFromObject] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[intrType] Keyword[instanceof] identifier[IPlaceholder] operator[&&] operator[SEP] operator[SEP] identifier[IPlaceholder] operator[SEP] identifier[intrType] operator[SEP] operator[SEP] identifier[isPlaceholder] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[runtimeType] Keyword[instanceof] identifier[IPlaceholder] operator[&&] operator[SEP] operator[SEP] identifier[IPlaceholder] operator[SEP] identifier[runtimeType] operator[SEP] operator[SEP] identifier[isPlaceholder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] operator[==] identifier[runtimeType] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] operator[SEP] identifier[equals] operator[SEP] identifier[runtimeType] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[runtimeType] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[extractObjectArray] operator[SEP] identifier[intrType] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[&&] identifier[runtimeType] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[intrType] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[runtimeType] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[extractObjectArray] operator[SEP] identifier[intrType] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[intrType] Keyword[instanceof] identifier[IGosuArrayClass] operator[&&] identifier[value] Keyword[instanceof] identifier[IGosuObject] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[intrType] Keyword[instanceof] identifier[IJavaType] operator[&&] identifier[IGosuClass] operator[SEP] identifier[ProxyUtil] operator[SEP] identifier[isProxy] operator[SEP] identifier[intrType] operator[SEP] operator[&&] identifier[runtimeType] Keyword[instanceof] identifier[IGosuClass] operator[&&] identifier[intrType] operator[SEP] identifier[getSupertype] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[intrType] operator[SEP] identifier[getSupertype] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[runtimeType] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] Keyword[instanceof] identifier[IJavaType] operator[&&] operator[SEP] operator[SEP] identifier[IJavaType] operator[SEP] identifier[intrType] operator[SEP] operator[SEP] identifier[getIntrinsicClass] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[if] operator[SEP] identifier[intrType] Keyword[instanceof] identifier[IGosuClass] operator[&&] operator[SEP] operator[SEP] identifier[IGosuClass] operator[SEP] identifier[intrType] operator[SEP] operator[SEP] identifier[isStructure] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
identifier[Object] identifier[convertedValue] operator[=] identifier[coerce] operator[SEP] identifier[intrType] , identifier[runtimeType] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[convertedValue] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[convertedValue] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[canCoerce] operator[SEP] identifier[intrType] , identifier[runtimeType] operator[SEP] operator[SEP] {
Keyword[return] identifier[convertedValue] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[runtimeType] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[NO_DICE] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
}
}
|
public String addSelectParams(String seekSign, int iAreaDesc, boolean bAddOnlyMods, boolean bIncludeFileName, boolean bUseCurrentValues, Vector<BaseField> vParamList, boolean bForceUniqueKey, boolean bIncludeTempFields)
{
if (iAreaDesc == DBConstants.START_SELECT_KEY)
if (bAddOnlyMods)
if (bForceUniqueKey)
if (">=".equals(seekSign))
if (this.getRecord().getCounterField() != this.getField(0))
if (this.getKeyField(this.getKeyFields(bForceUniqueKey, false) - 1, bForceUniqueKey).getField(iAreaDesc).isModified())
return this.addGreaterThanParams(seekSign, iAreaDesc, bAddOnlyMods, bIncludeFileName, bUseCurrentValues, vParamList, bForceUniqueKey);
String strFilter = DBConstants.BLANK;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, bIncludeTempFields);
if (bAddOnlyMods)
iKeyFieldCount = this.lastModified(iAreaDesc, bForceUniqueKey) + 1;
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
BaseField pParamField = keyField.getField(iAreaDesc);
BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA);
if (">=".equals(seekSign))
if (pParamField.isNull())
break; // Can't say >=? if null.
if (strFilter.length() > 0)
strFilter += " AND ";
String strCompare = null;
strFilter += field.getFieldName(true, bIncludeFileName);
String strSign = seekSign;
if (bUseCurrentValues == false)
{
strCompare = "?";
strFilter += strSign + strCompare;
if (vParamList != null)
vParamList.add(pParamField);
}
else
strFilter += pParamField.getSQLFilter(strSign, strCompare, true);
}
return strFilter;
} | class class_name[name] begin[{]
method[addSelectParams, return_type[type[String]], modifier[public], parameter[seekSign, iAreaDesc, bAddOnlyMods, bIncludeFileName, bUseCurrentValues, vParamList, bForceUniqueKey, bIncludeTempFields]] begin[{]
if[binary_operation[member[.iAreaDesc], ==, member[DBConstants.START_SELECT_KEY]]] begin[{]
if[member[.bAddOnlyMods]] begin[{]
if[member[.bForceUniqueKey]] begin[{]
if[literal[">="]] begin[{]
if[binary_operation[THIS[call[None.getRecord, parameter[]]call[None.getCounterField, parameter[]]], !=, THIS[call[None.getField, parameter[literal[0]]]]]] begin[{]
if[THIS[call[None.getKeyField, parameter[binary_operation[THIS[call[None.getKeyFields, parameter[member[.bForceUniqueKey], literal[false]]]], -, literal[1]], member[.bForceUniqueKey]]]call[None.getField, parameter[member[.iAreaDesc]]]call[None.isModified, parameter[]]]] begin[{]
return[THIS[call[None.addGreaterThanParams, parameter[member[.seekSign], member[.iAreaDesc], member[.bAddOnlyMods], member[.bIncludeFileName], member[.bUseCurrentValues], member[.vParamList], member[.bForceUniqueKey]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[String], strFilter]
local_variable[type[int], iKeyFieldCount]
if[member[.bAddOnlyMods]] begin[{]
assign[member[.iKeyFieldCount], binary_operation[THIS[call[None.lastModified, parameter[member[.iAreaDesc], member[.bForceUniqueKey]]]], +, literal[1]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=iKeyFieldSeq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bForceUniqueKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getKeyField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=keyField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeyField, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=iAreaDesc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=keyField, selectors=[], type_arguments=None), name=pParamField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseField, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=FILE_KEY_AREA, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=keyField, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseField, sub_type=None)), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=seekSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=">="), else_statement=None, label=None, then_statement=IfStatement(condition=MethodInvocation(arguments=[], member=isNull, postfix_operators=[], prefix_operators=[], qualifier=pParamField, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None))), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strFilter, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" AND ")), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=strCompare)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=bIncludeFileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=seekSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=strSign)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bUseCurrentValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), operator===), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=strSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strCompare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getSQLFilter, postfix_operators=[], prefix_operators=[], qualifier=pParamField, selectors=[], type_arguments=None)), label=None), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=strCompare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="?")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=strSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=strCompare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=vParamList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pParamField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=vParamList, selectors=[], type_arguments=None), label=None))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=iKeyFieldSeq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=iKeyFieldCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=MAIN_KEY_FIELD, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[]), name=iKeyFieldSeq)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=iKeyFieldSeq, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.strFilter]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[addSelectParams] operator[SEP] identifier[String] identifier[seekSign] , Keyword[int] identifier[iAreaDesc] , Keyword[boolean] identifier[bAddOnlyMods] , Keyword[boolean] identifier[bIncludeFileName] , Keyword[boolean] identifier[bUseCurrentValues] , identifier[Vector] operator[<] identifier[BaseField] operator[>] identifier[vParamList] , Keyword[boolean] identifier[bForceUniqueKey] , Keyword[boolean] identifier[bIncludeTempFields] operator[SEP] {
Keyword[if] operator[SEP] identifier[iAreaDesc] operator[==] identifier[DBConstants] operator[SEP] identifier[START_SELECT_KEY] operator[SEP] Keyword[if] operator[SEP] identifier[bAddOnlyMods] operator[SEP] Keyword[if] operator[SEP] identifier[bForceUniqueKey] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[seekSign] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getCounterField] operator[SEP] operator[SEP] operator[!=] Keyword[this] operator[SEP] identifier[getField] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getKeyField] operator[SEP] Keyword[this] operator[SEP] identifier[getKeyFields] operator[SEP] identifier[bForceUniqueKey] , literal[boolean] operator[SEP] operator[-] Other[1] , identifier[bForceUniqueKey] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[iAreaDesc] operator[SEP] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[addGreaterThanParams] operator[SEP] identifier[seekSign] , identifier[iAreaDesc] , identifier[bAddOnlyMods] , identifier[bIncludeFileName] , identifier[bUseCurrentValues] , identifier[vParamList] , identifier[bForceUniqueKey] operator[SEP] operator[SEP] identifier[String] identifier[strFilter] operator[=] identifier[DBConstants] operator[SEP] identifier[BLANK] operator[SEP] Keyword[int] identifier[iKeyFieldCount] operator[=] Keyword[this] operator[SEP] identifier[getKeyFields] operator[SEP] identifier[bForceUniqueKey] , identifier[bIncludeTempFields] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bAddOnlyMods] operator[SEP] identifier[iKeyFieldCount] operator[=] Keyword[this] operator[SEP] identifier[lastModified] operator[SEP] identifier[iAreaDesc] , identifier[bForceUniqueKey] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[iKeyFieldSeq] operator[=] identifier[DBConstants] operator[SEP] identifier[MAIN_KEY_FIELD] operator[SEP] identifier[iKeyFieldSeq] operator[<] identifier[iKeyFieldCount] operator[SEP] identifier[iKeyFieldSeq] operator[++] operator[SEP] {
identifier[KeyField] identifier[keyField] operator[=] Keyword[this] operator[SEP] identifier[getKeyField] operator[SEP] identifier[iKeyFieldSeq] , identifier[bForceUniqueKey] operator[SEP] operator[SEP] identifier[BaseField] identifier[pParamField] operator[=] identifier[keyField] operator[SEP] identifier[getField] operator[SEP] identifier[iAreaDesc] operator[SEP] operator[SEP] identifier[BaseField] identifier[field] operator[=] identifier[keyField] operator[SEP] identifier[getField] operator[SEP] identifier[DBConstants] operator[SEP] identifier[FILE_KEY_AREA] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[seekSign] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pParamField] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[strFilter] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[strFilter] operator[+=] literal[String] operator[SEP] identifier[String] identifier[strCompare] operator[=] Other[null] operator[SEP] identifier[strFilter] operator[+=] identifier[field] operator[SEP] identifier[getFieldName] operator[SEP] literal[boolean] , identifier[bIncludeFileName] operator[SEP] operator[SEP] identifier[String] identifier[strSign] operator[=] identifier[seekSign] operator[SEP] Keyword[if] operator[SEP] identifier[bUseCurrentValues] operator[==] literal[boolean] operator[SEP] {
identifier[strCompare] operator[=] literal[String] operator[SEP] identifier[strFilter] operator[+=] identifier[strSign] operator[+] identifier[strCompare] operator[SEP] Keyword[if] operator[SEP] identifier[vParamList] operator[!=] Other[null] operator[SEP] identifier[vParamList] operator[SEP] identifier[add] operator[SEP] identifier[pParamField] operator[SEP] operator[SEP]
}
Keyword[else] identifier[strFilter] operator[+=] identifier[pParamField] operator[SEP] identifier[getSQLFilter] operator[SEP] identifier[strSign] , identifier[strCompare] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[strFilter] operator[SEP]
}
|
Observable<List<ChatConversationBase>> loadAllConversations() {
return Observable.create(emitter -> storeFactory.execute(new StoreTransaction<ChatStore>() {
@Override
protected void execute(ChatStore store) {
store.open();
List<ChatConversationBase> conversations = store.getAllConversations();
store.close();
emitter.onNext(conversations);
emitter.onCompleted();
}
}), Emitter.BackpressureMode.LATEST);
} | class class_name[name] begin[{]
method[loadAllConversations, return_type[type[Observable]], modifier[default], parameter[]] begin[{]
return[call[Observable.create, parameter[LambdaExpression(body=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=store, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAllConversations, postfix_operators=[], prefix_operators=[], qualifier=store, selectors=[], type_arguments=None), name=conversations)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ChatConversationBase, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=store, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conversations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onNext, postfix_operators=[], prefix_operators=[], qualifier=emitter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=onCompleted, postfix_operators=[], prefix_operators=[], qualifier=emitter, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'protected'}, name=execute, parameters=[FormalParameter(annotations=[], modifiers=set(), name=store, type=ReferenceType(arguments=None, dimensions=[], name=ChatStore, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ChatStore, sub_type=None))], dimensions=None, name=StoreTransaction, sub_type=None))], member=execute, postfix_operators=[], prefix_operators=[], qualifier=storeFactory, selectors=[], type_arguments=None), parameters=[MemberReference(member=emitter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), member[Emitter.BackpressureMode.LATEST]]]]
end[}]
END[}] | identifier[Observable] operator[<] identifier[List] operator[<] identifier[ChatConversationBase] operator[>] operator[>] identifier[loadAllConversations] operator[SEP] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[create] operator[SEP] identifier[emitter] operator[->] identifier[storeFactory] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[StoreTransaction] operator[<] identifier[ChatStore] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[execute] operator[SEP] identifier[ChatStore] identifier[store] operator[SEP] {
identifier[store] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ChatConversationBase] operator[>] identifier[conversations] operator[=] identifier[store] operator[SEP] identifier[getAllConversations] operator[SEP] operator[SEP] operator[SEP] identifier[store] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[emitter] operator[SEP] identifier[onNext] operator[SEP] identifier[conversations] operator[SEP] operator[SEP] identifier[emitter] operator[SEP] identifier[onCompleted] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] , identifier[Emitter] operator[SEP] identifier[BackpressureMode] operator[SEP] identifier[LATEST] operator[SEP] operator[SEP]
}
|
public Sequence setSequence(Integer sequence) {
Sequence prop = (sequence == null) ? null : new Sequence(sequence);
setSequence(prop);
return prop;
} | class class_name[name] begin[{]
method[setSequence, return_type[type[Sequence]], modifier[public], parameter[sequence]] begin[{]
local_variable[type[Sequence], prop]
call[.setSequence, parameter[member[.prop]]]
return[member[.prop]]
end[}]
END[}] | Keyword[public] identifier[Sequence] identifier[setSequence] operator[SEP] identifier[Integer] identifier[sequence] operator[SEP] {
identifier[Sequence] identifier[prop] operator[=] operator[SEP] identifier[sequence] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] Keyword[new] identifier[Sequence] operator[SEP] identifier[sequence] operator[SEP] operator[SEP] identifier[setSequence] operator[SEP] identifier[prop] operator[SEP] operator[SEP] Keyword[return] identifier[prop] operator[SEP]
}
|
public String addUserParamsToURL(String strURL)
{
strURL = Util.addURLParam(strURL, Constants.SYSTEM_NAME, this.getProperty(Constants.SYSTEM_NAME), false);
strURL = Util.addURLParam(strURL, Params.USER_ID, this.getProperty(Params.USER_ID));
if (this.getProperty(Params.AUTH_TOKEN) != null)
strURL = Util.addURLParam(strURL, Params.AUTH_TOKEN, this.getProperty(Params.AUTH_TOKEN));
return strURL;
} | class class_name[name] begin[{]
method[addUserParamsToURL, return_type[type[String]], modifier[public], parameter[strURL]] begin[{]
assign[member[.strURL], call[Util.addURLParam, parameter[member[.strURL], member[Constants.SYSTEM_NAME], THIS[call[None.getProperty, parameter[member[Constants.SYSTEM_NAME]]]], literal[false]]]]
assign[member[.strURL], call[Util.addURLParam, parameter[member[.strURL], member[Params.USER_ID], THIS[call[None.getProperty, parameter[member[Params.USER_ID]]]]]]]
if[binary_operation[THIS[call[None.getProperty, parameter[member[Params.AUTH_TOKEN]]]], !=, literal[null]]] begin[{]
assign[member[.strURL], call[Util.addURLParam, parameter[member[.strURL], member[Params.AUTH_TOKEN], THIS[call[None.getProperty, parameter[member[Params.AUTH_TOKEN]]]]]]]
else begin[{]
None
end[}]
return[member[.strURL]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[addUserParamsToURL] operator[SEP] identifier[String] identifier[strURL] operator[SEP] {
identifier[strURL] operator[=] identifier[Util] operator[SEP] identifier[addURLParam] operator[SEP] identifier[strURL] , identifier[Constants] operator[SEP] identifier[SYSTEM_NAME] , Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[Constants] operator[SEP] identifier[SYSTEM_NAME] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[strURL] operator[=] identifier[Util] operator[SEP] identifier[addURLParam] operator[SEP] identifier[strURL] , identifier[Params] operator[SEP] identifier[USER_ID] , Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[Params] operator[SEP] identifier[USER_ID] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[Params] operator[SEP] identifier[AUTH_TOKEN] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[strURL] operator[=] identifier[Util] operator[SEP] identifier[addURLParam] operator[SEP] identifier[strURL] , identifier[Params] operator[SEP] identifier[AUTH_TOKEN] , Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[Params] operator[SEP] identifier[AUTH_TOKEN] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[strURL] operator[SEP]
}
|
private byte[] getFileContents(File file) {
if (file.exists()) {
try {
return FileUtil.getFileContents(file);
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
} | class class_name[name] begin[{]
method[getFileContents, return_type[type[byte]], modifier[private], parameter[file]] begin[{]
if[call[file.exists, parameter[]]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFileContents, postfix_operators=[], prefix_operators=[], qualifier=FileUtil, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] Keyword[byte] operator[SEP] operator[SEP] identifier[getFileContents] operator[SEP] identifier[File] identifier[file] operator[SEP] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[FileUtil] operator[SEP] identifier[getFileContents] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public String getHrefResolved() {
if (Atom10Parser.isAbsoluteURI(href)) {
return href;
} else if (baseURI != null && categoriesElement != null) {
return Atom10Parser.resolveURI(baseURI, categoriesElement, href);
}
return null;
} | class class_name[name] begin[{]
method[getHrefResolved, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[call[Atom10Parser.isAbsoluteURI, parameter[member[.href]]]] begin[{]
return[member[.href]]
else begin[{]
if[binary_operation[binary_operation[member[.baseURI], !=, literal[null]], &&, binary_operation[member[.categoriesElement], !=, literal[null]]]] begin[{]
return[call[Atom10Parser.resolveURI, parameter[member[.baseURI], member[.categoriesElement], member[.href]]]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getHrefResolved] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Atom10Parser] operator[SEP] identifier[isAbsoluteURI] operator[SEP] identifier[href] operator[SEP] operator[SEP] {
Keyword[return] identifier[href] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[baseURI] operator[!=] Other[null] operator[&&] identifier[categoriesElement] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[Atom10Parser] operator[SEP] identifier[resolveURI] operator[SEP] identifier[baseURI] , identifier[categoriesElement] , identifier[href] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) {
return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body();
} | class class_name[name] begin[{]
method[getByVersion, return_type[type[JobStepInner]], modifier[public], parameter[resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName]] begin[{]
return[call[.getByVersionWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.serverName], member[.jobAgentName], member[.jobName], member[.jobVersion], member[.stepName]]]]
end[}]
END[}] | Keyword[public] identifier[JobStepInner] identifier[getByVersion] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[serverName] , identifier[String] identifier[jobAgentName] , identifier[String] identifier[jobName] , Keyword[int] identifier[jobVersion] , identifier[String] identifier[stepName] operator[SEP] {
Keyword[return] identifier[getByVersionWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[serverName] , identifier[jobAgentName] , identifier[jobName] , identifier[jobVersion] , identifier[stepName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public int nextNode()
{
if(m_foundLast)
return DTM.NULL;
int next;
m_lastFetched = next = (DTM.NULL == m_lastFetched)
? m_cdtm.getFirstChild(m_context)
: m_cdtm.getNextSibling(m_lastFetched);
// m_lastFetched = next;
if (DTM.NULL != next)
{
m_pos++;
return next;
}
else
{
m_foundLast = true;
return DTM.NULL;
}
} | class class_name[name] begin[{]
method[nextNode, return_type[type[int]], modifier[public], parameter[]] begin[{]
if[member[.m_foundLast]] begin[{]
return[member[DTM.NULL]]
else begin[{]
None
end[}]
local_variable[type[int], next]
assign[member[.m_lastFetched], assign[member[.next], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=NULL, postfix_operators=[], prefix_operators=[], qualifier=DTM, selectors=[]), operandr=MemberReference(member=m_lastFetched, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=m_lastFetched, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNextSibling, postfix_operators=[], prefix_operators=[], qualifier=m_cdtm, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=m_context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFirstChild, postfix_operators=[], prefix_operators=[], qualifier=m_cdtm, selectors=[], type_arguments=None))]]
if[binary_operation[member[DTM.NULL], !=, member[.next]]] begin[{]
member[.m_pos]
return[member[.next]]
else begin[{]
assign[member[.m_foundLast], literal[true]]
return[member[DTM.NULL]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[nextNode] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_foundLast] operator[SEP] Keyword[return] identifier[DTM] operator[SEP] identifier[NULL] operator[SEP] Keyword[int] identifier[next] operator[SEP] identifier[m_lastFetched] operator[=] identifier[next] operator[=] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] operator[==] identifier[m_lastFetched] operator[SEP] operator[?] identifier[m_cdtm] operator[SEP] identifier[getFirstChild] operator[SEP] identifier[m_context] operator[SEP] operator[:] identifier[m_cdtm] operator[SEP] identifier[getNextSibling] operator[SEP] identifier[m_lastFetched] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] operator[!=] identifier[next] operator[SEP] {
identifier[m_pos] operator[++] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
Keyword[else] {
identifier[m_foundLast] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[DTM] operator[SEP] identifier[NULL] operator[SEP]
}
}
|
public String getJobStatus(final String jobId, final String title) throws IOException, InterruptedException {
final AtomicReference<String> ar = new AtomicReference<String>();
IWorkbench wb = PlatformUI.getWorkbench();
IProgressService ps = wb.getProgressService();
try {
ps.busyCursorWhile(new IRunnableWithProgress() {
public void run(IProgressMonitor pm) throws InterruptedException {
pm.beginTask("Waiting for Job "+jobId+":\n\n"+title, STATUS_REQUEST_TIMEOUT);
pm.subTask(title);
long startTime = System.currentTimeMillis();
long stopTime = startTime;
do {
try {
// send a Job Status request every STATUS_REQUEST_DELAY milliseconds
Thread.sleep(STATUS_REQUEST_DELAY);
String response = httpGet("jobs/" + jobId);
JsonObject jo = JsonObject.readFrom(response);
String status = jo.get("status").asString();
String result = jo.get("result").asString();
if ("null".equals(result)) {
if (!"SUCCESS".equals(status))
result = null;
}
if (status!=null && result!=null)
ar.set(status + ":" + result);
stopTime = System.currentTimeMillis();
pm.worked(STATUS_REQUEST_DELAY);
Activator.println("status="+status);
Activator.println("result="+result);
}
catch (Exception e) {
e.printStackTrace();
}
if (pm.isCanceled())
throw new InterruptedException("Operation canceled");
}
while (ar.get()==null && stopTime - startTime < STATUS_REQUEST_TIMEOUT);
pm.done();
Activator.println(
"\n----------------------------------\n"+
"Job "+jobId+"\n"+title+"\ncompleted in "+(stopTime - startTime) / 1000.0+" sec\n"+
"Status: " + ar.get()+
"\n----------------------------------\n");
}
});
}
catch (InvocationTargetException e) {
e.printStackTrace();
return null;
}
return ar.get();
} | class class_name[name] begin[{]
method[getJobStatus, return_type[type[String]], modifier[public], parameter[jobId, title]] begin[{]
local_variable[type[AtomicReference], ar]
local_variable[type[IWorkbench], wb]
local_variable[type[IProgressService], ps]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Waiting for Job "), operandr=MemberReference(member=jobId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":\n\n"), operator=+), operandr=MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=STATUS_REQUEST_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=beginTask, postfix_operators=[], prefix_operators=[], qualifier=pm, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=subTask, postfix_operators=[], prefix_operators=[], qualifier=pm, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=startTime)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=startTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=stopTime)], modifiers=set(), type=BasicType(dimensions=[], name=long)), DoStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STATUS_REQUEST_DELAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jobs/"), operandr=MemberReference(member=jobId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=httpGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFrom, postfix_operators=[], prefix_operators=[], qualifier=JsonObject, selectors=[], type_arguments=None), name=jo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status")], member=get, postfix_operators=[], prefix_operators=[], qualifier=jo, selectors=[MethodInvocation(arguments=[], member=asString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=status)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="result")], member=get, postfix_operators=[], prefix_operators=[], qualifier=jo, selectors=[MethodInvocation(arguments=[], member=asString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="null"), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="SUCCESS"), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None))])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=set, postfix_operators=[], prefix_operators=[], qualifier=ar, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stopTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STATUS_REQUEST_DELAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=worked, postfix_operators=[], prefix_operators=[], qualifier=pm, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status="), operandr=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=Activator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="result="), operandr=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=Activator, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), IfStatement(condition=MethodInvocation(arguments=[], member=isCanceled, postfix_operators=[], prefix_operators=[], qualifier=pm, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Operation canceled")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InterruptedException, sub_type=None)), label=None))]), condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ar, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=stopTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=STATUS_REQUEST_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=done, postfix_operators=[], prefix_operators=[], qualifier=pm, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n----------------------------------\n"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Job "), operator=+), operandr=MemberReference(member=jobId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n"), operator=+), operandr=MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\ncompleted in "), operator=+), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=stopTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000.0), operator=/), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" sec\n"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Status: "), operator=+), operandr=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ar, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n----------------------------------\n"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=Activator, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[FormalParameter(annotations=[], modifiers=set(), name=pm, type=ReferenceType(arguments=None, dimensions=[], name=IProgressMonitor, sub_type=None), varargs=False)], return_type=None, throws=['InterruptedException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IRunnableWithProgress, sub_type=None))], member=busyCursorWhile, postfix_operators=[], prefix_operators=[], qualifier=ps, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException']))], finally_block=None, label=None, resources=None)
return[call[ar.get, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getJobStatus] operator[SEP] Keyword[final] identifier[String] identifier[jobId] , Keyword[final] identifier[String] identifier[title] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
Keyword[final] identifier[AtomicReference] operator[<] identifier[String] operator[>] identifier[ar] operator[=] Keyword[new] identifier[AtomicReference] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[IWorkbench] identifier[wb] operator[=] identifier[PlatformUI] operator[SEP] identifier[getWorkbench] operator[SEP] operator[SEP] operator[SEP] identifier[IProgressService] identifier[ps] operator[=] identifier[wb] operator[SEP] identifier[getProgressService] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[ps] operator[SEP] identifier[busyCursorWhile] operator[SEP] Keyword[new] identifier[IRunnableWithProgress] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[run] operator[SEP] identifier[IProgressMonitor] identifier[pm] operator[SEP] Keyword[throws] identifier[InterruptedException] {
identifier[pm] operator[SEP] identifier[beginTask] operator[SEP] literal[String] operator[+] identifier[jobId] operator[+] literal[String] operator[+] identifier[title] , identifier[STATUS_REQUEST_TIMEOUT] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[subTask] operator[SEP] identifier[title] operator[SEP] operator[SEP] Keyword[long] identifier[startTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[stopTime] operator[=] identifier[startTime] operator[SEP] Keyword[do] {
Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[STATUS_REQUEST_DELAY] operator[SEP] operator[SEP] identifier[String] identifier[response] operator[=] identifier[httpGet] operator[SEP] literal[String] operator[+] identifier[jobId] operator[SEP] operator[SEP] identifier[JsonObject] identifier[jo] operator[=] identifier[JsonObject] operator[SEP] identifier[readFrom] operator[SEP] identifier[response] operator[SEP] operator[SEP] identifier[String] identifier[status] operator[=] identifier[jo] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[result] operator[=] identifier[jo] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[result] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[status] operator[SEP] operator[SEP] identifier[result] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[status] operator[!=] Other[null] operator[&&] identifier[result] operator[!=] Other[null] operator[SEP] identifier[ar] operator[SEP] identifier[set] operator[SEP] identifier[status] operator[+] literal[String] operator[+] identifier[result] operator[SEP] operator[SEP] identifier[stopTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[worked] operator[SEP] identifier[STATUS_REQUEST_DELAY] operator[SEP] operator[SEP] identifier[Activator] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[status] operator[SEP] operator[SEP] identifier[Activator] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pm] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InterruptedException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[ar] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[null] operator[&&] identifier[stopTime] operator[-] identifier[startTime] operator[<] identifier[STATUS_REQUEST_TIMEOUT] operator[SEP] operator[SEP] identifier[pm] operator[SEP] identifier[done] operator[SEP] operator[SEP] operator[SEP] identifier[Activator] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[jobId] operator[+] literal[String] operator[+] identifier[title] operator[+] literal[String] operator[+] operator[SEP] identifier[stopTime] operator[-] identifier[startTime] operator[SEP] operator[/] literal[Float] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[ar] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[ar] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Iterator<EncodedPair> iterate(List<Param> params, Charset charset, boolean encodeIfNeeded){
return new ProcessIterator(params, charset, encodeIfNeeded);
} | class class_name[name] begin[{]
method[iterate, return_type[type[Iterator]], modifier[public static], parameter[params, charset, encodeIfNeeded]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=encodeIfNeeded, 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=ProcessIterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Iterator] operator[<] identifier[EncodedPair] operator[>] identifier[iterate] operator[SEP] identifier[List] operator[<] identifier[Param] operator[>] identifier[params] , identifier[Charset] identifier[charset] , Keyword[boolean] identifier[encodeIfNeeded] operator[SEP] {
Keyword[return] Keyword[new] identifier[ProcessIterator] operator[SEP] identifier[params] , identifier[charset] , identifier[encodeIfNeeded] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
public static <ReqT, RespT> Builder<ReqT, RespT> newBuilder(
Marshaller<ReqT> requestMarshaller, Marshaller<RespT> responseMarshaller) {
return new Builder<ReqT, RespT>()
.setRequestMarshaller(requestMarshaller)
.setResponseMarshaller(responseMarshaller);
} | class class_name[name] begin[{]
method[newBuilder, return_type[type[Builder]], modifier[public static], parameter[requestMarshaller, responseMarshaller]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=requestMarshaller, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRequestMarshaller, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=responseMarshaller, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setResponseMarshaller, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ReqT, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RespT, sub_type=None))], dimensions=None, name=Builder, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] Keyword[public] Keyword[static] operator[<] identifier[ReqT] , identifier[RespT] operator[>] identifier[Builder] operator[<] identifier[ReqT] , identifier[RespT] operator[>] identifier[newBuilder] operator[SEP] identifier[Marshaller] operator[<] identifier[ReqT] operator[>] identifier[requestMarshaller] , identifier[Marshaller] operator[<] identifier[RespT] operator[>] identifier[responseMarshaller] operator[SEP] {
Keyword[return] Keyword[new] identifier[Builder] operator[<] identifier[ReqT] , identifier[RespT] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[setRequestMarshaller] operator[SEP] identifier[requestMarshaller] operator[SEP] operator[SEP] identifier[setResponseMarshaller] operator[SEP] identifier[responseMarshaller] operator[SEP] operator[SEP]
}
|
public static String between(String text, String after, String before) {
text = after(text, after);
if (text == null) {
return null;
}
return before(text, before);
} | class class_name[name] begin[{]
method[between, return_type[type[String]], modifier[public static], parameter[text, after, before]] begin[{]
assign[member[.text], call[.after, parameter[member[.text], member[.after]]]]
if[binary_operation[member[.text], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.before, parameter[member[.text], member[.before]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[between] operator[SEP] identifier[String] identifier[text] , identifier[String] identifier[after] , identifier[String] identifier[before] operator[SEP] {
identifier[text] operator[=] identifier[after] operator[SEP] identifier[text] , identifier[after] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[text] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[before] operator[SEP] identifier[text] , identifier[before] operator[SEP] operator[SEP]
}
|
public VectorApproximation calculateApproximation(DBID id, V dv) {
int[] approximation = new int[dv.getDimensionality()];
for(int d = 0; d < splitPositions.length; d++) {
final double val = dv.doubleValue(d);
final int lastBorderIndex = splitPositions[d].length - 1;
// Value is below data grid
if(val < splitPositions[d][0]) {
approximation[d] = 0;
if(id != null) {
LOG.warning("Vector outside of VAFile grid!");
}
} // Value is above data grid
else if(val > splitPositions[d][lastBorderIndex]) {
approximation[d] = lastBorderIndex - 1;
if(id != null) {
LOG.warning("Vector outside of VAFile grid!");
}
} // normal case
else {
// Search grid position
int pos = Arrays.binarySearch(splitPositions[d], val);
pos = (pos >= 0) ? pos : ((-pos) - 2);
approximation[d] = pos;
}
}
return new VectorApproximation(id, approximation);
} | class class_name[name] begin[{]
method[calculateApproximation, return_type[type[VectorApproximation]], modifier[public], parameter[id, dv]] begin[{]
local_variable[type[int], approximation]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doubleValue, postfix_operators=[], prefix_operators=[], qualifier=dv, selectors=[], type_arguments=None), name=val)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=splitPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=lastBorderIndex)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=splitPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=<), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=splitPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=lastBorderIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=>), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=splitPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=binarySearch, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), name=pos)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), if_false=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-), if_true=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=approximation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=approximation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=lastBorderIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=id, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Vector outside of VAFile grid!")], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=approximation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=id, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Vector outside of VAFile grid!")], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=splitPositions, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=d, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=approximation, 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=VectorApproximation, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[VectorApproximation] identifier[calculateApproximation] operator[SEP] identifier[DBID] identifier[id] , identifier[V] identifier[dv] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[approximation] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[dv] operator[SEP] identifier[getDimensionality] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[d] operator[=] Other[0] operator[SEP] identifier[d] operator[<] identifier[splitPositions] operator[SEP] identifier[length] operator[SEP] identifier[d] operator[++] operator[SEP] {
Keyword[final] Keyword[double] identifier[val] operator[=] identifier[dv] operator[SEP] identifier[doubleValue] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[lastBorderIndex] operator[=] identifier[splitPositions] operator[SEP] identifier[d] operator[SEP] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[<] identifier[splitPositions] operator[SEP] identifier[d] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] {
identifier[approximation] operator[SEP] identifier[d] operator[SEP] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[id] operator[!=] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[val] operator[>] identifier[splitPositions] operator[SEP] identifier[d] operator[SEP] operator[SEP] identifier[lastBorderIndex] operator[SEP] operator[SEP] {
identifier[approximation] operator[SEP] identifier[d] operator[SEP] operator[=] identifier[lastBorderIndex] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[id] operator[!=] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[int] identifier[pos] operator[=] identifier[Arrays] operator[SEP] identifier[binarySearch] operator[SEP] identifier[splitPositions] operator[SEP] identifier[d] operator[SEP] , identifier[val] operator[SEP] operator[SEP] identifier[pos] operator[=] operator[SEP] identifier[pos] operator[>=] Other[0] operator[SEP] operator[?] identifier[pos] operator[:] operator[SEP] operator[SEP] operator[-] identifier[pos] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[approximation] operator[SEP] identifier[d] operator[SEP] operator[=] identifier[pos] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[VectorApproximation] operator[SEP] identifier[id] , identifier[approximation] operator[SEP] operator[SEP]
}
|
public <E extends Model> LazyList<E> load() {
if (hydrated()) { throw new DBException("load() must be the last on the chain of methods"); }
hydrate();
return (LazyList<E>) this;
} | class class_name[name] begin[{]
method[load, return_type[type[LazyList]], modifier[public], parameter[]] begin[{]
if[call[.hydrated, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="load() must be the last on the chain of methods")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DBException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.hydrate, parameter[]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=LazyList, sub_type=None))]
end[}]
END[}] | Keyword[public] operator[<] identifier[E] Keyword[extends] identifier[Model] operator[>] identifier[LazyList] operator[<] identifier[E] operator[>] identifier[load] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hydrated] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DBException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[hydrate] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[LazyList] operator[<] identifier[E] operator[>] operator[SEP] Keyword[this] operator[SEP]
}
|
@Override
protected void initViews(List<View> views) throws IOException {
BranchListView v = new BranchListView("All", this);
v.setIncludeRegex(".*");
views.add(v);
v.save();
} | class class_name[name] begin[{]
method[initViews, return_type[void], modifier[protected], parameter[views]] begin[{]
local_variable[type[BranchListView], v]
call[v.setIncludeRegex, parameter[literal[".*"]]]
call[views.add, parameter[member[.v]]]
call[v.save, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[initViews] operator[SEP] identifier[List] operator[<] identifier[View] operator[>] identifier[views] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[BranchListView] identifier[v] operator[=] Keyword[new] identifier[BranchListView] operator[SEP] literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setIncludeRegex] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[views] operator[SEP] identifier[add] operator[SEP] identifier[v] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[save] operator[SEP] operator[SEP] operator[SEP]
}
|
public NodeList convertToNodeset()
{
if (m_obj instanceof NodeList)
return (NodeList) m_obj;
else
return new org.apache.xml.dtm.ref.DTMNodeList(asNodeIterator());
} | class class_name[name] begin[{]
method[convertToNodeset, return_type[type[NodeList]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_obj], instanceof, type[NodeList]]] begin[{]
return[Cast(expression=MemberReference(member=m_obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=NodeList, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=asNodeIterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=apache, sub_type=ReferenceType(arguments=None, dimensions=None, name=xml, sub_type=ReferenceType(arguments=None, dimensions=None, name=dtm, sub_type=ReferenceType(arguments=None, dimensions=None, name=ref, sub_type=ReferenceType(arguments=None, dimensions=None, name=DTMNodeList, sub_type=None)))))))]
end[}]
end[}]
END[}] | Keyword[public] identifier[NodeList] identifier[convertToNodeset] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_obj] Keyword[instanceof] identifier[NodeList] operator[SEP] Keyword[return] operator[SEP] identifier[NodeList] operator[SEP] identifier[m_obj] operator[SEP] Keyword[else] Keyword[return] Keyword[new] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[xml] operator[SEP] identifier[dtm] operator[SEP] identifier[ref] operator[SEP] identifier[DTMNodeList] operator[SEP] identifier[asNodeIterator] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(CreateAccountRequest createAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (createAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAccountRequest.getEmail(), EMAIL_BINDING);
protocolMarshaller.marshall(createAccountRequest.getAccountName(), ACCOUNTNAME_BINDING);
protocolMarshaller.marshall(createAccountRequest.getRoleName(), ROLENAME_BINDING);
protocolMarshaller.marshall(createAccountRequest.getIamUserAccessToBilling(), IAMUSERACCESSTOBILLING_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[createAccountRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createAccountRequest], ==, 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=getEmail, postfix_operators=[], prefix_operators=[], qualifier=createAccountRequest, selectors=[], type_arguments=None), MemberReference(member=EMAIL_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=getAccountName, postfix_operators=[], prefix_operators=[], qualifier=createAccountRequest, selectors=[], type_arguments=None), MemberReference(member=ACCOUNTNAME_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=getRoleName, postfix_operators=[], prefix_operators=[], qualifier=createAccountRequest, selectors=[], type_arguments=None), MemberReference(member=ROLENAME_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=getIamUserAccessToBilling, postfix_operators=[], prefix_operators=[], qualifier=createAccountRequest, selectors=[], type_arguments=None), MemberReference(member=IAMUSERACCESSTOBILLING_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[CreateAccountRequest] identifier[createAccountRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createAccountRequest] 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[createAccountRequest] operator[SEP] identifier[getEmail] operator[SEP] operator[SEP] , identifier[EMAIL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createAccountRequest] operator[SEP] identifier[getAccountName] operator[SEP] operator[SEP] , identifier[ACCOUNTNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createAccountRequest] operator[SEP] identifier[getRoleName] operator[SEP] operator[SEP] , identifier[ROLENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createAccountRequest] operator[SEP] identifier[getIamUserAccessToBilling] operator[SEP] operator[SEP] , identifier[IAMUSERACCESSTOBILLING_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 synchronized void deleteSoonerOrLater(File fileToDelete) {
pendingDeletes.add(fileToDelete);
// if things are getting out of hand, force gc/finalization
if(pendingDeletes.size()>50) {
LOGGER.warning(">50 pending Files to delete; forcing gc/finalization");
System.gc();
System.runFinalization();
}
// try all pendingDeletes
Iterator<File> iter = pendingDeletes.listIterator();
while(iter.hasNext()) {
File pending = iter.next();
if(pending.delete()) {
iter.remove();
}
}
// if things are still out of hand, complain loudly
if(pendingDeletes.size()>50) {
LOGGER.severe(">50 pending Files to delete even after gc/finalization");
}
} | class class_name[name] begin[{]
method[deleteSoonerOrLater, return_type[void], modifier[synchronized public static], parameter[fileToDelete]] begin[{]
call[pendingDeletes.add, parameter[member[.fileToDelete]]]
if[binary_operation[call[pendingDeletes.size, parameter[]], >, literal[50]]] begin[{]
call[LOGGER.warning, parameter[literal[">50 pending Files to delete; forcing gc/finalization"]]]
call[System.gc, parameter[]]
call[System.runFinalization, parameter[]]
else begin[{]
None
end[}]
local_variable[type[Iterator], iter]
while[call[iter.hasNext, parameter[]]] begin[{]
local_variable[type[File], pending]
if[call[pending.delete, parameter[]]] begin[{]
call[iter.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[pendingDeletes.size, parameter[]], >, literal[50]]] begin[{]
call[LOGGER.severe, parameter[literal[">50 pending Files to delete even after gc/finalization"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] Keyword[void] identifier[deleteSoonerOrLater] operator[SEP] identifier[File] identifier[fileToDelete] operator[SEP] {
identifier[pendingDeletes] operator[SEP] identifier[add] operator[SEP] identifier[fileToDelete] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pendingDeletes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[50] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[gc] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[runFinalization] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Iterator] operator[<] identifier[File] operator[>] identifier[iter] operator[=] identifier[pendingDeletes] operator[SEP] identifier[listIterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[File] identifier[pending] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pending] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] {
identifier[iter] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[pendingDeletes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[50] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[severe] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
protected Label newItemLinkLabel(final String id, final LinkItem model)
{
final Label itemLinkLabel = ComponentFactory.newLabel(id,
ResourceModelFactory.newResourceModel(model.getResourceModelKey(), this));
// add css class to current page.
if ((model.getPageClass() != null) && model.getPageClass().equals(getPage().getClass()))
{
itemLinkLabel.add(new AttributeAppender("class", " " + getCurrentPageCssClass()));
}
return itemLinkLabel;
} | class class_name[name] begin[{]
method[newItemLinkLabel, return_type[type[Label]], modifier[protected], parameter[id, model]] begin[{]
local_variable[type[Label], itemLinkLabel]
if[binary_operation[binary_operation[call[model.getPageClass, parameter[]], !=, literal[null]], &&, call[model.getPageClass, parameter[]]]] begin[{]
call[itemLinkLabel.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="class"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operandr=MethodInvocation(arguments=[], member=getCurrentPageCssClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AttributeAppender, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.itemLinkLabel]]
end[}]
END[}] | Keyword[protected] identifier[Label] identifier[newItemLinkLabel] operator[SEP] Keyword[final] identifier[String] identifier[id] , Keyword[final] identifier[LinkItem] identifier[model] operator[SEP] {
Keyword[final] identifier[Label] identifier[itemLinkLabel] operator[=] identifier[ComponentFactory] operator[SEP] identifier[newLabel] operator[SEP] identifier[id] , identifier[ResourceModelFactory] operator[SEP] identifier[newResourceModel] operator[SEP] identifier[model] operator[SEP] identifier[getResourceModelKey] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[getPageClass] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[&&] identifier[model] operator[SEP] identifier[getPageClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[itemLinkLabel] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[AttributeAppender] operator[SEP] literal[String] , literal[String] operator[+] identifier[getCurrentPageCssClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[itemLinkLabel] operator[SEP]
}
|
CompletableFuture<Void> configure(Member.Type type) {
CompletableFuture<Void> future = new CompletableFuture<>();
cluster.getContext().getThreadContext().executor().execute(() -> configure(type, future));
return future;
} | class class_name[name] begin[{]
method[configure, return_type[type[CompletableFuture]], modifier[default], parameter[type]] begin[{]
local_variable[type[CompletableFuture], future]
call[cluster.getContext, parameter[]]
return[member[.future]]
end[}]
END[}] | identifier[CompletableFuture] operator[<] identifier[Void] operator[>] identifier[configure] operator[SEP] identifier[Member] operator[SEP] identifier[Type] identifier[type] operator[SEP] {
identifier[CompletableFuture] operator[<] identifier[Void] operator[>] identifier[future] operator[=] Keyword[new] identifier[CompletableFuture] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[cluster] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getThreadContext] operator[SEP] operator[SEP] operator[SEP] identifier[executor] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[configure] operator[SEP] identifier[type] , identifier[future] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[future] operator[SEP]
}
|
public void complete() {
m_completed = true;
// Prevent changing of the cached lists
if (m_headers != null) {
m_headers = Collections.unmodifiableMap(m_headers);
}
if (m_elements != null) {
m_elements = Collections.unmodifiableList(m_elements);
}
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEENTRY_ENTRY_COMPLETED_1, toString()));
}
} | class class_name[name] begin[{]
method[complete, return_type[void], modifier[public], parameter[]] begin[{]
assign[member[.m_completed], literal[true]]
if[binary_operation[member[.m_headers], !=, literal[null]]] begin[{]
assign[member[.m_headers], call[Collections.unmodifiableMap, parameter[member[.m_headers]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_elements], !=, literal[null]]] begin[{]
assign[member[.m_elements], call[Collections.unmodifiableList, parameter[member[.m_elements]]]]
else begin[{]
None
end[}]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[complete] operator[SEP] operator[SEP] {
identifier[m_completed] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[m_headers] operator[!=] Other[null] operator[SEP] {
identifier[m_headers] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[m_headers] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_elements] operator[!=] Other[null] operator[SEP] {
identifier[m_elements] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[m_elements] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_FLEXCACHEENTRY_ENTRY_COMPLETED_1] , identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public RandomVariable floor(double floor) {
return apply(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return Math.max(x, floor);
}
});
} | class class_name[name] begin[{]
method[floor, return_type[type[RandomVariable]], modifier[public], parameter[floor]] begin[{]
return[call[.apply, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=floor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=applyAsDouble, parameters=[FormalParameter(annotations=[], modifiers=set(), name=x, type=BasicType(dimensions=[], name=double), varargs=False)], return_type=BasicType(dimensions=[], name=double), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleUnaryOperator, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RandomVariable] identifier[floor] operator[SEP] Keyword[double] identifier[floor] operator[SEP] {
Keyword[return] identifier[apply] operator[SEP] Keyword[new] identifier[DoubleUnaryOperator] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[applyAsDouble] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[x] , identifier[floor] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected final OutputStream getHTMLOutputStream(WebSiteRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/html");
resp.setCharacterEncoding("UTF-8");
String[] headers=getAdditionalHeaders(req);
if(headers!=null) {
int len=headers.length;
for(int c=0; c<len; c+=2) resp.setHeader(headers[c], headers[c+1]);
}
return resp.getOutputStream();
} | class class_name[name] begin[{]
method[getHTMLOutputStream, return_type[type[OutputStream]], modifier[final protected], parameter[req, resp]] begin[{]
call[resp.setContentType, parameter[literal["text/html"]]]
call[resp.setCharacterEncoding, parameter[literal["UTF-8"]]]
local_variable[type[String], headers]
if[binary_operation[member[.headers], !=, literal[null]]] begin[{]
local_variable[type[int], len]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))])], member=setHeader, postfix_operators=[], prefix_operators=[], qualifier=resp, selectors=[], type_arguments=None), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), label=None)
else begin[{]
None
end[}]
return[call[resp.getOutputStream, parameter[]]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[OutputStream] identifier[getHTMLOutputStream] operator[SEP] identifier[WebSiteRequest] identifier[req] , identifier[HttpServletResponse] identifier[resp] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[resp] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[resp] operator[SEP] identifier[setCharacterEncoding] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[headers] operator[=] identifier[getAdditionalHeaders] operator[SEP] identifier[req] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[headers] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[headers] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[len] operator[SEP] identifier[c] operator[+=] Other[2] operator[SEP] identifier[resp] operator[SEP] identifier[setHeader] operator[SEP] identifier[headers] operator[SEP] identifier[c] operator[SEP] , identifier[headers] operator[SEP] identifier[c] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resp] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP]
}
|
private <T extends Number> Map < String, Object > getCobolAlphanumType(
List < XmlSchemaFacet > facets) {
Map < String, Object > props = new LinkedHashMap < String, Object >();
props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolStringType");
props.put(CHAR_NUM_PROP_NAME, getMaxLength(facets));
props.put(JAVA_TYPE_NAME_PROP_NAME, getShortTypeName(String.class));
return props;
} | class class_name[name] begin[{]
method[getCobolAlphanumType, return_type[type[Map]], modifier[private], parameter[facets]] begin[{]
local_variable[type[Map], props]
call[props.put, parameter[member[.COBOL_TYPE_NAME_PROP_NAME], literal["CobolStringType"]]]
call[props.put, parameter[member[.CHAR_NUM_PROP_NAME], call[.getMaxLength, parameter[member[.facets]]]]]
call[props.put, parameter[member[.JAVA_TYPE_NAME_PROP_NAME], call[.getShortTypeName, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]]
return[member[.props]]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] Keyword[extends] identifier[Number] operator[>] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getCobolAlphanumType] operator[SEP] identifier[List] operator[<] identifier[XmlSchemaFacet] operator[>] identifier[facets] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[props] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[COBOL_TYPE_NAME_PROP_NAME] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[CHAR_NUM_PROP_NAME] , identifier[getMaxLength] operator[SEP] identifier[facets] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[JAVA_TYPE_NAME_PROP_NAME] , identifier[getShortTypeName] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[props] operator[SEP]
}
|
public void clear() {
// The alternative is to iterate through the keys and call #remove(),
// which
// adds unnecessary contention on the eviction lock and buffers.
evictionLock.lock();
try {
Node node;
while ((node = evictionDeque.poll()) != null) {
data.remove(node.key, node);
node.makeDead();
}
// Drain the buffers and run only the write tasks
for (int i = 0; i < buffers.length; i++) {
Queue<Task> buffer = buffers[i];
int removed = 0;
Task task;
while ((task = buffer.poll()) != null) {
if (task.isWrite()) {
task.run();
}
removed++;
}
bufferLengths.addAndGet(i, -removed);
}
} finally {
evictionLock.unlock();
}
} | class class_name[name] begin[{]
method[clear, return_type[void], modifier[public], parameter[]] begin[{]
call[evictionLock.lock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=makeDead, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=evictionDeque, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=buffers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=buffer)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Task, sub_type=None))], dimensions=[], name=Queue, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=removed)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=task)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Task, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isWrite, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=run, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=removed, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=removed, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=addAndGet, postfix_operators=[], prefix_operators=[], qualifier=bufferLengths, 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=buffers, 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)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=evictionLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[clear] operator[SEP] operator[SEP] {
identifier[evictionLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Node] identifier[node] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[node] operator[=] identifier[evictionDeque] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[data] operator[SEP] identifier[remove] operator[SEP] identifier[node] operator[SEP] identifier[key] , identifier[node] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[makeDead] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[buffers] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Queue] operator[<] identifier[Task] operator[>] identifier[buffer] operator[=] identifier[buffers] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[int] identifier[removed] operator[=] Other[0] operator[SEP] identifier[Task] identifier[task] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[task] operator[=] identifier[buffer] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[isWrite] operator[SEP] operator[SEP] operator[SEP] {
identifier[task] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP]
}
identifier[removed] operator[++] operator[SEP]
}
identifier[bufferLengths] operator[SEP] identifier[addAndGet] operator[SEP] identifier[i] , operator[-] identifier[removed] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[evictionLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setResponseCharacterEncoding(String encoding)
{
ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
if (ctx == null)
{
throw new UnsupportedOperationException();
}
ctx.setResponseCharacterEncoding(encoding);
} | class class_name[name] begin[{]
method[setResponseCharacterEncoding, return_type[void], modifier[public], parameter[encoding]] begin[{]
local_variable[type[ExternalContext], ctx]
if[binary_operation[member[.ctx], ==, 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=UnsupportedOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[ctx.setResponseCharacterEncoding, parameter[member[.encoding]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setResponseCharacterEncoding] operator[SEP] identifier[String] identifier[encoding] operator[SEP] {
identifier[ExternalContext] identifier[ctx] operator[=] identifier[_MyFacesExternalContextHelper] operator[SEP] identifier[firstInstance] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctx] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ctx] operator[SEP] identifier[setResponseCharacterEncoding] operator[SEP] identifier[encoding] operator[SEP] operator[SEP]
}
|
public Future<AggregationResponse> sign(DataHash dataHash, Long level) throws KSIException {
Util.notNull(dataHash, "dataHash");
Util.notNull(level, "level");
final Collection<Callable<AggregationResponse>> tasks = new ArrayList<>(subservices.size());
for (KSISigningService subservice : subservices) {
tasks.add(new SigningTask(subservice, dataHash, level));
}
return new ServiceCallFuture<>(
executorService.submit(new ServiceCallsTask<>(executorService, tasks))
);
} | class class_name[name] begin[{]
method[sign, return_type[type[Future]], modifier[public], parameter[dataHash, level]] begin[{]
call[Util.notNull, parameter[member[.dataHash], literal["dataHash"]]]
call[Util.notNull, parameter[member[.level], literal["level"]]]
local_variable[type[Collection], tasks]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=subservice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataHash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=level, 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=SigningTask, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=tasks, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=subservices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=subservice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KSISigningService, sub_type=None))), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=executorService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tasks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ServiceCallsTask, sub_type=None))], member=submit, postfix_operators=[], prefix_operators=[], qualifier=executorService, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ServiceCallFuture, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Future] operator[<] identifier[AggregationResponse] operator[>] identifier[sign] operator[SEP] identifier[DataHash] identifier[dataHash] , identifier[Long] identifier[level] operator[SEP] Keyword[throws] identifier[KSIException] {
identifier[Util] operator[SEP] identifier[notNull] operator[SEP] identifier[dataHash] , literal[String] operator[SEP] operator[SEP] identifier[Util] operator[SEP] identifier[notNull] operator[SEP] identifier[level] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[Callable] operator[<] identifier[AggregationResponse] operator[>] operator[>] identifier[tasks] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[subservices] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[KSISigningService] identifier[subservice] operator[:] identifier[subservices] operator[SEP] {
identifier[tasks] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[SigningTask] operator[SEP] identifier[subservice] , identifier[dataHash] , identifier[level] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ServiceCallFuture] operator[<] operator[>] operator[SEP] identifier[executorService] operator[SEP] identifier[submit] operator[SEP] Keyword[new] identifier[ServiceCallsTask] operator[<] operator[>] operator[SEP] identifier[executorService] , identifier[tasks] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void applySnowFlakeIdGen(int machineLen, long machineId) {
SnowFlakeGenerator.Factory factory = new SnowFlakeGenerator.Factory(machineLen, 0);
SnowFlakeGenerator snowFlakeGenerator = factory.create(0, machineId);
RandomUtils.init(() -> String.valueOf(snowFlakeGenerator.nextId()));
} | class class_name[name] begin[{]
method[applySnowFlakeIdGen, return_type[void], modifier[public static], parameter[machineLen, machineId]] begin[{]
local_variable[type[SnowFlakeGenerator], factory]
local_variable[type[SnowFlakeGenerator], snowFlakeGenerator]
call[RandomUtils.init, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextId, postfix_operators=[], prefix_operators=[], qualifier=snowFlakeGenerator, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), parameters=[])]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[applySnowFlakeIdGen] operator[SEP] Keyword[int] identifier[machineLen] , Keyword[long] identifier[machineId] operator[SEP] {
identifier[SnowFlakeGenerator] operator[SEP] identifier[Factory] identifier[factory] operator[=] Keyword[new] identifier[SnowFlakeGenerator] operator[SEP] identifier[Factory] operator[SEP] identifier[machineLen] , Other[0] operator[SEP] operator[SEP] identifier[SnowFlakeGenerator] identifier[snowFlakeGenerator] operator[=] identifier[factory] operator[SEP] identifier[create] operator[SEP] Other[0] , identifier[machineId] operator[SEP] operator[SEP] identifier[RandomUtils] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[snowFlakeGenerator] operator[SEP] identifier[nextId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void destroy() {
try {
ContextClassLoaderUtils.doWithClassLoader(jasperClassLoader,
new Callable<Void>() {
@Override
public Void call() throws Exception {
jasperServlet.destroy();
return null;
}
});
//CHECKSTYLE:OFF
} catch (Exception ignore) {
// ignored as it should never happen
LOG.error("Ignored exception", ignore);
}
//CHECKSTYLE:ON
} | class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jasperClassLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=jasperServlet, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), throws=['Exception'], 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=Void, sub_type=None))], dimensions=None, name=Callable, sub_type=None))], member=doWithClassLoader, postfix_operators=[], prefix_operators=[], qualifier=ContextClassLoaderUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ignored exception"), MemberReference(member=ignore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[destroy] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[ContextClassLoaderUtils] operator[SEP] identifier[doWithClassLoader] operator[SEP] identifier[jasperClassLoader] , Keyword[new] identifier[Callable] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[jasperServlet] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ignore] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ignore] operator[SEP] operator[SEP]
}
}
|
public static ProductType createType(ProductDimensionType productDimensionType,
@Nullable String productTypeValue) {
Preconditions.checkNotNull(productDimensionType,
"ProductDimensionType is required when creating a ProductType");
ProductType productType = new ProductType();
productType.setType(productDimensionType);
productType.setValue(productTypeValue);
return productType;
} | class class_name[name] begin[{]
method[createType, return_type[type[ProductType]], modifier[public static], parameter[productDimensionType, productTypeValue]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.productDimensionType], literal["ProductDimensionType is required when creating a ProductType"]]]
local_variable[type[ProductType], productType]
call[productType.setType, parameter[member[.productDimensionType]]]
call[productType.setValue, parameter[member[.productTypeValue]]]
return[member[.productType]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ProductType] identifier[createType] operator[SEP] identifier[ProductDimensionType] identifier[productDimensionType] , annotation[@] identifier[Nullable] identifier[String] identifier[productTypeValue] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[productDimensionType] , literal[String] operator[SEP] operator[SEP] identifier[ProductType] identifier[productType] operator[=] Keyword[new] identifier[ProductType] operator[SEP] operator[SEP] operator[SEP] identifier[productType] operator[SEP] identifier[setType] operator[SEP] identifier[productDimensionType] operator[SEP] operator[SEP] identifier[productType] operator[SEP] identifier[setValue] operator[SEP] identifier[productTypeValue] operator[SEP] operator[SEP] Keyword[return] identifier[productType] operator[SEP]
}
|
private static String[] readFlagFile(String path) throws ParseException {
Path p = Paths.get(path);
if (!Files.isRegularFile(p)) {
throw new ParseException("--flagfile specified a file that does not exist: " + path);
}
StringBuilder sb = new StringBuilder();
try {
for (String line : Files.readAllLines(p)) {
if (line.startsWith("#")) { continue; }
sb.append(line);
}
} catch (IOException e) {
throw new ParseException("Error while reading flagfile: " + e.getMessage());
}
return sb.toString().split("\\s+");
} | class class_name[name] begin[{]
method[readFlagFile, return_type[type[String]], modifier[private static], parameter[path]] begin[{]
local_variable[type[Path], p]
if[call[Files.isRegularFile, parameter[member[.p]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="--flagfile specified a file that does not exist: "), operandr=MemberReference(member=path, 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=ParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[StringBuilder], sb]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="#")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readAllLines, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while reading flagfile: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] operator[SEP] operator[SEP] identifier[readFlagFile] operator[SEP] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[Path] identifier[p] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Files] operator[SEP] identifier[isRegularFile] operator[SEP] identifier[p] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[+] identifier[path] operator[SEP] operator[SEP]
}
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[String] identifier[line] operator[:] identifier[Files] operator[SEP] identifier[readAllLines] operator[SEP] identifier[p] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public CreateResponse createFlowConfig(FlowConfig flowConfig)
throws FlowConfigLoggedException {
String flowName = flowConfig.getId().getFlowName();
String flowGroup = flowConfig.getId().getFlowGroup();
checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_ADD, flowName, flowGroup);
try {
if (!jobScheduler.isActive() && helixManager.isPresent()) {
CreateResponse response = null;
if (this.flowCatalogLocalCommit) {
// We will handle FS I/O locally for load balance before forwarding to remote node.
response = this.localHandler.createFlowConfig(flowConfig, false);
}
if (!flowConfig.hasExplain() || !flowConfig.isExplain()) {
//Forward the message to master only if it is not an "explain" request.
forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_ADD, FlowConfigUtils.serializeFlowConfig(flowConfig), flowName, flowGroup);
}
// Do actual work on remote node, directly return success
return response == null ? new CreateResponse(new ComplexResourceKey<>(flowConfig.getId(), new EmptyRecord()),
HttpStatus.S_201_CREATED) : response;
} else {
return this.localHandler.createFlowConfig(flowConfig);
}
} catch (IOException e) {
throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR,
"Cannot create flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e);
}
} | class class_name[name] begin[{]
method[createFlowConfig, return_type[type[CreateResponse]], modifier[public], parameter[flowConfig]] begin[{]
local_variable[type[String], flowName]
local_variable[type[String], flowGroup]
call[.checkHelixConnection, parameter[member[ServiceConfigKeys.HELIX_FLOWSPEC_ADD], member[.flowName], member[.flowGroup]]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isActive, postfix_operators=[], prefix_operators=['!'], qualifier=jobScheduler, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isPresent, postfix_operators=[], prefix_operators=[], qualifier=helixManager, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=localHandler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=flowConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFlowConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateResponse, sub_type=None)), IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=flowCatalogLocalCommit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=localHandler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=flowConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=createFlowConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasExplain, postfix_operators=[], prefix_operators=['!'], qualifier=flowConfig, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isExplain, postfix_operators=[], prefix_operators=['!'], qualifier=flowConfig, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HELIX_FLOWSPEC_ADD, postfix_operators=[], prefix_operators=[], qualifier=ServiceConfigKeys, selectors=[]), MethodInvocation(arguments=[MemberReference(member=flowConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serializeFlowConfig, postfix_operators=[], prefix_operators=[], qualifier=FlowConfigUtils, selectors=[], type_arguments=None), MemberReference(member=flowName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=flowGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forwardMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=flowConfig, selectors=[], type_arguments=None), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EmptyRecord, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ComplexResourceKey, sub_type=None)), MemberReference(member=S_201_CREATED, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CreateResponse, sub_type=None))), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=S_500_INTERNAL_SERVER_ERROR, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot create flowConfig [flowName="), operandr=MemberReference(member=flowName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" flowGroup="), operator=+), operandr=MemberReference(member=flowGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FlowConfigLoggedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CreateResponse] identifier[createFlowConfig] operator[SEP] identifier[FlowConfig] identifier[flowConfig] operator[SEP] Keyword[throws] identifier[FlowConfigLoggedException] {
identifier[String] identifier[flowName] operator[=] identifier[flowConfig] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[getFlowName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[flowGroup] operator[=] identifier[flowConfig] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[getFlowGroup] operator[SEP] operator[SEP] operator[SEP] identifier[checkHelixConnection] operator[SEP] identifier[ServiceConfigKeys] operator[SEP] identifier[HELIX_FLOWSPEC_ADD] , identifier[flowName] , identifier[flowGroup] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[jobScheduler] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[&&] identifier[helixManager] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[CreateResponse] identifier[response] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[flowCatalogLocalCommit] operator[SEP] {
identifier[response] operator[=] Keyword[this] operator[SEP] identifier[localHandler] operator[SEP] identifier[createFlowConfig] operator[SEP] identifier[flowConfig] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[flowConfig] operator[SEP] identifier[hasExplain] operator[SEP] operator[SEP] operator[||] operator[!] identifier[flowConfig] operator[SEP] identifier[isExplain] operator[SEP] operator[SEP] operator[SEP] {
identifier[forwardMessage] operator[SEP] identifier[ServiceConfigKeys] operator[SEP] identifier[HELIX_FLOWSPEC_ADD] , identifier[FlowConfigUtils] operator[SEP] identifier[serializeFlowConfig] operator[SEP] identifier[flowConfig] operator[SEP] , identifier[flowName] , identifier[flowGroup] operator[SEP] operator[SEP]
}
Keyword[return] identifier[response] operator[==] Other[null] operator[?] Keyword[new] identifier[CreateResponse] operator[SEP] Keyword[new] identifier[ComplexResourceKey] operator[<] operator[>] operator[SEP] identifier[flowConfig] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , Keyword[new] identifier[EmptyRecord] operator[SEP] operator[SEP] operator[SEP] , identifier[HttpStatus] operator[SEP] identifier[S_201_CREATED] operator[SEP] operator[:] identifier[response] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP] identifier[localHandler] operator[SEP] identifier[createFlowConfig] operator[SEP] identifier[flowConfig] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FlowConfigLoggedException] operator[SEP] identifier[HttpStatus] operator[SEP] identifier[S_500_INTERNAL_SERVER_ERROR] , literal[String] operator[+] identifier[flowName] operator[+] literal[String] operator[+] identifier[flowGroup] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public double sumOfSquaresOfSums() {
double sum = 0.;
for(int i = 0; i < ls.length; i++) {
double v = ls[i];
sum += v * v;
}
return sum;
} | class class_name[name] begin[{]
method[sumOfSquaresOfSums, return_type[type[double]], modifier[public], parameter[]] begin[{]
local_variable[type[double], sum]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=ls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=v)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=ls, 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[.sum]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[sumOfSquaresOfSums] operator[SEP] operator[SEP] {
Keyword[double] identifier[sum] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ls] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[double] identifier[v] operator[=] identifier[ls] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sum] operator[+=] identifier[v] operator[*] identifier[v] operator[SEP]
}
Keyword[return] identifier[sum] operator[SEP]
}
|
@Override
@SuppressWarnings("unchecked")
public void collectParameters(Object pojo, List<Object> parameters) {
F facetValue = getFacetValue(pojo);
if (facetValue == null) {
parameters.add(nullColumnValue());
} else {
parameters.add(toColumnValue(facetValue));
}
} | class class_name[name] begin[{]
method[collectParameters, return_type[void], modifier[public], parameter[pojo, parameters]] begin[{]
local_variable[type[F], facetValue]
if[binary_operation[member[.facetValue], ==, literal[null]]] begin[{]
call[parameters.add, parameter[call[.nullColumnValue, parameter[]]]]
else begin[{]
call[parameters.add, parameter[call[.toColumnValue, parameter[member[.facetValue]]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[collectParameters] operator[SEP] identifier[Object] identifier[pojo] , identifier[List] operator[<] identifier[Object] operator[>] identifier[parameters] operator[SEP] {
identifier[F] identifier[facetValue] operator[=] identifier[getFacetValue] operator[SEP] identifier[pojo] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facetValue] operator[==] Other[null] operator[SEP] {
identifier[parameters] operator[SEP] identifier[add] operator[SEP] identifier[nullColumnValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[parameters] operator[SEP] identifier[add] operator[SEP] identifier[toColumnValue] operator[SEP] identifier[facetValue] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <V> Closure<V> buildSoftReferenceMemoizeFunction(final int protectedCacheSize, final MemoizeCache<Object, SoftReference<Object>> cache, final Closure<V> closure) {
final ProtectionStorage lruProtectionStorage = protectedCacheSize > 0 ?
new LRUProtectionStorage(protectedCacheSize) :
new NullProtectionStorage(); // Nothing should be done when no elements need protection against eviction
final ReferenceQueue queue = new ReferenceQueue();
return new SoftReferenceMemoizeFunction<V>(cache, closure, lruProtectionStorage, queue);
} | class class_name[name] begin[{]
method[buildSoftReferenceMemoizeFunction, return_type[type[Closure]], modifier[public static], parameter[protectedCacheSize, cache, closure]] begin[{]
local_variable[type[ProtectionStorage], lruProtectionStorage]
local_variable[type[ReferenceQueue], queue]
return[ClassCreator(arguments=[MemberReference(member=cache, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=closure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lruProtectionStorage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=queue, 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=SoftReferenceMemoizeFunction, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] operator[>] identifier[Closure] operator[<] identifier[V] operator[>] identifier[buildSoftReferenceMemoizeFunction] operator[SEP] Keyword[final] Keyword[int] identifier[protectedCacheSize] , Keyword[final] identifier[MemoizeCache] operator[<] identifier[Object] , identifier[SoftReference] operator[<] identifier[Object] operator[>] operator[>] identifier[cache] , Keyword[final] identifier[Closure] operator[<] identifier[V] operator[>] identifier[closure] operator[SEP] {
Keyword[final] identifier[ProtectionStorage] identifier[lruProtectionStorage] operator[=] identifier[protectedCacheSize] operator[>] Other[0] operator[?] Keyword[new] identifier[LRUProtectionStorage] operator[SEP] identifier[protectedCacheSize] operator[SEP] operator[:] Keyword[new] identifier[NullProtectionStorage] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ReferenceQueue] identifier[queue] operator[=] Keyword[new] identifier[ReferenceQueue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[SoftReferenceMemoizeFunction] operator[<] identifier[V] operator[>] operator[SEP] identifier[cache] , identifier[closure] , identifier[lruProtectionStorage] , identifier[queue] operator[SEP] operator[SEP]
}
|
private static boolean multiPointContainsPoint_(MultiPoint multipoint_a,
Point point_b, double tolerance, ProgressTracker progress_tracker) {
return !multiPointDisjointPoint_(multipoint_a, point_b, tolerance,
progress_tracker);
} | class class_name[name] begin[{]
method[multiPointContainsPoint_, return_type[type[boolean]], modifier[private static], parameter[multipoint_a, point_b, tolerance, progress_tracker]] begin[{]
return[call[.multiPointDisjointPoint_, parameter[member[.multipoint_a], member[.point_b], member[.tolerance], member[.progress_tracker]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[multiPointContainsPoint_] operator[SEP] identifier[MultiPoint] identifier[multipoint_a] , identifier[Point] identifier[point_b] , Keyword[double] identifier[tolerance] , identifier[ProgressTracker] identifier[progress_tracker] operator[SEP] {
Keyword[return] operator[!] identifier[multiPointDisjointPoint_] operator[SEP] identifier[multipoint_a] , identifier[point_b] , identifier[tolerance] , identifier[progress_tracker] operator[SEP] operator[SEP]
}
|
@Nonnull
@ReturnsMutableCopy
public static byte [] encodeCharToBytes (@Nonnull final char [] aCharArray,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
@Nonnull final Charset aCharset)
{
ValueEnforcer.isArrayOfsLen (aCharArray, nOfs, nLen);
final CharsetEncoder aEncoder = aCharset.newEncoder ();
// We need to perform double, not float, arithmetic; otherwise
// we lose low order bits when nLen is larger than 2^24.
final int nEncodedLen = (int) (nLen * (double) aEncoder.maxBytesPerChar ());
final byte [] aByteArray = new byte [nEncodedLen];
if (nLen == 0)
return aByteArray;
aEncoder.onMalformedInput (CodingErrorAction.REPLACE).onUnmappableCharacter (CodingErrorAction.REPLACE).reset ();
final CharBuffer aSrcBuf = CharBuffer.wrap (aCharArray, nOfs, nLen);
final ByteBuffer aDstBuf = ByteBuffer.wrap (aByteArray);
try
{
CoderResult aRes = aEncoder.encode (aSrcBuf, aDstBuf, true);
if (!aRes.isUnderflow ())
aRes.throwException ();
aRes = aEncoder.flush (aDstBuf);
if (!aRes.isUnderflow ())
aRes.throwException ();
}
catch (final CharacterCodingException x)
{
throw new IllegalStateException (x);
}
final int nDstLen = aDstBuf.position ();
if (nDstLen == aByteArray.length)
return aByteArray;
return Arrays.copyOf (aByteArray, nDstLen);
} | class class_name[name] begin[{]
method[encodeCharToBytes, return_type[type[byte]], modifier[public static], parameter[aCharArray, nOfs, nLen, aCharset]] begin[{]
call[ValueEnforcer.isArrayOfsLen, parameter[member[.aCharArray], member[.nOfs], member[.nLen]]]
local_variable[type[CharsetEncoder], aEncoder]
local_variable[type[int], nEncodedLen]
local_variable[type[byte], aByteArray]
if[binary_operation[member[.nLen], ==, literal[0]]] begin[{]
return[member[.aByteArray]]
else begin[{]
None
end[}]
call[aEncoder.onMalformedInput, parameter[member[CodingErrorAction.REPLACE]]]
local_variable[type[CharBuffer], aSrcBuf]
local_variable[type[ByteBuffer], aDstBuf]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aSrcBuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aDstBuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=encode, postfix_operators=[], prefix_operators=[], qualifier=aEncoder, selectors=[], type_arguments=None), name=aRes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CoderResult, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isUnderflow, postfix_operators=[], prefix_operators=['!'], qualifier=aRes, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=throwException, postfix_operators=[], prefix_operators=[], qualifier=aRes, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=aRes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=aDstBuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=flush, postfix_operators=[], prefix_operators=[], qualifier=aEncoder, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isUnderflow, postfix_operators=[], prefix_operators=['!'], qualifier=aRes, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=throwException, postfix_operators=[], prefix_operators=[], qualifier=aRes, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['CharacterCodingException']))], finally_block=None, label=None, resources=None)
local_variable[type[int], nDstLen]
if[binary_operation[member[.nDstLen], ==, member[aByteArray.length]]] begin[{]
return[member[.aByteArray]]
else begin[{]
None
end[}]
return[call[Arrays.copyOf, parameter[member[.aByteArray], member[.nDstLen]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] annotation[@] identifier[ReturnsMutableCopy] Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[encodeCharToBytes] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[aCharArray] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nOfs] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nLen] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Charset] identifier[aCharset] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[isArrayOfsLen] operator[SEP] identifier[aCharArray] , identifier[nOfs] , identifier[nLen] operator[SEP] operator[SEP] Keyword[final] identifier[CharsetEncoder] identifier[aEncoder] operator[=] identifier[aCharset] operator[SEP] identifier[newEncoder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[nEncodedLen] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[nLen] operator[*] operator[SEP] Keyword[double] operator[SEP] identifier[aEncoder] operator[SEP] identifier[maxBytesPerChar] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[aByteArray] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[nEncodedLen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nLen] operator[==] Other[0] operator[SEP] Keyword[return] identifier[aByteArray] operator[SEP] identifier[aEncoder] operator[SEP] identifier[onMalformedInput] operator[SEP] identifier[CodingErrorAction] operator[SEP] identifier[REPLACE] operator[SEP] operator[SEP] identifier[onUnmappableCharacter] operator[SEP] identifier[CodingErrorAction] operator[SEP] identifier[REPLACE] operator[SEP] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[CharBuffer] identifier[aSrcBuf] operator[=] identifier[CharBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[aCharArray] , identifier[nOfs] , identifier[nLen] operator[SEP] operator[SEP] Keyword[final] identifier[ByteBuffer] identifier[aDstBuf] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[aByteArray] operator[SEP] operator[SEP] Keyword[try] {
identifier[CoderResult] identifier[aRes] operator[=] identifier[aEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[aSrcBuf] , identifier[aDstBuf] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[aRes] operator[SEP] identifier[isUnderflow] operator[SEP] operator[SEP] operator[SEP] identifier[aRes] operator[SEP] identifier[throwException] operator[SEP] operator[SEP] operator[SEP] identifier[aRes] operator[=] identifier[aEncoder] operator[SEP] identifier[flush] operator[SEP] identifier[aDstBuf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[aRes] operator[SEP] identifier[isUnderflow] operator[SEP] operator[SEP] operator[SEP] identifier[aRes] operator[SEP] identifier[throwException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[CharacterCodingException] identifier[x] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[x] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[nDstLen] operator[=] identifier[aDstBuf] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nDstLen] operator[==] identifier[aByteArray] operator[SEP] identifier[length] operator[SEP] Keyword[return] identifier[aByteArray] operator[SEP] Keyword[return] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[aByteArray] , identifier[nDstLen] operator[SEP] operator[SEP]
}
|
public static List<ArtifactoryServer> getArtifactoryServers() {
ArtifactoryBuilder.DescriptorImpl descriptor = (ArtifactoryBuilder.DescriptorImpl)
Hudson.getInstance().getDescriptor(ArtifactoryBuilder.class);
return descriptor.getArtifactoryServers();
} | class class_name[name] begin[{]
method[getArtifactoryServers, return_type[type[List]], modifier[public static], parameter[]] begin[{]
local_variable[type[ArtifactoryBuilder], descriptor]
return[call[descriptor.getArtifactoryServers, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[ArtifactoryServer] operator[>] identifier[getArtifactoryServers] operator[SEP] operator[SEP] {
identifier[ArtifactoryBuilder] operator[SEP] identifier[DescriptorImpl] identifier[descriptor] operator[=] operator[SEP] identifier[ArtifactoryBuilder] operator[SEP] identifier[DescriptorImpl] operator[SEP] identifier[Hudson] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getDescriptor] operator[SEP] identifier[ArtifactoryBuilder] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] identifier[descriptor] operator[SEP] identifier[getArtifactoryServers] operator[SEP] operator[SEP] operator[SEP]
}
|
public static STextualDS getTextualDSForNode(SNode node, SDocumentGraph graph)
{
if (node != null)
{
List<DataSourceSequence> dataSources = graph.getOverlappedDataSourceSequence(
node,
SALT_TYPE.STEXT_OVERLAPPING_RELATION);
if (dataSources != null)
{
for (DataSourceSequence seq : dataSources)
{
if (seq.getDataSource() instanceof STextualDS)
{
return (STextualDS) seq.getDataSource();
}
}
}
}
return null;
} | class class_name[name] begin[{]
method[getTextualDSForNode, return_type[type[STextualDS]], modifier[public static], parameter[node, graph]] begin[{]
if[binary_operation[member[.node], !=, literal[null]]] begin[{]
local_variable[type[List], dataSources]
if[binary_operation[member[.dataSources], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDataSource, postfix_operators=[], prefix_operators=[], qualifier=seq, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=STextualDS, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getDataSource, postfix_operators=[], prefix_operators=[], qualifier=seq, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=STextualDS, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=dataSources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=seq)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataSourceSequence, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[STextualDS] identifier[getTextualDSForNode] operator[SEP] identifier[SNode] identifier[node] , identifier[SDocumentGraph] identifier[graph] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[DataSourceSequence] operator[>] identifier[dataSources] operator[=] identifier[graph] operator[SEP] identifier[getOverlappedDataSourceSequence] operator[SEP] identifier[node] , identifier[SALT_TYPE] operator[SEP] identifier[STEXT_OVERLAPPING_RELATION] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataSources] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[DataSourceSequence] identifier[seq] operator[:] identifier[dataSources] operator[SEP] {
Keyword[if] operator[SEP] identifier[seq] operator[SEP] identifier[getDataSource] operator[SEP] operator[SEP] Keyword[instanceof] identifier[STextualDS] operator[SEP] {
Keyword[return] operator[SEP] identifier[STextualDS] operator[SEP] identifier[seq] operator[SEP] identifier[getDataSource] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public ReadRecordStatus readRecord(byte[] hostBytes, int processed) throws IOException {
int bytesRead = 0;
if (getBytesPrefetched() == 0) {
bytesRead = readFully(hostBytes, 0, RDW_LEN);
if (bytesRead < RDW_LEN) {
throw new IOException(
"Not enough bytes left for a record descriptor word");
}
setBytesPrefetched(RDW_LEN);
}
int recordLen = getRecordLen(hostBytes);
bytesRead += readFully(hostBytes, getBytesPrefetched(), recordLen
- getBytesPrefetched() + RDW_LEN);
setBytesPrefetched(0);
return new ReadRecordStatus(recordLen, bytesRead);
} | class class_name[name] begin[{]
method[readRecord, return_type[type[ReadRecordStatus]], modifier[public], parameter[hostBytes, processed]] begin[{]
local_variable[type[int], bytesRead]
if[binary_operation[call[.getBytesPrefetched, parameter[]], ==, literal[0]]] begin[{]
assign[member[.bytesRead], call[.readFully, parameter[member[.hostBytes], literal[0], member[.RDW_LEN]]]]
if[binary_operation[member[.bytesRead], <, member[.RDW_LEN]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not enough bytes left for a record descriptor word")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.setBytesPrefetched, parameter[member[.RDW_LEN]]]
else begin[{]
None
end[}]
local_variable[type[int], recordLen]
assign[member[.bytesRead], call[.readFully, parameter[member[.hostBytes], call[.getBytesPrefetched, parameter[]], binary_operation[binary_operation[member[.recordLen], -, call[.getBytesPrefetched, parameter[]]], +, member[.RDW_LEN]]]]]
call[.setBytesPrefetched, parameter[literal[0]]]
return[ClassCreator(arguments=[MemberReference(member=recordLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bytesRead, 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=ReadRecordStatus, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ReadRecordStatus] identifier[readRecord] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[hostBytes] , Keyword[int] identifier[processed] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[bytesRead] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[getBytesPrefetched] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[bytesRead] operator[=] identifier[readFully] operator[SEP] identifier[hostBytes] , Other[0] , identifier[RDW_LEN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bytesRead] operator[<] identifier[RDW_LEN] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[setBytesPrefetched] operator[SEP] identifier[RDW_LEN] operator[SEP] operator[SEP]
}
Keyword[int] identifier[recordLen] operator[=] identifier[getRecordLen] operator[SEP] identifier[hostBytes] operator[SEP] operator[SEP] identifier[bytesRead] operator[+=] identifier[readFully] operator[SEP] identifier[hostBytes] , identifier[getBytesPrefetched] operator[SEP] operator[SEP] , identifier[recordLen] operator[-] identifier[getBytesPrefetched] operator[SEP] operator[SEP] operator[+] identifier[RDW_LEN] operator[SEP] operator[SEP] identifier[setBytesPrefetched] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ReadRecordStatus] operator[SEP] identifier[recordLen] , identifier[bytesRead] operator[SEP] operator[SEP]
}
|
public static <E extends Enum<E>> EnumSet<E> complementOf(
Collection<E> collection, Class<E> type) {
checkNotNull(collection);
return (collection instanceof EnumSet)
? EnumSet.complementOf((EnumSet<E>) collection)
: makeComplementByHand(collection, type);
} | class class_name[name] begin[{]
method[complementOf, return_type[type[EnumSet]], modifier[public static], parameter[collection, type]] begin[{]
call[.checkNotNull, parameter[member[.collection]]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=collection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=EnumSet, sub_type=None), operator=instanceof), if_false=MethodInvocation(arguments=[MemberReference(member=collection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeComplementByHand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[Cast(expression=MemberReference(member=collection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=EnumSet, sub_type=None))], member=complementOf, postfix_operators=[], prefix_operators=[], qualifier=EnumSet, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] Keyword[extends] identifier[Enum] operator[<] identifier[E] operator[>] operator[>] identifier[EnumSet] operator[<] identifier[E] operator[>] identifier[complementOf] operator[SEP] identifier[Collection] operator[<] identifier[E] operator[>] identifier[collection] , identifier[Class] operator[<] identifier[E] operator[>] identifier[type] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[collection] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[collection] Keyword[instanceof] identifier[EnumSet] operator[SEP] operator[?] identifier[EnumSet] operator[SEP] identifier[complementOf] operator[SEP] operator[SEP] identifier[EnumSet] operator[<] identifier[E] operator[>] operator[SEP] identifier[collection] operator[SEP] operator[:] identifier[makeComplementByHand] operator[SEP] identifier[collection] , identifier[type] operator[SEP] operator[SEP]
}
|
public int getSortOrder(Element element) {
String deepName = getDeepName(element);
return elementNameSortOrderMap.get(deepName);
} | class class_name[name] begin[{]
method[getSortOrder, return_type[type[int]], modifier[public], parameter[element]] begin[{]
local_variable[type[String], deepName]
return[call[elementNameSortOrderMap.get, parameter[member[.deepName]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getSortOrder] operator[SEP] identifier[Element] identifier[element] operator[SEP] {
identifier[String] identifier[deepName] operator[=] identifier[getDeepName] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[return] identifier[elementNameSortOrderMap] operator[SEP] identifier[get] operator[SEP] identifier[deepName] operator[SEP] operator[SEP]
}
|
public void close() {
if (connected.compareAndSet(true, false)) {
// remove handshake flag
session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
// clear the delay queue
queue.clear();
// whether to attempt a nice close or a forceful one
if (WebSocketTransport.isNiceClose()) {
// send a proper ws close
Packet packet = Packet.build(Constants.CLOSE_MESSAGE_BYTES, MessageType.CLOSE);
WriteFuture writeFuture = session.write(packet);
writeFuture.addListener(new IoFutureListener<WriteFuture>() {
@Override
public void operationComplete(WriteFuture future) {
if (future.isWritten()) {
log.debug("Close message written");
// only set on success for now to skip boolean check later
session.setAttribute(Constants.STATUS_CLOSE_WRITTEN, Boolean.TRUE);
}
future.removeListener(this);
}
});
// adjust close routine to allow for flushing
CloseFuture closeFuture = session.closeOnFlush();
closeFuture.addListener(new IoFutureListener<CloseFuture>() {
public void operationComplete(CloseFuture future) {
if (future.isClosed()) {
log.debug("Connection is closed");
} else {
log.debug("Connection is not yet closed");
}
future.removeListener(this);
}
});
} else {
// force close
CloseFuture closeFuture = session.closeNow();
closeFuture.addListener(new IoFutureListener<CloseFuture>() {
public void operationComplete(CloseFuture future) {
if (future.isClosed()) {
log.debug("Connection is closed");
} else {
log.debug("Connection is not yet closed");
}
future.removeListener(this);
}
});
}
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[call[connected.compareAndSet, parameter[literal[true], literal[false]]]] begin[{]
call[session.removeAttribute, parameter[member[Constants.HANDSHAKE_COMPLETE]]]
call[queue.clear, parameter[]]
if[call[WebSocketTransport.isNiceClose, parameter[]]] begin[{]
local_variable[type[Packet], packet]
local_variable[type[WriteFuture], writeFuture]
call[writeFuture.addListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isWritten, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Close message written")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STATUS_CLOSE_WRITTEN, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), MemberReference(member=TRUE, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[])], member=setAttribute, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=removeListener, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=operationComplete, parameters=[FormalParameter(annotations=[], modifiers=set(), name=future, type=ReferenceType(arguments=None, dimensions=[], name=WriteFuture, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=WriteFuture, sub_type=None))], dimensions=None, name=IoFutureListener, sub_type=None))]]
local_variable[type[CloseFuture], closeFuture]
call[closeFuture.addListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isClosed, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection is not yet closed")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection is closed")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=removeListener, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=operationComplete, parameters=[FormalParameter(annotations=[], modifiers=set(), name=future, type=ReferenceType(arguments=None, dimensions=[], name=CloseFuture, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CloseFuture, sub_type=None))], dimensions=None, name=IoFutureListener, sub_type=None))]]
else begin[{]
local_variable[type[CloseFuture], closeFuture]
call[closeFuture.addListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isClosed, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection is not yet closed")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection is closed")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=removeListener, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=operationComplete, parameters=[FormalParameter(annotations=[], modifiers=set(), name=future, type=ReferenceType(arguments=None, dimensions=[], name=CloseFuture, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CloseFuture, sub_type=None))], dimensions=None, name=IoFutureListener, sub_type=None))]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[connected] operator[SEP] identifier[compareAndSet] operator[SEP] literal[boolean] , literal[boolean] operator[SEP] operator[SEP] {
identifier[session] operator[SEP] identifier[removeAttribute] operator[SEP] identifier[Constants] operator[SEP] identifier[HANDSHAKE_COMPLETE] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[WebSocketTransport] operator[SEP] identifier[isNiceClose] operator[SEP] operator[SEP] operator[SEP] {
identifier[Packet] identifier[packet] operator[=] identifier[Packet] operator[SEP] identifier[build] operator[SEP] identifier[Constants] operator[SEP] identifier[CLOSE_MESSAGE_BYTES] , identifier[MessageType] operator[SEP] identifier[CLOSE] operator[SEP] operator[SEP] identifier[WriteFuture] identifier[writeFuture] operator[=] identifier[session] operator[SEP] identifier[write] operator[SEP] identifier[packet] operator[SEP] operator[SEP] identifier[writeFuture] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[IoFutureListener] operator[<] identifier[WriteFuture] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[operationComplete] operator[SEP] identifier[WriteFuture] identifier[future] operator[SEP] {
Keyword[if] operator[SEP] identifier[future] operator[SEP] identifier[isWritten] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[setAttribute] operator[SEP] identifier[Constants] operator[SEP] identifier[STATUS_CLOSE_WRITTEN] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP]
}
identifier[future] operator[SEP] identifier[removeListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[CloseFuture] identifier[closeFuture] operator[=] identifier[session] operator[SEP] identifier[closeOnFlush] operator[SEP] operator[SEP] operator[SEP] identifier[closeFuture] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[IoFutureListener] operator[<] identifier[CloseFuture] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[operationComplete] operator[SEP] identifier[CloseFuture] identifier[future] operator[SEP] {
Keyword[if] operator[SEP] identifier[future] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[future] operator[SEP] identifier[removeListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CloseFuture] identifier[closeFuture] operator[=] identifier[session] operator[SEP] identifier[closeNow] operator[SEP] operator[SEP] operator[SEP] identifier[closeFuture] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[IoFutureListener] operator[<] identifier[CloseFuture] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[operationComplete] operator[SEP] identifier[CloseFuture] identifier[future] operator[SEP] {
Keyword[if] operator[SEP] identifier[future] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[future] operator[SEP] identifier[removeListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
}
}
|
public Quartz with(final Class<? extends Job> jobClass,
final BiConsumer<JobBuilder, TriggerBuilder<Trigger>> configurer) {
requireNonNull(jobClass, "Job class is required.");
JobBuilder job = JobBuilder.newJob(jobClass)
.withIdentity(
JobKey.jobKey(jobClass.getSimpleName(), jobClass.getPackage().getName())
);
TriggerBuilder<Trigger> trigger = TriggerBuilder.newTrigger()
.withIdentity(
TriggerKey.triggerKey(jobClass.getSimpleName(), jobClass.getPackage().getName())
);
configurer.accept(job, trigger);
return with(job.build(), trigger.build());
} | class class_name[name] begin[{]
method[with, return_type[type[Quartz]], modifier[public], parameter[jobClass, configurer]] begin[{]
call[.requireNonNull, parameter[member[.jobClass], literal["Job class is required."]]]
local_variable[type[JobBuilder], job]
local_variable[type[TriggerBuilder], trigger]
call[configurer.accept, parameter[member[.job], member[.trigger]]]
return[call[.with, parameter[call[job.build, parameter[]], call[trigger.build, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[Quartz] identifier[with] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Job] operator[>] identifier[jobClass] , Keyword[final] identifier[BiConsumer] operator[<] identifier[JobBuilder] , identifier[TriggerBuilder] operator[<] identifier[Trigger] operator[>] operator[>] identifier[configurer] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[jobClass] , literal[String] operator[SEP] operator[SEP] identifier[JobBuilder] identifier[job] operator[=] identifier[JobBuilder] operator[SEP] identifier[newJob] operator[SEP] identifier[jobClass] operator[SEP] operator[SEP] identifier[withIdentity] operator[SEP] identifier[JobKey] operator[SEP] identifier[jobKey] operator[SEP] identifier[jobClass] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[jobClass] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TriggerBuilder] operator[<] identifier[Trigger] operator[>] identifier[trigger] operator[=] identifier[TriggerBuilder] operator[SEP] identifier[newTrigger] operator[SEP] operator[SEP] operator[SEP] identifier[withIdentity] operator[SEP] identifier[TriggerKey] operator[SEP] identifier[triggerKey] operator[SEP] identifier[jobClass] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[jobClass] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[configurer] operator[SEP] identifier[accept] operator[SEP] identifier[job] , identifier[trigger] operator[SEP] operator[SEP] Keyword[return] identifier[with] operator[SEP] identifier[job] operator[SEP] identifier[build] operator[SEP] operator[SEP] , identifier[trigger] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Charset guessContentTypeCharset(final HttpURLConnection connection) {
String contentType = connection.getHeaderField(CONTENT_TYPE_HEADER);
if (contentType == null) {
return UTF8;
}
String charset = null;
for (String param : contentType.replace(" ", "").split(";")) {
if (param.startsWith("charset=")) {
charset = param.split("=", 2)[1];
break;
}
}
try {
return Charset.forName(charset);
} catch (Exception e) {
return UTF8;
}
} | class class_name[name] begin[{]
method[guessContentTypeCharset, return_type[type[Charset]], modifier[protected], parameter[connection]] begin[{]
local_variable[type[String], contentType]
if[binary_operation[member[.contentType], ==, literal[null]]] begin[{]
return[member[.UTF8]]
else begin[{]
None
end[}]
local_variable[type[String], charset]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="charset=")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=split, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=contentType, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";")], member=split, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=UTF8, 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[protected] identifier[Charset] identifier[guessContentTypeCharset] operator[SEP] Keyword[final] identifier[HttpURLConnection] identifier[connection] operator[SEP] {
identifier[String] identifier[contentType] operator[=] identifier[connection] operator[SEP] identifier[getHeaderField] operator[SEP] identifier[CONTENT_TYPE_HEADER] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[contentType] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[UTF8] operator[SEP]
}
identifier[String] identifier[charset] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[param] operator[:] identifier[contentType] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[param] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[charset] operator[=] identifier[param] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[try] {
Keyword[return] identifier[Charset] operator[SEP] identifier[forName] operator[SEP] identifier[charset] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] identifier[UTF8] operator[SEP]
}
}
|
public ICalComponentScribe<? extends ICalComponent> getComponentScribe(String componentName, ICalVersion version) {
componentName = componentName.toUpperCase();
ICalComponentScribe<? extends ICalComponent> scribe = experimentalCompByName.get(componentName);
if (scribe == null) {
scribe = standardCompByName.get(componentName);
}
if (scribe == null) {
return new RawComponentScribe(componentName);
}
if (version != null && !scribe.getSupportedVersions().contains(version)) {
//treat the component as a raw component if the current iCal version doesn't support it
return new RawComponentScribe(componentName);
}
return scribe;
} | class class_name[name] begin[{]
method[getComponentScribe, return_type[type[ICalComponentScribe]], modifier[public], parameter[componentName, version]] begin[{]
assign[member[.componentName], call[componentName.toUpperCase, parameter[]]]
local_variable[type[ICalComponentScribe], scribe]
if[binary_operation[member[.scribe], ==, literal[null]]] begin[{]
assign[member[.scribe], call[standardCompByName.get, parameter[member[.componentName]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.scribe], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=componentName, 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=RawComponentScribe, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.version], !=, literal[null]], &&, call[scribe.getSupportedVersions, parameter[]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=componentName, 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=RawComponentScribe, sub_type=None))]
else begin[{]
None
end[}]
return[member[.scribe]]
end[}]
END[}] | Keyword[public] identifier[ICalComponentScribe] operator[<] operator[?] Keyword[extends] identifier[ICalComponent] operator[>] identifier[getComponentScribe] operator[SEP] identifier[String] identifier[componentName] , identifier[ICalVersion] identifier[version] operator[SEP] {
identifier[componentName] operator[=] identifier[componentName] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] identifier[ICalComponentScribe] operator[<] operator[?] Keyword[extends] identifier[ICalComponent] operator[>] identifier[scribe] operator[=] identifier[experimentalCompByName] operator[SEP] identifier[get] operator[SEP] identifier[componentName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scribe] operator[==] Other[null] operator[SEP] {
identifier[scribe] operator[=] identifier[standardCompByName] operator[SEP] identifier[get] operator[SEP] identifier[componentName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[scribe] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[RawComponentScribe] operator[SEP] identifier[componentName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[version] operator[!=] Other[null] operator[&&] operator[!] identifier[scribe] operator[SEP] identifier[getSupportedVersions] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[version] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[RawComponentScribe] operator[SEP] identifier[componentName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[scribe] operator[SEP]
}
|
@SuppressWarnings("unchecked")
/* @Nullable */
public <T> T get(Object receiver, String fieldName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Preconditions.checkNotNull(receiver,"receiver");
Preconditions.checkNotNull(fieldName,"fieldName");
Class<? extends Object> clazz = receiver.getClass();
Field f = getDeclaredField(clazz, fieldName);
if (!f.isAccessible())
f.setAccessible(true);
return (T) f.get(receiver);
} | class class_name[name] begin[{]
method[get, return_type[type[T]], modifier[public], parameter[receiver, fieldName]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.receiver], literal["receiver"]]]
call[Preconditions.checkNotNull, parameter[member[.fieldName], literal["fieldName"]]]
local_variable[type[Class], clazz]
local_variable[type[Field], f]
if[call[f.isAccessible, parameter[]]] begin[{]
call[f.setAccessible, parameter[literal[true]]]
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=receiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[get] operator[SEP] identifier[Object] identifier[receiver] , identifier[String] identifier[fieldName] operator[SEP] Keyword[throws] identifier[SecurityException] , identifier[NoSuchFieldException] , identifier[IllegalArgumentException] , identifier[IllegalAccessException] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[receiver] , literal[String] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[fieldName] , literal[String] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Object] operator[>] identifier[clazz] operator[=] identifier[receiver] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[f] operator[=] identifier[getDeclaredField] operator[SEP] identifier[clazz] , identifier[fieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[f] operator[SEP] identifier[isAccessible] operator[SEP] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[f] operator[SEP] identifier[get] operator[SEP] identifier[receiver] operator[SEP] operator[SEP]
}
|
int insertPacket(
final int termId,
final int termOffset,
final UnsafeBuffer buffer,
final int length,
final int transportIndex,
final InetSocketAddress srcAddress)
{
final boolean isHeartbeat = DataHeaderFlyweight.isHeartbeat(buffer, length);
final long packetPosition = computePosition(termId, termOffset, positionBitsToShift, initialTermId);
final long proposedPosition = isHeartbeat ? packetPosition : packetPosition + length;
if (!isFlowControlUnderRun(packetPosition) && !isFlowControlOverRun(proposedPosition))
{
trackConnection(transportIndex, srcAddress, lastPacketTimestampNs);
if (isHeartbeat)
{
if (DataHeaderFlyweight.isEndOfStream(buffer) && !isEndOfStream && allEos(transportIndex))
{
LogBufferDescriptor.endOfStreamPosition(rawLog.metaData(), proposedPosition);
isEndOfStream = true;
}
heartbeatsReceived.incrementOrdered();
}
else
{
final UnsafeBuffer termBuffer = termBuffers[indexByPosition(packetPosition, positionBitsToShift)];
TermRebuilder.insert(termBuffer, termOffset, buffer, length);
}
lastPacketTimestampNs = cachedNanoClock.nanoTime();
hwmPosition.proposeMaxOrdered(proposedPosition);
}
return length;
} | class class_name[name] begin[{]
method[insertPacket, return_type[type[int]], modifier[default], parameter[termId, termOffset, buffer, length, transportIndex, srcAddress]] begin[{]
local_variable[type[boolean], isHeartbeat]
local_variable[type[long], packetPosition]
local_variable[type[long], proposedPosition]
if[binary_operation[call[.isFlowControlUnderRun, parameter[member[.packetPosition]]], &&, call[.isFlowControlOverRun, parameter[member[.proposedPosition]]]]] begin[{]
call[.trackConnection, parameter[member[.transportIndex], member[.srcAddress], member[.lastPacketTimestampNs]]]
if[member[.isHeartbeat]] begin[{]
if[binary_operation[binary_operation[call[DataHeaderFlyweight.isEndOfStream, parameter[member[.buffer]]], &&, member[.isEndOfStream]], &&, call[.allEos, parameter[member[.transportIndex]]]]] begin[{]
call[LogBufferDescriptor.endOfStreamPosition, parameter[call[rawLog.metaData, parameter[]], member[.proposedPosition]]]
assign[member[.isEndOfStream], literal[true]]
else begin[{]
None
end[}]
call[heartbeatsReceived.incrementOrdered, parameter[]]
else begin[{]
local_variable[type[UnsafeBuffer], termBuffer]
call[TermRebuilder.insert, parameter[member[.termBuffer], member[.termOffset], member[.buffer], member[.length]]]
end[}]
assign[member[.lastPacketTimestampNs], call[cachedNanoClock.nanoTime, parameter[]]]
call[hwmPosition.proposeMaxOrdered, parameter[member[.proposedPosition]]]
else begin[{]
None
end[}]
return[member[.length]]
end[}]
END[}] | Keyword[int] identifier[insertPacket] operator[SEP] Keyword[final] Keyword[int] identifier[termId] , Keyword[final] Keyword[int] identifier[termOffset] , Keyword[final] identifier[UnsafeBuffer] identifier[buffer] , Keyword[final] Keyword[int] identifier[length] , Keyword[final] Keyword[int] identifier[transportIndex] , Keyword[final] identifier[InetSocketAddress] identifier[srcAddress] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[isHeartbeat] operator[=] identifier[DataHeaderFlyweight] operator[SEP] identifier[isHeartbeat] operator[SEP] identifier[buffer] , identifier[length] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[packetPosition] operator[=] identifier[computePosition] operator[SEP] identifier[termId] , identifier[termOffset] , identifier[positionBitsToShift] , identifier[initialTermId] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[proposedPosition] operator[=] identifier[isHeartbeat] operator[?] identifier[packetPosition] operator[:] identifier[packetPosition] operator[+] identifier[length] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isFlowControlUnderRun] operator[SEP] identifier[packetPosition] operator[SEP] operator[&&] operator[!] identifier[isFlowControlOverRun] operator[SEP] identifier[proposedPosition] operator[SEP] operator[SEP] {
identifier[trackConnection] operator[SEP] identifier[transportIndex] , identifier[srcAddress] , identifier[lastPacketTimestampNs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isHeartbeat] operator[SEP] {
Keyword[if] operator[SEP] identifier[DataHeaderFlyweight] operator[SEP] identifier[isEndOfStream] operator[SEP] identifier[buffer] operator[SEP] operator[&&] operator[!] identifier[isEndOfStream] operator[&&] identifier[allEos] operator[SEP] identifier[transportIndex] operator[SEP] operator[SEP] {
identifier[LogBufferDescriptor] operator[SEP] identifier[endOfStreamPosition] operator[SEP] identifier[rawLog] operator[SEP] identifier[metaData] operator[SEP] operator[SEP] , identifier[proposedPosition] operator[SEP] operator[SEP] identifier[isEndOfStream] operator[=] literal[boolean] operator[SEP]
}
identifier[heartbeatsReceived] operator[SEP] identifier[incrementOrdered] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[UnsafeBuffer] identifier[termBuffer] operator[=] identifier[termBuffers] operator[SEP] identifier[indexByPosition] operator[SEP] identifier[packetPosition] , identifier[positionBitsToShift] operator[SEP] operator[SEP] operator[SEP] identifier[TermRebuilder] operator[SEP] identifier[insert] operator[SEP] identifier[termBuffer] , identifier[termOffset] , identifier[buffer] , identifier[length] operator[SEP] operator[SEP]
}
identifier[lastPacketTimestampNs] operator[=] identifier[cachedNanoClock] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[SEP] identifier[hwmPosition] operator[SEP] identifier[proposeMaxOrdered] operator[SEP] identifier[proposedPosition] operator[SEP] operator[SEP]
}
Keyword[return] identifier[length] operator[SEP]
}
|
public final void addParam(String key, int value) {
//System.out.println(" adding " + key + " = " + value);
paramInt.put(key, new Integer(value));
paramStr.put(key, Integer.toString(value));
} | class class_name[name] begin[{]
method[addParam, return_type[void], modifier[final public], parameter[key, value]] begin[{]
call[paramInt.put, parameter[member[.key], ClassCreator(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]]
call[paramStr.put, parameter[member[.key], call[Integer.toString, parameter[member[.value]]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addParam] operator[SEP] identifier[String] identifier[key] , Keyword[int] identifier[value] operator[SEP] {
identifier[paramInt] operator[SEP] identifier[put] operator[SEP] identifier[key] , Keyword[new] identifier[Integer] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[paramStr] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public double add(int index, double delta) {
checkIndex(index);
double value = get(index) + delta;
set(index, value);
return value;
} | class class_name[name] begin[{]
method[add, return_type[type[double]], modifier[public], parameter[index, delta]] begin[{]
call[.checkIndex, parameter[member[.index]]]
local_variable[type[double], value]
call[.set, parameter[member[.index], member[.value]]]
return[member[.value]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[add] operator[SEP] Keyword[int] identifier[index] , Keyword[double] identifier[delta] operator[SEP] {
identifier[checkIndex] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[double] identifier[value] operator[=] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[+] identifier[delta] operator[SEP] identifier[set] operator[SEP] identifier[index] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public T findOne(T query, T fields) {
return findOne(query, fields, getReadPreference());
} | class class_name[name] begin[{]
method[findOne, return_type[type[T]], modifier[public], parameter[query, fields]] begin[{]
return[call[.findOne, parameter[member[.query], member[.fields], call[.getReadPreference, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[T] identifier[findOne] operator[SEP] identifier[T] identifier[query] , identifier[T] identifier[fields] operator[SEP] {
Keyword[return] identifier[findOne] operator[SEP] identifier[query] , identifier[fields] , identifier[getReadPreference] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public VersionInfo getVersionOfLibrary(String name, boolean inEmbeddedDir) throws IOException {
Path startPath;
if(inEmbeddedDir) {
startPath = Paths.get(embeddedDirectory, name);
}
else {
Path ardDir = getArduinoDirectory().orElseThrow(IOException::new);
startPath = ardDir.resolve("libraries").resolve(name);
}
Path libProps = startPath.resolve(LIBRARY_PROPERTIES_NAME);
if(!Files.exists(libProps)) {
return new VersionInfo("0.0.0");
}
Properties propsSrc = new Properties();
try(FileReader reader = new FileReader(libProps.toFile())) {
propsSrc.load(reader);
}
return new VersionInfo(propsSrc.getProperty("version", "0.0.0"));
} | class class_name[name] begin[{]
method[getVersionOfLibrary, return_type[type[VersionInfo]], modifier[public], parameter[name, inEmbeddedDir]] begin[{]
local_variable[type[Path], startPath]
if[member[.inEmbeddedDir]] begin[{]
assign[member[.startPath], call[Paths.get, parameter[member[.embeddedDirectory], member[.name]]]]
else begin[{]
local_variable[type[Path], ardDir]
assign[member[.startPath], call[ardDir.resolve, parameter[literal["libraries"]]]]
end[}]
local_variable[type[Path], libProps]
if[call[Files.exists, parameter[member[.libProps]]]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="0.0.0")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VersionInfo, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Properties], propsSrc]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=propsSrc, 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=FileReader, sub_type=None), value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toFile, postfix_operators=[], prefix_operators=[], qualifier=libProps, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileReader, sub_type=None)))])
return[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="version"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="0.0.0")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=propsSrc, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VersionInfo, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[VersionInfo] identifier[getVersionOfLibrary] operator[SEP] identifier[String] identifier[name] , Keyword[boolean] identifier[inEmbeddedDir] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Path] identifier[startPath] operator[SEP] Keyword[if] operator[SEP] identifier[inEmbeddedDir] operator[SEP] {
identifier[startPath] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[embeddedDirectory] , identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Path] identifier[ardDir] operator[=] identifier[getArduinoDirectory] operator[SEP] operator[SEP] operator[SEP] identifier[orElseThrow] operator[SEP] identifier[IOException] operator[::] Keyword[new] operator[SEP] operator[SEP] identifier[startPath] operator[=] identifier[ardDir] operator[SEP] identifier[resolve] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[resolve] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
identifier[Path] identifier[libProps] operator[=] identifier[startPath] operator[SEP] identifier[resolve] operator[SEP] identifier[LIBRARY_PROPERTIES_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Files] operator[SEP] identifier[exists] operator[SEP] identifier[libProps] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[VersionInfo] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Properties] identifier[propsSrc] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[FileReader] identifier[reader] operator[=] Keyword[new] identifier[FileReader] operator[SEP] identifier[libProps] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[propsSrc] operator[SEP] identifier[load] operator[SEP] identifier[reader] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[VersionInfo] operator[SEP] identifier[propsSrc] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void deleteColumn(String indexColumnFamily, String rowKey, byte[] superColumnName,
String persistenceUnit, ConsistencyLevel consistencyLevel, byte[] columnName)
{
ColumnPath cp = new ColumnPath(indexColumnFamily);
cp.setSuper_column(superColumnName);
Connection conn = thriftClient.getConnection();
try
{
ColumnOrSuperColumn cosc;
try
{
cosc = conn.getClient().get(ByteBuffer.wrap(rowKey.getBytes()), cp, consistencyLevel);
}
catch (NotFoundException e)
{
return;
}
SuperColumn thriftSuperColumn = ThriftDataResultHelper.transformThriftResult(cosc,
ColumnFamilyType.SUPER_COLUMN, null);
if (thriftSuperColumn != null && thriftSuperColumn.getColumns() != null
&& thriftSuperColumn.getColumns().size() > 1)
{
cp.setColumn(columnName);
}
conn.getClient().remove(ByteBuffer.wrap(rowKey.getBytes()), cp, generator.getTimestamp(),
consistencyLevel);
}
catch (InvalidRequestException e)
{
log.error("Unable to delete data from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (UnavailableException e)
{
log.error("Unable to delete data from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (TimedOutException e)
{
log.error("Unable to delete data from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (TException e)
{
log.error("Unable to delete data from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
finally
{
thriftClient.releaseConnection(conn);
}
} | class class_name[name] begin[{]
method[deleteColumn, return_type[void], modifier[protected], parameter[indexColumnFamily, rowKey, superColumnName, persistenceUnit, consistencyLevel, columnName]] begin[{]
local_variable[type[ColumnPath], cp]
call[cp.setSuper_column, parameter[member[.superColumnName]]]
local_variable[type[Connection], conn]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=cosc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnOrSuperColumn, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cosc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=rowKey, selectors=[], type_arguments=None)], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None), MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consistencyLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NotFoundException']))], finally_block=None, label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cosc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=SUPER_COLUMN, postfix_operators=[], prefix_operators=[], qualifier=ColumnFamilyType, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=transformThriftResult, postfix_operators=[], prefix_operators=[], qualifier=ThriftDataResultHelper, selectors=[], type_arguments=None), name=thriftSuperColumn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SuperColumn, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=thriftSuperColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getColumns, postfix_operators=[], prefix_operators=[], qualifier=thriftSuperColumn, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getColumns, postfix_operators=[], prefix_operators=[], qualifier=thriftSuperColumn, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=columnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setColumn, postfix_operators=[], prefix_operators=[], qualifier=cp, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=rowKey, selectors=[], type_arguments=None)], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None), MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTimestamp, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[], type_arguments=None), MemberReference(member=consistencyLevel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to delete data from inverted index, Caused by: ."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidRequestException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to delete data from inverted index, Caused by: ."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnavailableException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to delete data from inverted index, Caused by: ."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TimedOutException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to delete data from inverted index, Caused by: ."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=releaseConnection, postfix_operators=[], prefix_operators=[], qualifier=thriftClient, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[deleteColumn] operator[SEP] identifier[String] identifier[indexColumnFamily] , identifier[String] identifier[rowKey] , Keyword[byte] operator[SEP] operator[SEP] identifier[superColumnName] , identifier[String] identifier[persistenceUnit] , identifier[ConsistencyLevel] identifier[consistencyLevel] , Keyword[byte] operator[SEP] operator[SEP] identifier[columnName] operator[SEP] {
identifier[ColumnPath] identifier[cp] operator[=] Keyword[new] identifier[ColumnPath] operator[SEP] identifier[indexColumnFamily] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[setSuper_column] operator[SEP] identifier[superColumnName] operator[SEP] operator[SEP] identifier[Connection] identifier[conn] operator[=] identifier[thriftClient] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[ColumnOrSuperColumn] identifier[cosc] operator[SEP] Keyword[try] {
identifier[cosc] operator[=] identifier[conn] operator[SEP] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[rowKey] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] , identifier[cp] , identifier[consistencyLevel] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NotFoundException] identifier[e] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[SuperColumn] identifier[thriftSuperColumn] operator[=] identifier[ThriftDataResultHelper] operator[SEP] identifier[transformThriftResult] operator[SEP] identifier[cosc] , identifier[ColumnFamilyType] operator[SEP] identifier[SUPER_COLUMN] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[thriftSuperColumn] operator[!=] Other[null] operator[&&] identifier[thriftSuperColumn] operator[SEP] identifier[getColumns] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[thriftSuperColumn] operator[SEP] identifier[getColumns] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[cp] operator[SEP] identifier[setColumn] operator[SEP] identifier[columnName] operator[SEP] operator[SEP]
}
identifier[conn] operator[SEP] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[rowKey] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] , identifier[cp] , identifier[generator] operator[SEP] identifier[getTimestamp] operator[SEP] operator[SEP] , identifier[consistencyLevel] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvalidRequestException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexingException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnavailableException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexingException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TimedOutException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexingException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexingException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[thriftClient] operator[SEP] identifier[releaseConnection] operator[SEP] identifier[conn] operator[SEP] operator[SEP]
}
}
|
public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
int i = 0;
Cell cell;
for (Object value : rowData) {
cell = row.createCell(i);
CellUtil.setCellValue(cell, value, styleSet, isHeader);
i++;
}
} | class class_name[name] begin[{]
method[writeRow, return_type[void], modifier[public static], parameter[row, rowData, styleSet, isHeader]] begin[{]
local_variable[type[int], i]
local_variable[type[Cell], cell]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createCell, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=styleSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setCellValue, postfix_operators=[], prefix_operators=[], qualifier=CellUtil, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rowData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeRow] operator[SEP] identifier[Row] identifier[row] , identifier[Iterable] operator[<] operator[?] operator[>] identifier[rowData] , identifier[StyleSet] identifier[styleSet] , Keyword[boolean] identifier[isHeader] operator[SEP] {
Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[Cell] identifier[cell] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[value] operator[:] identifier[rowData] operator[SEP] {
identifier[cell] operator[=] identifier[row] operator[SEP] identifier[createCell] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[CellUtil] operator[SEP] identifier[setCellValue] operator[SEP] identifier[cell] , identifier[value] , identifier[styleSet] , identifier[isHeader] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
}
|
public void marshall(PipelineIdName pipelineIdName, ProtocolMarshaller protocolMarshaller) {
if (pipelineIdName == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pipelineIdName.getId(), ID_BINDING);
protocolMarshaller.marshall(pipelineIdName.getName(), NAME_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[pipelineIdName, protocolMarshaller]] begin[{]
if[binary_operation[member[.pipelineIdName], ==, 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=getId, postfix_operators=[], prefix_operators=[], qualifier=pipelineIdName, selectors=[], type_arguments=None), MemberReference(member=ID_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=getName, postfix_operators=[], prefix_operators=[], qualifier=pipelineIdName, selectors=[], type_arguments=None), MemberReference(member=NAME_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[PipelineIdName] identifier[pipelineIdName] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[pipelineIdName] 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[pipelineIdName] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[pipelineIdName] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_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 void instrument(CtClass proxy, final SchemaPropertyRef ref) throws Exception {
final Schema schema = schemas.get(ref.getSchemaName());
checkNotNull(schema, "Schema not found for SchemaPropertyRef ["+ref+"]");
final String fieldName = ref.getFieldName();
// for help on javassist syntax, see chapter around javassist.expr.FieldAccess at
// http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/tutorial/tutorial2.html#before
proxy.instrument(new ExprEditor() {
public void edit(FieldAccess f) throws CannotCompileException {
if (f.getFieldName().equals(ref.getFieldName())) {
StringBuilder code = new StringBuilder();
code.append("{");
code.append("$_=("+schema.getType()+") this."+PROXY_FIELD_NAME+".getObjectReference(\""+fieldName+"\", \""+schema.getName()+"\");");
code.append("}");
f.replace(code.toString());
}
}
});
} | class class_name[name] begin[{]
method[instrument, return_type[void], modifier[private], parameter[proxy, ref]] begin[{]
local_variable[type[Schema], schema]
call[.checkNotNull, parameter[member[.schema], binary_operation[binary_operation[literal["Schema not found for SchemaPropertyRef ["], +, member[.ref]], +, literal["]"]]]]
local_variable[type[String], fieldName]
call[proxy.instrument, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[IfStatement(condition=MethodInvocation(arguments=[], member=getFieldName, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFieldName, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None)], 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=code)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="{")], member=append, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="$_=("), operandr=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") this."), operator=+), operandr=MemberReference(member=PROXY_FIELD_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".getObjectReference(\""), operator=+), operandr=MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\", \""), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\");"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="}")], member=append, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None)], member=replace, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=edit, parameters=[FormalParameter(annotations=[], modifiers=set(), name=f, type=ReferenceType(arguments=None, dimensions=[], name=FieldAccess, sub_type=None), varargs=False)], return_type=None, throws=['CannotCompileException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExprEditor, sub_type=None))]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[instrument] operator[SEP] identifier[CtClass] identifier[proxy] , Keyword[final] identifier[SchemaPropertyRef] identifier[ref] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[Schema] identifier[schema] operator[=] identifier[schemas] operator[SEP] identifier[get] operator[SEP] identifier[ref] operator[SEP] identifier[getSchemaName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[schema] , literal[String] operator[+] identifier[ref] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[fieldName] operator[=] identifier[ref] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] operator[SEP] identifier[proxy] operator[SEP] identifier[instrument] operator[SEP] Keyword[new] identifier[ExprEditor] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[edit] operator[SEP] identifier[FieldAccess] identifier[f] operator[SEP] Keyword[throws] identifier[CannotCompileException] {
Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[ref] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[code] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[code] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[schema] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[PROXY_FIELD_NAME] operator[+] literal[String] operator[+] identifier[fieldName] operator[+] literal[String] operator[+] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[code] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[replace] operator[SEP] identifier[code] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.