code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public Resource<T> setResource(T resource) {
return new Resource<>(resourceID, provider, resource, consumer);
} | class class_name[name] begin[{]
method[setResource, return_type[type[Resource]], modifier[public], parameter[resource]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=resourceID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=provider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Resource, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Resource] operator[<] identifier[T] operator[>] identifier[setResource] operator[SEP] identifier[T] identifier[resource] operator[SEP] {
Keyword[return] Keyword[new] identifier[Resource] operator[<] operator[>] operator[SEP] identifier[resourceID] , identifier[provider] , identifier[resource] , identifier[consumer] operator[SEP] operator[SEP]
}
|
public static String getProperty(Object bean, String fieldName, WriteConvertible writeConvertible)
throws Excel4JException {
if (bean == null || fieldName == null)
throw new IllegalArgumentException("Operating bean or filed class must not be null");
Method method;
Object object;
try {
method = getterOrSetter(bean.getClass(), fieldName, FieldAccessType.GETTER);
object = method.invoke(bean);
} catch (IntrospectionException | IllegalAccessException | InvocationTargetException e) {
throw new Excel4JException(e);
}
if (null != writeConvertible && writeConvertible.getClass() != DefaultConvertible.class) {
// 写入转换器
object = writeConvertible.execWrite(object);
}
return object == null ? "" : object.toString();
} | class class_name[name] begin[{]
method[getProperty, return_type[type[String]], modifier[public static], parameter[bean, fieldName, writeConvertible]] begin[{]
if[binary_operation[binary_operation[member[.bean], ==, literal[null]], ||, binary_operation[member[.fieldName], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Operating bean or filed class must not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Method], method]
local_variable[type[Object], object]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[], type_arguments=None), MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=GETTER, postfix_operators=[], prefix_operators=[], qualifier=FieldAccessType, selectors=[])], member=getterOrSetter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Excel4JException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IntrospectionException', 'IllegalAccessException', 'InvocationTargetException']))], finally_block=None, label=None, resources=None)
if[binary_operation[binary_operation[literal[null], !=, member[.writeConvertible]], &&, binary_operation[call[writeConvertible.getClass, parameter[]], !=, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultConvertible, sub_type=None))]]] begin[{]
assign[member[.object], call[writeConvertible.execWrite, parameter[member[.object]]]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getProperty] operator[SEP] identifier[Object] identifier[bean] , identifier[String] identifier[fieldName] , identifier[WriteConvertible] identifier[writeConvertible] operator[SEP] Keyword[throws] identifier[Excel4JException] {
Keyword[if] operator[SEP] identifier[bean] operator[==] Other[null] operator[||] identifier[fieldName] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Method] identifier[method] operator[SEP] identifier[Object] identifier[object] operator[SEP] Keyword[try] {
identifier[method] operator[=] identifier[getterOrSetter] operator[SEP] identifier[bean] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[fieldName] , identifier[FieldAccessType] operator[SEP] identifier[GETTER] operator[SEP] operator[SEP] identifier[object] operator[=] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[bean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IntrospectionException] operator[|] identifier[IllegalAccessException] operator[|] identifier[InvocationTargetException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Excel4JException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[writeConvertible] operator[&&] identifier[writeConvertible] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[!=] identifier[DefaultConvertible] operator[SEP] Keyword[class] operator[SEP] {
identifier[object] operator[=] identifier[writeConvertible] operator[SEP] identifier[execWrite] operator[SEP] identifier[object] operator[SEP] operator[SEP]
}
Keyword[return] identifier[object] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[object] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Vector2d rotate(double x, double y) {
final double length = length();
if (Math.abs(length) < GenericMath.DBL_EPSILON) {
throw new ArithmeticException("Cannot rotate by the zero complex");
}
final double nx = this.x / length;
final double ny = this.y / length;
return new Vector2d(x * nx - y * ny, y * nx + x * ny);
} | class class_name[name] begin[{]
method[rotate, return_type[type[Vector2d]], modifier[public], parameter[x, y]] begin[{]
local_variable[type[double], length]
if[binary_operation[call[Math.abs, parameter[member[.length]]], <, member[GenericMath.DBL_EPSILON]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot rotate by the zero complex")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArithmeticException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[double], nx]
local_variable[type[double], ny]
return[ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ny, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=-), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ny, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Vector2d, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Vector2d] identifier[rotate] operator[SEP] Keyword[double] identifier[x] , Keyword[double] identifier[y] operator[SEP] {
Keyword[final] Keyword[double] identifier[length] operator[=] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[length] operator[SEP] operator[<] identifier[GenericMath] operator[SEP] identifier[DBL_EPSILON] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArithmeticException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[double] identifier[nx] operator[=] Keyword[this] operator[SEP] identifier[x] operator[/] identifier[length] operator[SEP] Keyword[final] Keyword[double] identifier[ny] operator[=] Keyword[this] operator[SEP] identifier[y] operator[/] identifier[length] operator[SEP] Keyword[return] Keyword[new] identifier[Vector2d] operator[SEP] identifier[x] operator[*] identifier[nx] operator[-] identifier[y] operator[*] identifier[ny] , identifier[y] operator[*] identifier[nx] operator[+] identifier[x] operator[*] identifier[ny] operator[SEP] operator[SEP]
}
|
@Override
public void makeAccessible(AccessibleObject ao) {
boolean success = makeAccessibleWithUnsafe(ao);
if (!success) {
try {
// unsafe couldn't be found, so try using accessible anyway
ao.setAccessible(true);
} catch (SecurityException e) {
throw new JsonIOException("Gson couldn't modify fields for " + ao
+ "\nand sun.misc.Unsafe not found.\nEither write a custom type adapter,"
+ " or make fields accessible, or include sun.misc.Unsafe.", e);
}
}
} | class class_name[name] begin[{]
method[makeAccessible, return_type[void], modifier[public], parameter[ao]] begin[{]
local_variable[type[boolean], success]
if[member[.success]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=ao, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Gson couldn't modify fields for "), operandr=MemberReference(member=ao, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nand sun.misc.Unsafe not found.\nEither write a custom type adapter,"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" or make fields accessible, or include sun.misc.Unsafe."), 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=JsonIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[makeAccessible] operator[SEP] identifier[AccessibleObject] identifier[ao] operator[SEP] {
Keyword[boolean] identifier[success] operator[=] identifier[makeAccessibleWithUnsafe] operator[SEP] identifier[ao] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[success] operator[SEP] {
Keyword[try] {
identifier[ao] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JsonIOException] operator[SEP] literal[String] operator[+] identifier[ao] operator[+] literal[String] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public final String getValue() {
final StringBuilder b = new StringBuilder();
if (getMinVersion() != null) {
b.append(getMinVersion());
if (getMaxVersion() != null) {
b.append(';');
}
}
if (getMaxVersion() != null) {
b.append(getMaxVersion());
}
return b.toString();
} | class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[final public], parameter[]] begin[{]
local_variable[type[StringBuilder], b]
if[binary_operation[call[.getMinVersion, parameter[]], !=, literal[null]]] begin[{]
call[b.append, parameter[call[.getMinVersion, parameter[]]]]
if[binary_operation[call[.getMaxVersion, parameter[]], !=, literal[null]]] begin[{]
call[b.append, parameter[literal[';']]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[.getMaxVersion, parameter[]], !=, literal[null]]] begin[{]
call[b.append, parameter[call[.getMaxVersion, parameter[]]]]
else begin[{]
None
end[}]
return[call[b.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[String] identifier[getValue] operator[SEP] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[b] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getMinVersion] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[b] operator[SEP] identifier[append] operator[SEP] identifier[getMinVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getMaxVersion] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[b] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[getMaxVersion] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[b] operator[SEP] identifier[append] operator[SEP] identifier[getMaxVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[b] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public Map<String, Object> downloadPayload(String path) {
try (InputStream inputStream = externalPayloadStorage.download(path)) {
return objectMapper.readValue(IOUtils.toString(inputStream), Map.class);
} catch (IOException e) {
logger.error("Unable to download payload from external storage path: {}", path, e);
throw new ApplicationException(ApplicationException.Code.INTERNAL_ERROR, e);
}
} | class class_name[name] begin[{]
method[downloadPayload, return_type[type[Map]], modifier[public], parameter[path]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Map, sub_type=None))], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to download payload from external storage path: {}"), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=ApplicationException.Code, 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=ApplicationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=inputStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=download, postfix_operators=[], prefix_operators=[], qualifier=externalPayloadStorage, selectors=[], type_arguments=None))])
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[downloadPayload] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[inputStream] operator[=] identifier[externalPayloadStorage] operator[SEP] identifier[download] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] identifier[objectMapper] operator[SEP] identifier[readValue] operator[SEP] identifier[IOUtils] operator[SEP] identifier[toString] operator[SEP] identifier[inputStream] operator[SEP] , identifier[Map] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[path] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ApplicationException] operator[SEP] identifier[ApplicationException] operator[SEP] identifier[Code] operator[SEP] identifier[INTERNAL_ERROR] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected void handleOutParams(List<Param> paramList, final CallableStatement cs, Object parameter,
boolean functionCall) {
if (parameter == null){
return;
}
try {
final int start = functionCall ? 1 : 0;
for (int i = start; i < paramList.size(); i++) {
final Param param = paramList.get(i);
if (param.paramType == ParameterType.IN) {
continue;
}
PropertyDesc pd = param.propertyDesc;
@SuppressWarnings("unchecked")
Object value = param.valueType.get(param.paramClass, cs, i + 1);
if (value instanceof ResultSet) {
value = handleResultSet(pd, (ResultSet) value);
}
pd.setValue(parameter, value);
}
} catch (final SQLException e) {
throw new SQLRuntimeException(e);
}
} | class class_name[name] begin[{]
method[handleOutParams, return_type[void], modifier[protected], parameter[paramList, cs, parameter, functionCall]] begin[{]
if[binary_operation[member[.parameter], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MemberReference(member=functionCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), name=start)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=paramList, selectors=[], type_arguments=None), name=param)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Param, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=paramType, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), operandr=MemberReference(member=IN, postfix_operators=[], prefix_operators=[], qualifier=ParameterType, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=propertyDesc, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), name=pd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyDesc, sub_type=None)), LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=paramClass, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), MemberReference(member=cs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=param.valueType, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None))], member=handleResultSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=pd, 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=paramList, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[handleOutParams] operator[SEP] identifier[List] operator[<] identifier[Param] operator[>] identifier[paramList] , Keyword[final] identifier[CallableStatement] identifier[cs] , identifier[Object] identifier[parameter] , Keyword[boolean] identifier[functionCall] operator[SEP] {
Keyword[if] operator[SEP] identifier[parameter] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[try] {
Keyword[final] Keyword[int] identifier[start] operator[=] identifier[functionCall] operator[?] Other[1] operator[:] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[start] operator[SEP] identifier[i] operator[<] identifier[paramList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[Param] identifier[param] operator[=] identifier[paramList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[param] operator[SEP] identifier[paramType] operator[==] identifier[ParameterType] operator[SEP] identifier[IN] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[PropertyDesc] identifier[pd] operator[=] identifier[param] operator[SEP] identifier[propertyDesc] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Object] identifier[value] operator[=] identifier[param] operator[SEP] identifier[valueType] operator[SEP] identifier[get] operator[SEP] identifier[param] operator[SEP] identifier[paramClass] , identifier[cs] , identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[ResultSet] operator[SEP] {
identifier[value] operator[=] identifier[handleResultSet] operator[SEP] identifier[pd] , operator[SEP] identifier[ResultSet] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
identifier[pd] operator[SEP] identifier[setValue] operator[SEP] identifier[parameter] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Variable relation, Variable edge, Variable rolePlayer, @Nullable Variable role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) {
return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels);
} | class class_name[name] begin[{]
method[rolePlayer, return_type[type[EquivalentFragmentSet]], modifier[public static], parameter[varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=varProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=edge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rolePlayer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=roleLabels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relTypeLabels, 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=AutoValue_RolePlayerFragmentSet, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[EquivalentFragmentSet] identifier[rolePlayer] operator[SEP] identifier[VarProperty] identifier[varProperty] , identifier[Variable] identifier[relation] , identifier[Variable] identifier[edge] , identifier[Variable] identifier[rolePlayer] , annotation[@] identifier[Nullable] identifier[Variable] identifier[role] , annotation[@] identifier[Nullable] identifier[ImmutableSet] operator[<] identifier[Label] operator[>] identifier[roleLabels] , annotation[@] identifier[Nullable] identifier[ImmutableSet] operator[<] identifier[Label] operator[>] identifier[relTypeLabels] operator[SEP] {
Keyword[return] Keyword[new] identifier[AutoValue_RolePlayerFragmentSet] operator[SEP] identifier[varProperty] , identifier[relation] , identifier[edge] , identifier[rolePlayer] , identifier[role] , identifier[roleLabels] , identifier[relTypeLabels] operator[SEP] operator[SEP]
}
|
public static int cuModuleLoadDataEx(CUmodule phMod, String string, int numOptions, int options[], Pointer optionValues)
{
byte bytes[] = string.getBytes();
byte image[] = Arrays.copyOf(bytes, bytes.length+1);
return cuModuleLoadDataEx(phMod, Pointer.to(image), numOptions, options, optionValues);
} | class class_name[name] begin[{]
method[cuModuleLoadDataEx, return_type[type[int]], modifier[public static], parameter[phMod, string, numOptions, options, optionValues]] begin[{]
local_variable[type[byte], bytes]
local_variable[type[byte], image]
return[call[.cuModuleLoadDataEx, parameter[member[.phMod], call[Pointer.to, parameter[member[.image]]], member[.numOptions], member[.options], member[.optionValues]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[cuModuleLoadDataEx] operator[SEP] identifier[CUmodule] identifier[phMod] , identifier[String] identifier[string] , Keyword[int] identifier[numOptions] , Keyword[int] identifier[options] operator[SEP] operator[SEP] , identifier[Pointer] identifier[optionValues] operator[SEP] {
Keyword[byte] identifier[bytes] operator[SEP] operator[SEP] operator[=] identifier[string] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] identifier[image] operator[SEP] operator[SEP] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[bytes] , identifier[bytes] operator[SEP] identifier[length] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[cuModuleLoadDataEx] operator[SEP] identifier[phMod] , identifier[Pointer] operator[SEP] identifier[to] operator[SEP] identifier[image] operator[SEP] , identifier[numOptions] , identifier[options] , identifier[optionValues] operator[SEP] operator[SEP]
}
|
private LogoutFilter createLogoutFilter(H http) throws Exception {
logoutHandlers.add(contextLogoutHandler);
LogoutHandler[] handlers = logoutHandlers
.toArray(new LogoutHandler[logoutHandlers.size()]);
LogoutFilter result = new LogoutFilter(getLogoutSuccessHandler(), handlers);
result.setLogoutRequestMatcher(getLogoutRequestMatcher(http));
result = postProcess(result);
return result;
} | class class_name[name] begin[{]
method[createLogoutFilter, return_type[type[LogoutFilter]], modifier[private], parameter[http]] begin[{]
call[logoutHandlers.add, parameter[member[.contextLogoutHandler]]]
local_variable[type[LogoutHandler], handlers]
local_variable[type[LogoutFilter], result]
call[result.setLogoutRequestMatcher, parameter[call[.getLogoutRequestMatcher, parameter[member[.http]]]]]
assign[member[.result], call[.postProcess, parameter[member[.result]]]]
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[LogoutFilter] identifier[createLogoutFilter] operator[SEP] identifier[H] identifier[http] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[logoutHandlers] operator[SEP] identifier[add] operator[SEP] identifier[contextLogoutHandler] operator[SEP] operator[SEP] identifier[LogoutHandler] operator[SEP] operator[SEP] identifier[handlers] operator[=] identifier[logoutHandlers] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[LogoutHandler] operator[SEP] identifier[logoutHandlers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LogoutFilter] identifier[result] operator[=] Keyword[new] identifier[LogoutFilter] operator[SEP] identifier[getLogoutSuccessHandler] operator[SEP] operator[SEP] , identifier[handlers] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setLogoutRequestMatcher] operator[SEP] identifier[getLogoutRequestMatcher] operator[SEP] identifier[http] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[postProcess] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T extends Example> T[] asArray( T example )
{
List<Example> examples = asList( example );
T[] array = (T[]) Array.newInstance( example.getClass(), examples.size() );
return examples.toArray( array );
} | class class_name[name] begin[{]
method[asArray, return_type[type[T]], modifier[public static], parameter[example]] begin[{]
local_variable[type[List], examples]
local_variable[type[T], array]
return[call[examples.toArray, parameter[member[.array]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Example] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[asArray] operator[SEP] identifier[T] identifier[example] operator[SEP] {
identifier[List] operator[<] identifier[Example] operator[>] identifier[examples] operator[=] identifier[asList] operator[SEP] identifier[example] operator[SEP] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[Array] operator[SEP] identifier[newInstance] operator[SEP] identifier[example] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[examples] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[examples] operator[SEP] identifier[toArray] operator[SEP] identifier[array] operator[SEP] operator[SEP]
}
|
public StartJobRunRequest withArguments(java.util.Map<String, String> arguments) {
setArguments(arguments);
return this;
} | class class_name[name] begin[{]
method[withArguments, return_type[type[StartJobRunRequest]], modifier[public], parameter[arguments]] begin[{]
call[.setArguments, parameter[member[.arguments]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[StartJobRunRequest] identifier[withArguments] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[arguments] operator[SEP] {
identifier[setArguments] operator[SEP] identifier[arguments] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static DynamicClassLoader getDynamicClassLoader(ClassLoader loader)
{
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof DynamicClassLoader) {
return (DynamicClassLoader) loader;
}
}
return null;
} | class class_name[name] begin[{]
method[getDynamicClassLoader, return_type[type[DynamicClassLoader]], modifier[public static], parameter[loader]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DynamicClassLoader, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DynamicClassLoader, sub_type=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=None, update=[Assignment(expressionl=MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=loader, selectors=[], type_arguments=None))]), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DynamicClassLoader] identifier[getDynamicClassLoader] operator[SEP] identifier[ClassLoader] identifier[loader] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] identifier[loader] operator[!=] Other[null] operator[SEP] identifier[loader] operator[=] identifier[loader] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[loader] Keyword[instanceof] identifier[DynamicClassLoader] operator[SEP] {
Keyword[return] operator[SEP] identifier[DynamicClassLoader] operator[SEP] identifier[loader] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public DeleteActivationResult deleteActivation(DeleteActivationRequest request) {
request = beforeClientExecution(request);
return executeDeleteActivation(request);
} | class class_name[name] begin[{]
method[deleteActivation, return_type[type[DeleteActivationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteActivation, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteActivationResult] identifier[deleteActivation] operator[SEP] identifier[DeleteActivationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteActivation] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static Object getByXPath(String expression, Object source, QName returnType) {
final XPath xPath = createXPath();
try {
if (source instanceof InputSource) {
return xPath.evaluate(expression, (InputSource) source, returnType);
} else {
return xPath.evaluate(expression, source, returnType);
}
} catch (XPathExpressionException e) {
throw new UtilException(e);
}
} | class class_name[name] begin[{]
method[getByXPath, return_type[type[Object]], modifier[public static], parameter[expression, source, returnType]] begin[{]
local_variable[type[XPath], xPath]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=InputSource, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=expression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=evaluate, postfix_operators=[], prefix_operators=[], qualifier=xPath, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=expression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InputSource, sub_type=None)), MemberReference(member=returnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=evaluate, postfix_operators=[], prefix_operators=[], qualifier=xPath, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UtilException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['XPathExpressionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[getByXPath] operator[SEP] identifier[String] identifier[expression] , identifier[Object] identifier[source] , identifier[QName] identifier[returnType] operator[SEP] {
Keyword[final] identifier[XPath] identifier[xPath] operator[=] identifier[createXPath] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[source] Keyword[instanceof] identifier[InputSource] operator[SEP] {
Keyword[return] identifier[xPath] operator[SEP] identifier[evaluate] operator[SEP] identifier[expression] , operator[SEP] identifier[InputSource] operator[SEP] identifier[source] , identifier[returnType] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[xPath] operator[SEP] identifier[evaluate] operator[SEP] identifier[expression] , identifier[source] , identifier[returnType] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[XPathExpressionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UtilException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String convertToHumanFriendlyByteSize(long size) {
if (size < 1024) {
return size + " B";
}
int z = (63 - Long.numberOfLeadingZeros(size)) / 10;
double d = (double)size / (1L << (z * 10));
String format = (d % 1.0 == 0) ? "%.0f %sB" : "%.1f %sB";
return String.format(format, d, " KMGTPE".charAt(z));
} | class class_name[name] begin[{]
method[convertToHumanFriendlyByteSize, return_type[type[String]], modifier[public static], parameter[size]] begin[{]
if[binary_operation[member[.size], <, literal[1024]]] begin[{]
return[binary_operation[member[.size], +, literal[" B"]]]
else begin[{]
None
end[}]
local_variable[type[int], z]
local_variable[type[double], d]
local_variable[type[String], format]
return[call[String.format, parameter[member[.format], member[.d], literal[" KMGTPE"]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[convertToHumanFriendlyByteSize] operator[SEP] Keyword[long] identifier[size] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[<] Other[1024] operator[SEP] {
Keyword[return] identifier[size] operator[+] literal[String] operator[SEP]
}
Keyword[int] identifier[z] operator[=] operator[SEP] Other[63] operator[-] identifier[Long] operator[SEP] identifier[numberOfLeadingZeros] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[/] Other[10] operator[SEP] Keyword[double] identifier[d] operator[=] operator[SEP] Keyword[double] operator[SEP] identifier[size] operator[/] operator[SEP] Other[1L] operator[<<] operator[SEP] identifier[z] operator[*] Other[10] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[format] operator[=] operator[SEP] identifier[d] operator[%] literal[Float] operator[==] Other[0] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[format] , identifier[d] , literal[String] operator[SEP] identifier[charAt] operator[SEP] identifier[z] operator[SEP] operator[SEP] operator[SEP]
}
|
public static BigFloat min(BigFloat value1, BigFloat value2) {
return value1.compareTo(value2) < 0 ? value1 : value2;
} | class class_name[name] begin[{]
method[min, return_type[type[BigFloat]], modifier[public static], parameter[value1, value2]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=value2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=value1, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=value2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=value1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigFloat] identifier[min] operator[SEP] identifier[BigFloat] identifier[value1] , identifier[BigFloat] identifier[value2] operator[SEP] {
Keyword[return] identifier[value1] operator[SEP] identifier[compareTo] operator[SEP] identifier[value2] operator[SEP] operator[<] Other[0] operator[?] identifier[value1] operator[:] identifier[value2] operator[SEP]
}
|
public static Shell createConsoleShell(String prompt, String appName, Object mainHandler) {
return createConsoleShell(prompt, appName, mainHandler, new EmptyMultiMap<String, Object>());
} | class class_name[name] begin[{]
method[createConsoleShell, return_type[type[Shell]], modifier[public static], parameter[prompt, appName, mainHandler]] begin[{]
return[call[.createConsoleShell, parameter[member[.prompt], member[.appName], member[.mainHandler], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=EmptyMultiMap, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Shell] identifier[createConsoleShell] operator[SEP] identifier[String] identifier[prompt] , identifier[String] identifier[appName] , identifier[Object] identifier[mainHandler] operator[SEP] {
Keyword[return] identifier[createConsoleShell] operator[SEP] identifier[prompt] , identifier[appName] , identifier[mainHandler] , Keyword[new] identifier[EmptyMultiMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T insertObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.insertObject(c, object));
} | class class_name[name] begin[{]
method[insertObject, return_type[type[T]], modifier[public static], parameter[object]] begin[{]
return[call[SqlClosure.sqlExecute, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insertObject, postfix_operators=[], prefix_operators=[], qualifier=OrmElf, selectors=[], type_arguments=None), parameters=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[insertObject] operator[SEP] identifier[T] identifier[object] operator[SEP] {
Keyword[return] identifier[SqlClosure] operator[SEP] identifier[sqlExecute] operator[SEP] identifier[c] operator[->] identifier[OrmElf] operator[SEP] identifier[insertObject] operator[SEP] identifier[c] , identifier[object] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Object getValue(ELContext context, Object base, Object property) {
if (base instanceof Collection) {
return this.resolveInCollection(context, (Collection) base, property);
} else if (base instanceof Map) {
return this.resolveInMap(context, (Map) base, property);
} else if (DATA_MODEL.isInstance(base)) {
return this.resolveInDataModel(context, base, property);
} else if (base != null) {
return this.resolveNoArgMethod(context, base, property.toString());
}
return null;
} | class class_name[name] begin[{]
method[getValue, return_type[type[Object]], modifier[public], parameter[context, base, property]] begin[{]
if[binary_operation[member[.base], instanceof, type[Collection]]] begin[{]
return[THIS[call[None.resolveInCollection, parameter[member[.context], Cast(expression=MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Collection, sub_type=None)), member[.property]]]]]
else begin[{]
if[binary_operation[member[.base], instanceof, type[Map]]] begin[{]
return[THIS[call[None.resolveInMap, parameter[member[.context], Cast(expression=MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=None)), member[.property]]]]]
else begin[{]
if[call[DATA_MODEL.isInstance, parameter[member[.base]]]] begin[{]
return[THIS[call[None.resolveInDataModel, parameter[member[.context], member[.base], member[.property]]]]]
else begin[{]
if[binary_operation[member[.base], !=, literal[null]]] begin[{]
return[THIS[call[None.resolveNoArgMethod, parameter[member[.context], member[.base], call[property.toString, parameter[]]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[getValue] operator[SEP] identifier[ELContext] identifier[context] , identifier[Object] identifier[base] , identifier[Object] identifier[property] operator[SEP] {
Keyword[if] operator[SEP] identifier[base] Keyword[instanceof] identifier[Collection] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[resolveInCollection] operator[SEP] identifier[context] , operator[SEP] identifier[Collection] operator[SEP] identifier[base] , identifier[property] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[base] Keyword[instanceof] identifier[Map] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[resolveInMap] operator[SEP] identifier[context] , operator[SEP] identifier[Map] operator[SEP] identifier[base] , identifier[property] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[DATA_MODEL] operator[SEP] identifier[isInstance] operator[SEP] identifier[base] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[resolveInDataModel] operator[SEP] identifier[context] , identifier[base] , identifier[property] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[base] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[resolveNoArgMethod] operator[SEP] identifier[context] , identifier[base] , identifier[property] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected static double subtractedMagnitudeSqrd(DoubleVector c,
DoubleVector v) {
if (v instanceof SparseDoubleVector) {
SparseDoubleVector sv = (SparseDoubleVector) v;
int[] nonZeros = sv.getNonZeroIndices();
double magnitude = Math.pow(c.magnitude(), 2);
for (int i : nonZeros) {
double value = c.get(i);
magnitude -= Math.pow(value, 2);
magnitude += Math.pow(value - v.get(i), 2);
}
return magnitude;
} else {
double magnitude = 0;
for (int i = 0; i < c.length(); ++i)
magnitude += Math.pow(c.get(i) - v.get(i), 2);
return magnitude;
}
} | class class_name[name] begin[{]
method[subtractedMagnitudeSqrd, return_type[type[double]], modifier[static protected], parameter[c, v]] begin[{]
if[binary_operation[member[.v], instanceof, type[SparseDoubleVector]]] begin[{]
local_variable[type[SparseDoubleVector], sv]
local_variable[type[int], nonZeros]
local_variable[type[double], magnitude]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=magnitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=-=, value=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=magnitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), operator=-), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nonZeros, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
return[member[.magnitude]]
else begin[{]
local_variable[type[double], magnitude]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=magnitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), operator=-), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.magnitude]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[double] identifier[subtractedMagnitudeSqrd] operator[SEP] identifier[DoubleVector] identifier[c] , identifier[DoubleVector] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[v] Keyword[instanceof] identifier[SparseDoubleVector] operator[SEP] {
identifier[SparseDoubleVector] identifier[sv] operator[=] operator[SEP] identifier[SparseDoubleVector] operator[SEP] identifier[v] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[nonZeros] operator[=] identifier[sv] operator[SEP] identifier[getNonZeroIndices] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[magnitude] operator[=] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[c] operator[SEP] identifier[magnitude] operator[SEP] operator[SEP] , Other[2] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[:] identifier[nonZeros] operator[SEP] {
Keyword[double] identifier[value] operator[=] identifier[c] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[magnitude] operator[-=] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[value] , Other[2] operator[SEP] operator[SEP] identifier[magnitude] operator[+=] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[value] operator[-] identifier[v] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , Other[2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[magnitude] operator[SEP]
}
Keyword[else] {
Keyword[double] identifier[magnitude] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[c] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] identifier[magnitude] operator[+=] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[c] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[v] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , Other[2] operator[SEP] operator[SEP] Keyword[return] identifier[magnitude] operator[SEP]
}
}
|
@NonNull
public ListenerToken addChangeListener(Executor executor, @NonNull DatabaseChangeListener listener) {
if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }
synchronized (lock) {
mustBeOpen();
return addDatabaseChangeListener(executor, listener);
}
} | class class_name[name] begin[{]
method[addChangeListener, return_type[type[ListenerToken]], modifier[public], parameter[executor, listener]] begin[{]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="listener cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
SYNCHRONIZED[member[.lock]] BEGIN[{]
call[.mustBeOpen, parameter[]]
return[call[.addDatabaseChangeListener, parameter[member[.executor], member[.listener]]]]
END[}]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] identifier[ListenerToken] identifier[addChangeListener] operator[SEP] identifier[Executor] identifier[executor] , annotation[@] identifier[NonNull] identifier[DatabaseChangeListener] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
identifier[mustBeOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[addDatabaseChangeListener] operator[SEP] identifier[executor] , identifier[listener] operator[SEP] operator[SEP]
}
}
|
@Override
public final void narExecute() throws MojoExecutionException, MojoFailureException {
// let the layout decide which nars to attach
getLayout().attachNars(getTargetDirectory(), this.archiverManager, this.projectHelper, getMavenProject());
} | class class_name[name] begin[{]
method[narExecute, return_type[void], modifier[final public], parameter[]] begin[{]
call[.getLayout, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[narExecute] operator[SEP] operator[SEP] Keyword[throws] identifier[MojoExecutionException] , identifier[MojoFailureException] {
identifier[getLayout] operator[SEP] operator[SEP] operator[SEP] identifier[attachNars] operator[SEP] identifier[getTargetDirectory] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[archiverManager] , Keyword[this] operator[SEP] identifier[projectHelper] , identifier[getMavenProject] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> wrap(ObservableSource<T> source) {
ObjectHelper.requireNonNull(source, "source is null");
if (source instanceof Observable) {
return RxJavaPlugins.onAssembly((Observable<T>)source);
}
return RxJavaPlugins.onAssembly(new ObservableFromUnsafeSource<T>(source));
} | class class_name[name] begin[{]
method[wrap, return_type[type[Observable]], modifier[public static], parameter[source]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.source], literal["source is null"]]]
if[binary_operation[member[.source], instanceof, type[Observable]]] begin[{]
return[call[RxJavaPlugins.onAssembly, parameter[Cast(expression=MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Observable, sub_type=None))]]]
else begin[{]
None
end[}]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=ObservableFromUnsafeSource, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Observable] operator[<] identifier[T] operator[>] identifier[wrap] operator[SEP] identifier[ObservableSource] operator[<] identifier[T] operator[>] identifier[source] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[source] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[source] Keyword[instanceof] identifier[Observable] operator[SEP] {
Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[T] operator[>] operator[SEP] identifier[source] operator[SEP] operator[SEP]
}
Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[ObservableFromUnsafeSource] operator[<] identifier[T] operator[>] operator[SEP] identifier[source] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void checkSurefirePlugin(Plugin plugin, String[] nonSupportedVersions, String minSupported) throws MojoExecutionException {
// Check if plugin is available.
if (plugin == null) {
throw new MojoExecutionException("Surefire plugin not avaialble");
}
String version = plugin.getVersion();
for (String nonSupportedVersion : nonSupportedVersions) {
if (version.equals(nonSupportedVersion)) {
throw new MojoExecutionException("Not supported surefire version; version has to be " + minSupported + " or higher");
}
}
} | class class_name[name] begin[{]
method[checkSurefirePlugin, return_type[void], modifier[protected], parameter[plugin, nonSupportedVersions, minSupported]] begin[{]
if[binary_operation[member[.plugin], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Surefire plugin not avaialble")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MojoExecutionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], version]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=nonSupportedVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not supported surefire version; version has to be "), operandr=MemberReference(member=minSupported, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" or higher"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MojoExecutionException, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=nonSupportedVersions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=nonSupportedVersion)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[checkSurefirePlugin] operator[SEP] identifier[Plugin] identifier[plugin] , identifier[String] operator[SEP] operator[SEP] identifier[nonSupportedVersions] , identifier[String] identifier[minSupported] operator[SEP] Keyword[throws] identifier[MojoExecutionException] {
Keyword[if] operator[SEP] identifier[plugin] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[version] operator[=] identifier[plugin] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[nonSupportedVersion] operator[:] identifier[nonSupportedVersions] operator[SEP] {
Keyword[if] operator[SEP] identifier[version] operator[SEP] identifier[equals] operator[SEP] identifier[nonSupportedVersion] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[+] identifier[minSupported] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
private static RetryDeterminer<IOException> createSocketErrorRetryDeterminer(
final ApiErrorExtractor errorExtractor) {
return new RetryDeterminer<IOException>() {
@Override
public boolean shouldRetry(IOException e) {
return errorExtractor.socketError(e);
}
};
} | class class_name[name] begin[{]
method[createSocketErrorRetryDeterminer, return_type[type[RetryDeterminer]], modifier[private static], parameter[errorExtractor]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=socketError, postfix_operators=[], prefix_operators=[], qualifier=errorExtractor, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=shouldRetry, parameters=[FormalParameter(annotations=[], modifiers=set(), name=e, type=ReferenceType(arguments=None, dimensions=[], name=IOException, 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=IOException, sub_type=None))], dimensions=None, name=RetryDeterminer, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[RetryDeterminer] operator[<] identifier[IOException] operator[>] identifier[createSocketErrorRetryDeterminer] operator[SEP] Keyword[final] identifier[ApiErrorExtractor] identifier[errorExtractor] operator[SEP] {
Keyword[return] Keyword[new] identifier[RetryDeterminer] operator[<] identifier[IOException] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[shouldRetry] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[return] identifier[errorExtractor] operator[SEP] identifier[socketError] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public Catalog makeCatalog() {
setServices(getDatasets());
Map<String, Object> flds = setFields();
return new Catalog(baseURI, name, flds, datasetBuilders);
} | class class_name[name] begin[{]
method[makeCatalog, return_type[type[Catalog]], modifier[public], parameter[]] begin[{]
call[.setServices, parameter[call[.getDatasets, parameter[]]]]
local_variable[type[Map], flds]
return[ClassCreator(arguments=[MemberReference(member=baseURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=flds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=datasetBuilders, 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=Catalog, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Catalog] identifier[makeCatalog] operator[SEP] operator[SEP] {
identifier[setServices] operator[SEP] identifier[getDatasets] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[flds] operator[=] identifier[setFields] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Catalog] operator[SEP] identifier[baseURI] , identifier[name] , identifier[flds] , identifier[datasetBuilders] operator[SEP] operator[SEP]
}
|
public static IStandardCSSSerializer getCSSSerializer(final IEngineConfiguration configuration) {
final Object serializer =
configuration.getExecutionAttributes().get(STANDARD_CSS_SERIALIZER_ATTRIBUTE_NAME);
if (serializer == null || (!(serializer instanceof IStandardCSSSerializer))) {
throw new TemplateProcessingException(
"No CSS Serializer has been registered as an execution argument. " +
"This is a requirement for using Standard serialization, and might happen " +
"if neither the Standard or the SpringStandard dialects have " +
"been added to the Template Engine and none of the specified dialects registers an " +
"attribute of type " + IStandardCSSSerializer.class.getName() + " with name " +
"\"" + STANDARD_CSS_SERIALIZER_ATTRIBUTE_NAME + "\"");
}
return (IStandardCSSSerializer) serializer;
} | class class_name[name] begin[{]
method[getCSSSerializer, return_type[type[IStandardCSSSerializer]], modifier[public static], parameter[configuration]] begin[{]
local_variable[type[Object], serializer]
if[binary_operation[binary_operation[member[.serializer], ==, literal[null]], ||, binary_operation[member[.serializer], instanceof, type[IStandardCSSSerializer]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[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="No CSS Serializer has been registered as an execution argument. "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This is a requirement for using Standard serialization, and might happen "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="if neither the Standard or the SpringStandard dialects have "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="been added to the Template Engine and none of the specified dialects registers an "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attribute of type "), operator=+), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=IStandardCSSSerializer, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" with name "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+), operandr=MemberReference(member=STANDARD_CSS_SERIALIZER_ATTRIBUTE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TemplateProcessingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=serializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IStandardCSSSerializer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[IStandardCSSSerializer] identifier[getCSSSerializer] operator[SEP] Keyword[final] identifier[IEngineConfiguration] identifier[configuration] operator[SEP] {
Keyword[final] identifier[Object] identifier[serializer] operator[=] identifier[configuration] operator[SEP] identifier[getExecutionAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[STANDARD_CSS_SERIALIZER_ATTRIBUTE_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serializer] operator[==] Other[null] operator[||] operator[SEP] operator[!] operator[SEP] identifier[serializer] Keyword[instanceof] identifier[IStandardCSSSerializer] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TemplateProcessingException] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[IStandardCSSSerializer] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[STANDARD_CSS_SERIALIZER_ATTRIBUTE_NAME] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[IStandardCSSSerializer] operator[SEP] identifier[serializer] operator[SEP]
}
|
private double[] addGaussianLatAxis(NetcdfFile ncfile, String name,
String units, String desc, String standard_name, AxisType axis) {
double np = gds.getDouble(GridDefRecord.NUMBERPARALLELS);
if (Double.isNaN(np)) np = gds.getDouble("Np");
if (Double.isNaN(np))
throw new IllegalArgumentException( "Gaussian Lat/Lon grid must have 'NumberParallels' or 'Np' (number of parallels) parameter");
double startLat = gds.getDouble(GridDefRecord.LA1);
double endLat = gds.getDouble(GridDefRecord.LA2);
int nlats = (int) (2 * np);
GaussianLatitudes gaussLats = GaussianLatitudes.factory(nlats);
int bestStartIndex = 0, bestEndIndex = 0;
double bestStartDiff = Double.MAX_VALUE;
double bestEndDiff = Double.MAX_VALUE;
for (int i = 0; i < nlats; i++) {
double diff = Math.abs(gaussLats.latd[i] - startLat);
if (diff < bestStartDiff) {
bestStartDiff = diff;
bestStartIndex = i;
}
diff = Math.abs(gaussLats.latd[i] - endLat);
if (diff < bestEndDiff) {
bestEndDiff = diff;
bestEndIndex = i;
}
}
int ny = gds.getInt(GridDefRecord.NY);
if (Math.abs(bestEndIndex - bestStartIndex + 1) != ny) {
log.warn("GRIB gaussian lats: NP != NY, use NY"); // see email from Toussaint@dkrz.de datafil:
nlats = ny;
gaussLats = GaussianLatitudes.factory(nlats);
bestStartIndex = 0;
bestEndIndex = ny-1;
}
boolean goesUp = bestEndIndex > bestStartIndex;
Variable v = new Variable(ncfile, g, null, name);
v.setDataType(DataType.DOUBLE);
v.setDimensions(name);
// create the data
int useIndex = bestStartIndex;
double[] data = new double[ny];
double[] gaussw = new double[ny];
for (int i = 0; i < ny; i++) {
data[i] = gaussLats.latd[useIndex];
gaussw[i] = gaussLats.gaussw[useIndex];
if (goesUp) {
useIndex++;
} else {
useIndex--;
}
}
Array dataArray = Array.factory(DataType.DOUBLE, new int[]{ny}, data);
v.setCachedData(dataArray, false);
v.addAttribute(new Attribute("units", units));
v.addAttribute(new Attribute("long_name", desc));
v.addAttribute(new Attribute("standard_name", standard_name));
v.addAttribute(new Attribute("weights", "gaussw"));
v.addAttribute(new Attribute(_Coordinate.AxisType, axis.toString()));
ncfile.addVariable(g, v);
v = new Variable(ncfile, g, null, "gaussw");
v.setDataType(DataType.DOUBLE);
v.setDimensions(name);
v.addAttribute(new Attribute("long_name", "gaussian weights (unnormalized)"));
dataArray = Array.factory(DataType.DOUBLE, new int[]{ny}, gaussw);
v.setCachedData(dataArray, false);
ncfile.addVariable(g, v);
return data;
} | class class_name[name] begin[{]
method[addGaussianLatAxis, return_type[type[double]], modifier[private], parameter[ncfile, name, units, desc, standard_name, axis]] begin[{]
local_variable[type[double], np]
if[call[Double.isNaN, parameter[member[.np]]]] begin[{]
assign[member[.np], call[gds.getDouble, parameter[literal["Np"]]]]
else begin[{]
None
end[}]
if[call[Double.isNaN, parameter[member[.np]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Gaussian Lat/Lon grid must have 'NumberParallels' or 'Np' (number of parallels) parameter")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[double], startLat]
local_variable[type[double], endLat]
local_variable[type[int], nlats]
local_variable[type[GaussianLatitudes], gaussLats]
local_variable[type[int], bestStartIndex]
local_variable[type[double], bestStartDiff]
local_variable[type[double], bestEndDiff]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=latd, postfix_operators=[], prefix_operators=[], qualifier=gaussLats, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=startLat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=diff)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bestStartDiff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestStartDiff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=latd, postfix_operators=[], prefix_operators=[], qualifier=gaussLats, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=endLat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bestEndDiff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestEndDiff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestEndIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nlats, 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)
local_variable[type[int], ny]
if[binary_operation[call[Math.abs, parameter[binary_operation[binary_operation[member[.bestEndIndex], -, member[.bestStartIndex]], +, literal[1]]]], !=, member[.ny]]] begin[{]
call[log.warn, parameter[literal["GRIB gaussian lats: NP != NY, use NY"]]]
assign[member[.nlats], member[.ny]]
assign[member[.gaussLats], call[GaussianLatitudes.factory, parameter[member[.nlats]]]]
assign[member[.bestStartIndex], literal[0]]
assign[member[.bestEndIndex], binary_operation[member[.ny], -, literal[1]]]
else begin[{]
None
end[}]
local_variable[type[boolean], goesUp]
local_variable[type[Variable], v]
call[v.setDataType, parameter[member[DataType.DOUBLE]]]
call[v.setDimensions, parameter[member[.name]]]
local_variable[type[int], useIndex]
local_variable[type[double], data]
local_variable[type[double], gaussw]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=latd, postfix_operators=[], prefix_operators=[], qualifier=gaussLats, selectors=[ArraySelector(index=MemberReference(member=useIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=gaussw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=gaussw, postfix_operators=[], prefix_operators=[], qualifier=gaussLats, selectors=[ArraySelector(index=MemberReference(member=useIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=MemberReference(member=goesUp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=useIndex, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=useIndex, 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=ny, 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)
local_variable[type[Array], dataArray]
call[v.setCachedData, parameter[member[.dataArray], literal[false]]]
call[v.addAttribute, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="units"), MemberReference(member=units, 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=Attribute, sub_type=None))]]
call[v.addAttribute, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="long_name"), MemberReference(member=desc, 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=Attribute, sub_type=None))]]
call[v.addAttribute, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="standard_name"), MemberReference(member=standard_name, 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=Attribute, sub_type=None))]]
call[v.addAttribute, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="weights"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gaussw")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))]]
call[v.addAttribute, parameter[ClassCreator(arguments=[MemberReference(member=AxisType, postfix_operators=[], prefix_operators=[], qualifier=_Coordinate, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=axis, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))]]
call[ncfile.addVariable, parameter[member[.g], member[.v]]]
assign[member[.v], ClassCreator(arguments=[MemberReference(member=ncfile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gaussw")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Variable, sub_type=None))]
call[v.setDataType, parameter[member[DataType.DOUBLE]]]
call[v.setDimensions, parameter[member[.name]]]
call[v.addAttribute, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="long_name"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gaussian weights (unnormalized)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))]]
assign[member[.dataArray], call[Array.factory, parameter[member[DataType.DOUBLE], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=ny, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int)), member[.gaussw]]]]
call[v.setCachedData, parameter[member[.dataArray], literal[false]]]
call[ncfile.addVariable, parameter[member[.g], member[.v]]]
return[member[.data]]
end[}]
END[}] | Keyword[private] Keyword[double] operator[SEP] operator[SEP] identifier[addGaussianLatAxis] operator[SEP] identifier[NetcdfFile] identifier[ncfile] , identifier[String] identifier[name] , identifier[String] identifier[units] , identifier[String] identifier[desc] , identifier[String] identifier[standard_name] , identifier[AxisType] identifier[axis] operator[SEP] {
Keyword[double] identifier[np] operator[=] identifier[gds] operator[SEP] identifier[getDouble] operator[SEP] identifier[GridDefRecord] operator[SEP] identifier[NUMBERPARALLELS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[np] operator[SEP] operator[SEP] identifier[np] operator[=] identifier[gds] operator[SEP] identifier[getDouble] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[np] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[double] identifier[startLat] operator[=] identifier[gds] operator[SEP] identifier[getDouble] operator[SEP] identifier[GridDefRecord] operator[SEP] identifier[LA1] operator[SEP] operator[SEP] Keyword[double] identifier[endLat] operator[=] identifier[gds] operator[SEP] identifier[getDouble] operator[SEP] identifier[GridDefRecord] operator[SEP] identifier[LA2] operator[SEP] operator[SEP] Keyword[int] identifier[nlats] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] Other[2] operator[*] identifier[np] operator[SEP] operator[SEP] identifier[GaussianLatitudes] identifier[gaussLats] operator[=] identifier[GaussianLatitudes] operator[SEP] identifier[factory] operator[SEP] identifier[nlats] operator[SEP] operator[SEP] Keyword[int] identifier[bestStartIndex] operator[=] Other[0] , identifier[bestEndIndex] operator[=] Other[0] operator[SEP] Keyword[double] identifier[bestStartDiff] operator[=] identifier[Double] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[double] identifier[bestEndDiff] operator[=] identifier[Double] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[nlats] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[double] identifier[diff] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[gaussLats] operator[SEP] identifier[latd] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[startLat] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[diff] operator[<] identifier[bestStartDiff] operator[SEP] {
identifier[bestStartDiff] operator[=] identifier[diff] operator[SEP] identifier[bestStartIndex] operator[=] identifier[i] operator[SEP]
}
identifier[diff] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[gaussLats] operator[SEP] identifier[latd] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[endLat] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[diff] operator[<] identifier[bestEndDiff] operator[SEP] {
identifier[bestEndDiff] operator[=] identifier[diff] operator[SEP] identifier[bestEndIndex] operator[=] identifier[i] operator[SEP]
}
}
Keyword[int] identifier[ny] operator[=] identifier[gds] operator[SEP] identifier[getInt] operator[SEP] identifier[GridDefRecord] operator[SEP] identifier[NY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[bestEndIndex] operator[-] identifier[bestStartIndex] operator[+] Other[1] operator[SEP] operator[!=] identifier[ny] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[nlats] operator[=] identifier[ny] operator[SEP] identifier[gaussLats] operator[=] identifier[GaussianLatitudes] operator[SEP] identifier[factory] operator[SEP] identifier[nlats] operator[SEP] operator[SEP] identifier[bestStartIndex] operator[=] Other[0] operator[SEP] identifier[bestEndIndex] operator[=] identifier[ny] operator[-] Other[1] operator[SEP]
}
Keyword[boolean] identifier[goesUp] operator[=] identifier[bestEndIndex] operator[>] identifier[bestStartIndex] operator[SEP] identifier[Variable] identifier[v] operator[=] Keyword[new] identifier[Variable] operator[SEP] identifier[ncfile] , identifier[g] , Other[null] , identifier[name] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setDataType] operator[SEP] identifier[DataType] operator[SEP] identifier[DOUBLE] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setDimensions] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[int] identifier[useIndex] operator[=] identifier[bestStartIndex] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[ny] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[gaussw] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[ny] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ny] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[data] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[gaussLats] operator[SEP] identifier[latd] operator[SEP] identifier[useIndex] operator[SEP] operator[SEP] identifier[gaussw] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[gaussLats] operator[SEP] identifier[gaussw] operator[SEP] identifier[useIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[goesUp] operator[SEP] {
identifier[useIndex] operator[++] operator[SEP]
}
Keyword[else] {
identifier[useIndex] operator[--] operator[SEP]
}
}
identifier[Array] identifier[dataArray] operator[=] identifier[Array] operator[SEP] identifier[factory] operator[SEP] identifier[DataType] operator[SEP] identifier[DOUBLE] , Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
identifier[ny]
} , identifier[data] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setCachedData] operator[SEP] identifier[dataArray] , literal[boolean] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , identifier[units] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , identifier[desc] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , identifier[standard_name] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] identifier[_Coordinate] operator[SEP] identifier[AxisType] , identifier[axis] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ncfile] operator[SEP] identifier[addVariable] operator[SEP] identifier[g] , identifier[v] operator[SEP] operator[SEP] identifier[v] operator[=] Keyword[new] identifier[Variable] operator[SEP] identifier[ncfile] , identifier[g] , Other[null] , literal[String] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setDataType] operator[SEP] identifier[DataType] operator[SEP] identifier[DOUBLE] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setDimensions] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[dataArray] operator[=] identifier[Array] operator[SEP] identifier[factory] operator[SEP] identifier[DataType] operator[SEP] identifier[DOUBLE] , Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
identifier[ny]
} , identifier[gaussw] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[setCachedData] operator[SEP] identifier[dataArray] , literal[boolean] operator[SEP] operator[SEP] identifier[ncfile] operator[SEP] identifier[addVariable] operator[SEP] identifier[g] , identifier[v] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
|
public void marshall(SetV2LoggingOptionsRequest setV2LoggingOptionsRequest, ProtocolMarshaller protocolMarshaller) {
if (setV2LoggingOptionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(setV2LoggingOptionsRequest.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(setV2LoggingOptionsRequest.getDefaultLogLevel(), DEFAULTLOGLEVEL_BINDING);
protocolMarshaller.marshall(setV2LoggingOptionsRequest.getDisableAllLogs(), DISABLEALLLOGS_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[setV2LoggingOptionsRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.setV2LoggingOptionsRequest], ==, 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=getRoleArn, postfix_operators=[], prefix_operators=[], qualifier=setV2LoggingOptionsRequest, selectors=[], type_arguments=None), MemberReference(member=ROLEARN_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=getDefaultLogLevel, postfix_operators=[], prefix_operators=[], qualifier=setV2LoggingOptionsRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTLOGLEVEL_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=getDisableAllLogs, postfix_operators=[], prefix_operators=[], qualifier=setV2LoggingOptionsRequest, selectors=[], type_arguments=None), MemberReference(member=DISABLEALLLOGS_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[SetV2LoggingOptionsRequest] identifier[setV2LoggingOptionsRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[setV2LoggingOptionsRequest] 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[setV2LoggingOptionsRequest] operator[SEP] identifier[getRoleArn] operator[SEP] operator[SEP] , identifier[ROLEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[setV2LoggingOptionsRequest] operator[SEP] identifier[getDefaultLogLevel] operator[SEP] operator[SEP] , identifier[DEFAULTLOGLEVEL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[setV2LoggingOptionsRequest] operator[SEP] identifier[getDisableAllLogs] operator[SEP] operator[SEP] , identifier[DISABLEALLLOGS_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]
}
}
|
@Override
public void writeChunk(long length, boolean isFinal)
{
long chunk;
if (isFinal) {
chunk = length << 1;
}
else {
chunk = (length << 1) + 1;
}
writeUnsigned(chunk);
} | class class_name[name] begin[{]
method[writeChunk, return_type[void], modifier[public], parameter[length, isFinal]] begin[{]
local_variable[type[long], chunk]
if[member[.isFinal]] begin[{]
assign[member[.chunk], binary_operation[member[.length], <<, literal[1]]]
else begin[{]
assign[member[.chunk], binary_operation[binary_operation[member[.length], <<, literal[1]], +, literal[1]]]
end[}]
call[.writeUnsigned, parameter[member[.chunk]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[writeChunk] operator[SEP] Keyword[long] identifier[length] , Keyword[boolean] identifier[isFinal] operator[SEP] {
Keyword[long] identifier[chunk] operator[SEP] Keyword[if] operator[SEP] identifier[isFinal] operator[SEP] {
identifier[chunk] operator[=] identifier[length] operator[<<] Other[1] operator[SEP]
}
Keyword[else] {
identifier[chunk] operator[=] operator[SEP] identifier[length] operator[<<] Other[1] operator[SEP] operator[+] Other[1] operator[SEP]
}
identifier[writeUnsigned] operator[SEP] identifier[chunk] operator[SEP] operator[SEP]
}
|
public void invokevirtual(ExecutableElement method) throws IOException
{
if (method.getEnclosingElement().getKind() == ElementKind.INTERFACE)
{
int index = subClass.resolveInterfaceMethodIndex(method);
invokeinterface(index, argumentCount(method.getParameters()));
}
else
{
int index = subClass.resolveMethodIndex(method);
invokevirtual(index);
}
} | class class_name[name] begin[{]
method[invokevirtual, return_type[void], modifier[public], parameter[method]] begin[{]
if[binary_operation[call[method.getEnclosingElement, parameter[]], ==, member[ElementKind.INTERFACE]]] begin[{]
local_variable[type[int], index]
call[.invokeinterface, parameter[member[.index], call[.argumentCount, parameter[call[method.getParameters, parameter[]]]]]]
else begin[{]
local_variable[type[int], index]
call[.invokevirtual, parameter[member[.index]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[invokevirtual] operator[SEP] identifier[ExecutableElement] identifier[method] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getEnclosingElement] operator[SEP] operator[SEP] operator[SEP] identifier[getKind] operator[SEP] operator[SEP] operator[==] identifier[ElementKind] operator[SEP] identifier[INTERFACE] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[subClass] operator[SEP] identifier[resolveInterfaceMethodIndex] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[invokeinterface] operator[SEP] identifier[index] , identifier[argumentCount] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[index] operator[=] identifier[subClass] operator[SEP] identifier[resolveMethodIndex] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[invokevirtual] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
}
|
private Collection<String> extractArguments( final BootClasspathLibraryOption[] libraries )
{
final List<String> arguments = new ArrayList<String>();
for( BootClasspathLibraryOption library : libraries )
{
if( library.isBeforeFramework() )
{
arguments.add( "--bcp/p=" + library.getLibraryUrl().getURL() );
}
else
{
arguments.add( "--bcp/a=" + library.getLibraryUrl().getURL() );
}
}
return arguments;
} | class class_name[name] begin[{]
method[extractArguments, return_type[type[Collection]], modifier[private], parameter[libraries]] begin[{]
local_variable[type[List], arguments]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isBeforeFramework, postfix_operators=[], prefix_operators=[], qualifier=library, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="--bcp/a="), operandr=MethodInvocation(arguments=[], member=getLibraryUrl, postfix_operators=[], prefix_operators=[], qualifier=library, selectors=[MethodInvocation(arguments=[], member=getURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=arguments, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="--bcp/p="), operandr=MethodInvocation(arguments=[], member=getLibraryUrl, postfix_operators=[], prefix_operators=[], qualifier=library, selectors=[MethodInvocation(arguments=[], member=getURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=arguments, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=libraries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=library)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BootClasspathLibraryOption, sub_type=None))), label=None)
return[member[.arguments]]
end[}]
END[}] | Keyword[private] identifier[Collection] operator[<] identifier[String] operator[>] identifier[extractArguments] operator[SEP] Keyword[final] identifier[BootClasspathLibraryOption] operator[SEP] operator[SEP] identifier[libraries] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[arguments] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BootClasspathLibraryOption] identifier[library] operator[:] identifier[libraries] operator[SEP] {
Keyword[if] operator[SEP] identifier[library] operator[SEP] identifier[isBeforeFramework] operator[SEP] operator[SEP] operator[SEP] {
identifier[arguments] operator[SEP] identifier[add] operator[SEP] literal[String] operator[+] identifier[library] operator[SEP] identifier[getLibraryUrl] operator[SEP] operator[SEP] operator[SEP] identifier[getURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[arguments] operator[SEP] identifier[add] operator[SEP] literal[String] operator[+] identifier[library] operator[SEP] identifier[getLibraryUrl] operator[SEP] operator[SEP] operator[SEP] identifier[getURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[arguments] operator[SEP]
}
|
public static JRLogger getLogger(final Class<?> clazz) {
JRLogger logger = loggerMap.get(clazz.getName());
if (logger == null) {
JRLogger newInstance = null;
// Get the logger instance according to slf4j configuration
final org.slf4j.Logger innerLogger = LoggerFactory.getLogger(clazz);
if ("ch.qos.logback.classic.Logger".equals(innerLogger.getClass().getName())) {
newInstance = new LogbackAdapter((ch.qos.logback.classic.Logger) innerLogger);
} else {
newInstance = new Slf4jAdapter(innerLogger);
}
final JRLogger oldInstance = loggerMap.putIfAbsent(clazz.getName(), newInstance);
logger = oldInstance == null ? newInstance : oldInstance;
}
return logger;
} | class class_name[name] begin[{]
method[getLogger, return_type[type[JRLogger]], modifier[public static], parameter[clazz]] begin[{]
local_variable[type[JRLogger], logger]
if[binary_operation[member[.logger], ==, literal[null]]] begin[{]
local_variable[type[JRLogger], newInstance]
local_variable[type[org], innerLogger]
if[literal["ch.qos.logback.classic.Logger"]] begin[{]
assign[member[.newInstance], ClassCreator(arguments=[Cast(expression=MemberReference(member=innerLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ch, sub_type=ReferenceType(arguments=None, dimensions=None, name=qos, sub_type=ReferenceType(arguments=None, dimensions=None, name=logback, sub_type=ReferenceType(arguments=None, dimensions=None, name=classic, sub_type=ReferenceType(arguments=None, dimensions=None, name=Logger, sub_type=None))))))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LogbackAdapter, sub_type=None))]
else begin[{]
assign[member[.newInstance], ClassCreator(arguments=[MemberReference(member=innerLogger, 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=Slf4jAdapter, sub_type=None))]
end[}]
local_variable[type[JRLogger], oldInstance]
assign[member[.logger], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=oldInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=oldInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
None
end[}]
return[member[.logger]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JRLogger] identifier[getLogger] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
identifier[JRLogger] identifier[logger] operator[=] identifier[loggerMap] operator[SEP] identifier[get] operator[SEP] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[==] Other[null] operator[SEP] {
identifier[JRLogger] identifier[newInstance] operator[=] Other[null] operator[SEP] Keyword[final] identifier[org] operator[SEP] identifier[slf4j] operator[SEP] identifier[Logger] identifier[innerLogger] operator[=] identifier[LoggerFactory] operator[SEP] identifier[getLogger] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[innerLogger] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[newInstance] operator[=] Keyword[new] identifier[LogbackAdapter] operator[SEP] operator[SEP] identifier[ch] operator[SEP] identifier[qos] operator[SEP] identifier[logback] operator[SEP] identifier[classic] operator[SEP] identifier[Logger] operator[SEP] identifier[innerLogger] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[newInstance] operator[=] Keyword[new] identifier[Slf4jAdapter] operator[SEP] identifier[innerLogger] operator[SEP] operator[SEP]
}
Keyword[final] identifier[JRLogger] identifier[oldInstance] operator[=] identifier[loggerMap] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[newInstance] operator[SEP] operator[SEP] identifier[logger] operator[=] identifier[oldInstance] operator[==] Other[null] operator[?] identifier[newInstance] operator[:] identifier[oldInstance] operator[SEP]
}
Keyword[return] identifier[logger] operator[SEP]
}
|
public synchronized void use() {
assert(!inUse);
inUse = true;
compiler = com.sun.tools.javac.api.JavacTool.create();
fileManager = compiler.getStandardFileManager(null, null, null);
fileManagerBase = (BaseFileManager)fileManager;
smartFileManager = new SmartFileManager(fileManager);
context = new Context();
context.put(JavaFileManager.class, smartFileManager);
ResolveWithDeps.preRegister(context);
JavaCompilerWithDeps.preRegister(context, this);
subTasks = new ArrayList<Future<?>>();
} | class class_name[name] begin[{]
method[use, return_type[void], modifier[synchronized public], parameter[]] begin[{]
AssertStatement(condition=MemberReference(member=inUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None, value=None)
assign[member[.inUse], literal[true]]
assign[member[.compiler], call[com.sun.tools.javac.api.JavacTool.create, parameter[]]]
assign[member[.fileManager], call[compiler.getStandardFileManager, parameter[literal[null], literal[null], literal[null]]]]
assign[member[.fileManagerBase], Cast(expression=MemberReference(member=fileManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BaseFileManager, sub_type=None))]
assign[member[.smartFileManager], ClassCreator(arguments=[MemberReference(member=fileManager, 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=SmartFileManager, sub_type=None))]
assign[member[.context], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Context, sub_type=None))]
call[context.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JavaFileManager, sub_type=None)), member[.smartFileManager]]]
call[ResolveWithDeps.preRegister, parameter[member[.context]]]
call[JavaCompilerWithDeps.preRegister, parameter[member[.context], THIS[]]]
assign[member[.subTasks], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Future, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[use] operator[SEP] operator[SEP] {
Keyword[assert] operator[SEP] operator[!] identifier[inUse] operator[SEP] operator[SEP] identifier[inUse] operator[=] literal[boolean] operator[SEP] identifier[compiler] operator[=] identifier[com] operator[SEP] identifier[sun] operator[SEP] identifier[tools] operator[SEP] identifier[javac] operator[SEP] identifier[api] operator[SEP] identifier[JavacTool] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[fileManager] operator[=] identifier[compiler] operator[SEP] identifier[getStandardFileManager] operator[SEP] Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[fileManagerBase] operator[=] operator[SEP] identifier[BaseFileManager] operator[SEP] identifier[fileManager] operator[SEP] identifier[smartFileManager] operator[=] Keyword[new] identifier[SmartFileManager] operator[SEP] identifier[fileManager] operator[SEP] operator[SEP] identifier[context] operator[=] Keyword[new] identifier[Context] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[put] operator[SEP] identifier[JavaFileManager] operator[SEP] Keyword[class] , identifier[smartFileManager] operator[SEP] operator[SEP] identifier[ResolveWithDeps] operator[SEP] identifier[preRegister] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[JavaCompilerWithDeps] operator[SEP] identifier[preRegister] operator[SEP] identifier[context] , Keyword[this] operator[SEP] operator[SEP] identifier[subTasks] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Future] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean mayBeGlobalAlias(Ref alias) {
// Note: alias.scope is the closest scope in which the aliasing assignment occurred.
// So for "if (true) { var alias = aliasedVar; }", the alias.scope would be the IF block scope.
if (alias.scope.isGlobal()) {
return true;
}
// If the scope in which the alias is assigned is not global, look up the LHS of the assignment.
Node aliasParent = alias.getNode().getParent();
if (!aliasParent.isAssign() && !aliasParent.isName()) {
// Only handle variable assignments and initializing declarations.
return true;
}
Node aliasLhsNode = aliasParent.isName() ? aliasParent : aliasParent.getFirstChild();
if (!aliasLhsNode.isName()) {
// Only handle assignments to simple names, not qualified names or GETPROPs.
return true;
}
String aliasVarName = aliasLhsNode.getString();
Var aliasVar = alias.scope.getVar(aliasVarName);
if (aliasVar != null) {
return aliasVar.isGlobal();
}
return true;
} | class class_name[name] begin[{]
method[mayBeGlobalAlias, return_type[type[boolean]], modifier[private], parameter[alias]] begin[{]
if[call[alias.scope.isGlobal, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[Node], aliasParent]
if[binary_operation[call[aliasParent.isAssign, parameter[]], &&, call[aliasParent.isName, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[Node], aliasLhsNode]
if[call[aliasLhsNode.isName, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], aliasVarName]
local_variable[type[Var], aliasVar]
if[binary_operation[member[.aliasVar], !=, literal[null]]] begin[{]
return[call[aliasVar.isGlobal, parameter[]]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[mayBeGlobalAlias] operator[SEP] identifier[Ref] identifier[alias] operator[SEP] {
Keyword[if] operator[SEP] identifier[alias] operator[SEP] identifier[scope] operator[SEP] identifier[isGlobal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Node] identifier[aliasParent] operator[=] identifier[alias] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[aliasParent] operator[SEP] identifier[isAssign] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[aliasParent] operator[SEP] identifier[isName] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Node] identifier[aliasLhsNode] operator[=] identifier[aliasParent] operator[SEP] identifier[isName] operator[SEP] operator[SEP] operator[?] identifier[aliasParent] operator[:] identifier[aliasParent] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[aliasLhsNode] operator[SEP] identifier[isName] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[aliasVarName] operator[=] identifier[aliasLhsNode] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] identifier[Var] identifier[aliasVar] operator[=] identifier[alias] operator[SEP] identifier[scope] operator[SEP] identifier[getVar] operator[SEP] identifier[aliasVarName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aliasVar] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[aliasVar] operator[SEP] identifier[isGlobal] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc)
{
int iKeyFields = this.getKeyFields();
m_rgobjTempData = new Object[iKeyFields];
for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++)
{
m_rgobjTempData[iKeyFieldSeq] = this.getField(iKeyFieldSeq).getData();
}
} | class class_name[name] begin[{]
method[setupKeyBuffer, return_type[void], modifier[public], parameter[destBuffer, iAreaDesc]] begin[{]
local_variable[type[int], iKeyFields]
assign[member[.m_rgobjTempData], ArrayCreator(dimensions=[MemberReference(member=iKeyFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_rgobjTempData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=iKeyFieldSeq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=iKeyFieldSeq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=iKeyFieldSeq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=iKeyFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAIN_KEY_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operator=+), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=MAIN_KEY_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), name=iKeyFieldSeq)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=iKeyFieldSeq, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setupKeyBuffer] operator[SEP] identifier[BaseBuffer] identifier[destBuffer] , Keyword[int] identifier[iAreaDesc] operator[SEP] {
Keyword[int] identifier[iKeyFields] operator[=] Keyword[this] operator[SEP] identifier[getKeyFields] operator[SEP] operator[SEP] operator[SEP] identifier[m_rgobjTempData] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[iKeyFields] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[iKeyFieldSeq] operator[=] identifier[Constants] operator[SEP] identifier[MAIN_KEY_FIELD] operator[SEP] identifier[iKeyFieldSeq] operator[<] identifier[iKeyFields] operator[+] identifier[Constants] operator[SEP] identifier[MAIN_KEY_FIELD] operator[SEP] identifier[iKeyFieldSeq] operator[++] operator[SEP] {
identifier[m_rgobjTempData] operator[SEP] identifier[iKeyFieldSeq] operator[SEP] operator[=] Keyword[this] operator[SEP] identifier[getField] operator[SEP] identifier[iKeyFieldSeq] operator[SEP] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void escapeCssString(final String text, final Writer writer,
final CssStringEscapeType type, final CssStringEscapeLevel level)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (type == null) {
throw new IllegalArgumentException("The 'type' argument cannot be null");
}
if (level == null) {
throw new IllegalArgumentException("The 'level' argument cannot be null");
}
CssStringEscapeUtil.escape(new InternalStringReader(text), writer, type, level);
} | class class_name[name] begin[{]
method[escapeCssString, return_type[void], modifier[public static], parameter[text, writer, type, level]] begin[{]
if[binary_operation[member[.writer], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Argument 'writer' cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The 'type' argument cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.level], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The 'level' argument cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[CssStringEscapeUtil.escape, parameter[ClassCreator(arguments=[MemberReference(member=text, 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=InternalStringReader, sub_type=None)), member[.writer], member[.type], member[.level]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[escapeCssString] operator[SEP] Keyword[final] identifier[String] identifier[text] , Keyword[final] identifier[Writer] identifier[writer] , Keyword[final] identifier[CssStringEscapeType] identifier[type] , Keyword[final] identifier[CssStringEscapeLevel] identifier[level] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[writer] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[level] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[CssStringEscapeUtil] operator[SEP] identifier[escape] operator[SEP] Keyword[new] identifier[InternalStringReader] operator[SEP] identifier[text] operator[SEP] , identifier[writer] , identifier[type] , identifier[level] operator[SEP] operator[SEP]
}
|
public static Smartsheet createDefaultClient(String accessToken) {
SmartsheetImpl smartsheet = new SmartsheetImpl(DEFAULT_BASE_URI, accessToken);
return smartsheet;
} | class class_name[name] begin[{]
method[createDefaultClient, return_type[type[Smartsheet]], modifier[public static], parameter[accessToken]] begin[{]
local_variable[type[SmartsheetImpl], smartsheet]
return[member[.smartsheet]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Smartsheet] identifier[createDefaultClient] operator[SEP] identifier[String] identifier[accessToken] operator[SEP] {
identifier[SmartsheetImpl] identifier[smartsheet] operator[=] Keyword[new] identifier[SmartsheetImpl] operator[SEP] identifier[DEFAULT_BASE_URI] , identifier[accessToken] operator[SEP] operator[SEP] Keyword[return] identifier[smartsheet] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@NonNull
public final Pair<View, Boolean> inflate(@NonNull final ItemType item,
@NonNull final ParamType... params) {
return inflate(item, true, params);
} | class class_name[name] begin[{]
method[inflate, return_type[type[Pair]], modifier[final public], parameter[item, params]] begin[{]
return[call[.inflate, parameter[member[.item], literal[true], member[.params]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[NonNull] Keyword[public] Keyword[final] identifier[Pair] operator[<] identifier[View] , identifier[Boolean] operator[>] identifier[inflate] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[ItemType] identifier[item] , annotation[@] identifier[NonNull] Keyword[final] identifier[ParamType] operator[...] identifier[params] operator[SEP] {
Keyword[return] identifier[inflate] operator[SEP] identifier[item] , literal[boolean] , identifier[params] operator[SEP] operator[SEP]
}
|
public OperationFuture<Void, UpdateDatabaseDdlMetadata> updateDdl(
Iterable<String> statements, String operationId) throws SpannerException {
return dbClient.updateDatabaseDdl(instance(), database(), statements, operationId);
} | class class_name[name] begin[{]
method[updateDdl, return_type[type[OperationFuture]], modifier[public], parameter[statements, operationId]] begin[{]
return[call[dbClient.updateDatabaseDdl, parameter[call[.instance, parameter[]], call[.database, parameter[]], member[.statements], member[.operationId]]]]
end[}]
END[}] | Keyword[public] identifier[OperationFuture] operator[<] identifier[Void] , identifier[UpdateDatabaseDdlMetadata] operator[>] identifier[updateDdl] operator[SEP] identifier[Iterable] operator[<] identifier[String] operator[>] identifier[statements] , identifier[String] identifier[operationId] operator[SEP] Keyword[throws] identifier[SpannerException] {
Keyword[return] identifier[dbClient] operator[SEP] identifier[updateDatabaseDdl] operator[SEP] identifier[instance] operator[SEP] operator[SEP] , identifier[database] operator[SEP] operator[SEP] , identifier[statements] , identifier[operationId] operator[SEP] operator[SEP]
}
|
public static void copy(InputStream input, Writer output)
throws IOException {
InputStreamReader in = new InputStreamReader(input); // NOSONAR
copy(in, output);
} | class class_name[name] begin[{]
method[copy, return_type[void], modifier[public static], parameter[input, output]] begin[{]
local_variable[type[InputStreamReader], in]
call[.copy, parameter[member[.in], member[.output]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[copy] operator[SEP] identifier[InputStream] identifier[input] , identifier[Writer] identifier[output] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStreamReader] identifier[in] operator[=] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[copy] operator[SEP] identifier[in] , identifier[output] operator[SEP] operator[SEP]
}
|
public String getSubscriptionId(FhirContext theFhirContext) {
String retVal = null;
if (getSubscription() != null) {
retVal = getSubscription().getIdElement(theFhirContext).getValue();
}
return retVal;
} | class class_name[name] begin[{]
method[getSubscriptionId, return_type[type[String]], modifier[public], parameter[theFhirContext]] begin[{]
local_variable[type[String], retVal]
if[binary_operation[call[.getSubscription, parameter[]], !=, literal[null]]] begin[{]
assign[member[.retVal], call[.getSubscription, parameter[]]]
else begin[{]
None
end[}]
return[member[.retVal]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getSubscriptionId] operator[SEP] identifier[FhirContext] identifier[theFhirContext] operator[SEP] {
identifier[String] identifier[retVal] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[getSubscription] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[retVal] operator[=] identifier[getSubscription] operator[SEP] operator[SEP] operator[SEP] identifier[getIdElement] operator[SEP] identifier[theFhirContext] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[retVal] operator[SEP]
}
|
public void stopWALRecordTimer(boolean isStartRecord, boolean isStopRecord) {
final long endTs = nanoTimer.getNano();
final long timeDiff = (endTs - timeStamps.pop());
if (walCountersHolder == null)
walCountersHolder = new WALCountersHolder();
walCountersHolder.logRecordCount++;
walCountersHolder.logRecordTime += timeDiff;
if (isStartRecord) {
walCountersHolder.startRecordCount++;
walCountersHolder.startRecordTime += timeDiff;
} else if (isStopRecord) {
walCountersHolder.stopRecordCount++;
walCountersHolder.stopRecordTime += timeDiff;
}
makeSnapshotIfNeeded(endTs);
} | class class_name[name] begin[{]
method[stopWALRecordTimer, return_type[void], modifier[public], parameter[isStartRecord, isStopRecord]] begin[{]
local_variable[type[long], endTs]
local_variable[type[long], timeDiff]
if[binary_operation[member[.walCountersHolder], ==, literal[null]]] begin[{]
assign[member[.walCountersHolder], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WALCountersHolder, sub_type=None))]
else begin[{]
None
end[}]
member[walCountersHolder.logRecordCount]
assign[member[walCountersHolder.logRecordTime], member[.timeDiff]]
if[member[.isStartRecord]] begin[{]
member[walCountersHolder.startRecordCount]
assign[member[walCountersHolder.startRecordTime], member[.timeDiff]]
else begin[{]
if[member[.isStopRecord]] begin[{]
member[walCountersHolder.stopRecordCount]
assign[member[walCountersHolder.stopRecordTime], member[.timeDiff]]
else begin[{]
None
end[}]
end[}]
call[.makeSnapshotIfNeeded, parameter[member[.endTs]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[stopWALRecordTimer] operator[SEP] Keyword[boolean] identifier[isStartRecord] , Keyword[boolean] identifier[isStopRecord] operator[SEP] {
Keyword[final] Keyword[long] identifier[endTs] operator[=] identifier[nanoTimer] operator[SEP] identifier[getNano] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[timeDiff] operator[=] operator[SEP] identifier[endTs] operator[-] identifier[timeStamps] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[walCountersHolder] operator[==] Other[null] operator[SEP] identifier[walCountersHolder] operator[=] Keyword[new] identifier[WALCountersHolder] operator[SEP] operator[SEP] operator[SEP] identifier[walCountersHolder] operator[SEP] identifier[logRecordCount] operator[++] operator[SEP] identifier[walCountersHolder] operator[SEP] identifier[logRecordTime] operator[+=] identifier[timeDiff] operator[SEP] Keyword[if] operator[SEP] identifier[isStartRecord] operator[SEP] {
identifier[walCountersHolder] operator[SEP] identifier[startRecordCount] operator[++] operator[SEP] identifier[walCountersHolder] operator[SEP] identifier[startRecordTime] operator[+=] identifier[timeDiff] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isStopRecord] operator[SEP] {
identifier[walCountersHolder] operator[SEP] identifier[stopRecordCount] operator[++] operator[SEP] identifier[walCountersHolder] operator[SEP] identifier[stopRecordTime] operator[+=] identifier[timeDiff] operator[SEP]
}
identifier[makeSnapshotIfNeeded] operator[SEP] identifier[endTs] operator[SEP] operator[SEP]
}
|
public void finishJson(final Object obj) {
this.contentType = this.jsonContentType;
if (this.recycleListener != null) this.output = obj;
finish(request.getJsonConvert().convertTo(getBodyBufferSupplier(), obj));
} | class class_name[name] begin[{]
method[finishJson, return_type[void], modifier[public], parameter[obj]] begin[{]
assign[THIS[member[None.contentType]], THIS[member[None.jsonContentType]]]
if[binary_operation[THIS[member[None.recycleListener]], !=, literal[null]]] begin[{]
assign[THIS[member[None.output]], member[.obj]]
else begin[{]
None
end[}]
call[.finish, parameter[call[request.getJsonConvert, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[finishJson] operator[SEP] Keyword[final] identifier[Object] identifier[obj] operator[SEP] {
Keyword[this] operator[SEP] identifier[contentType] operator[=] Keyword[this] operator[SEP] identifier[jsonContentType] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[recycleListener] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[output] operator[=] identifier[obj] operator[SEP] identifier[finish] operator[SEP] identifier[request] operator[SEP] identifier[getJsonConvert] operator[SEP] operator[SEP] operator[SEP] identifier[convertTo] operator[SEP] identifier[getBodyBufferSupplier] operator[SEP] operator[SEP] , identifier[obj] operator[SEP] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/", name = "checkinComment", scope = CheckIn.class)
public JAXBElement<String> createCheckInCheckinComment(String value) {
return new JAXBElement<String>(_CheckInCheckinComment_QNAME,
String.class, CheckIn.class, value);
} | class class_name[name] begin[{]
method[createCheckInCheckinComment, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_CheckInCheckinComment_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CheckIn, sub_type=None)), 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[scope] operator[=] identifier[CheckIn] operator[SEP] Keyword[class] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[String] operator[>] identifier[createCheckInCheckinComment] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[String] operator[>] operator[SEP] identifier[_CheckInCheckinComment_QNAME] , identifier[String] operator[SEP] Keyword[class] , identifier[CheckIn] operator[SEP] Keyword[class] , identifier[value] operator[SEP] operator[SEP]
}
|
private static int delete(final TSDB tsdb, final byte[] table,
final String[] args) throws Exception {
final String kind = args[1];
final String name = args[2];
try {
tsdb.deleteUidAsync(kind, name).join();
} catch (HBaseException e) {
LOG.error("error while processing delete " + name, e);
return 3;
} catch (NoSuchUniqueName e) {
LOG.error(e.getMessage());
return 1;
}
LOG.info("UID " + kind + ' ' + name + " deleted.");
return 0;
} | class class_name[name] begin[{]
method[delete, return_type[type[int]], modifier[private static], parameter[tsdb, table, args]] begin[{]
local_variable[type[String], kind]
local_variable[type[String], name]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=kind, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deleteUidAsync, postfix_operators=[], prefix_operators=[], qualifier=tsdb, selectors=[MethodInvocation(arguments=[], member=join, 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=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error while processing delete "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=3), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['HBaseException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], 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=1), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchUniqueName']))], finally_block=None, label=None, resources=None)
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["UID "], +, member[.kind]], +, literal[' ']], +, member[.name]], +, literal[" deleted."]]]]
return[literal[0]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[delete] operator[SEP] Keyword[final] identifier[TSDB] identifier[tsdb] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[table] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[String] identifier[kind] operator[=] identifier[args] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[=] identifier[args] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[try] {
identifier[tsdb] operator[SEP] identifier[deleteUidAsync] operator[SEP] identifier[kind] , identifier[name] operator[SEP] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[HBaseException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[3] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[1] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[kind] operator[+] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[0] operator[SEP]
}
|
protected void fireRemove(CmsPublishJobFinished publishJob) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_REMOVE_0));
}
for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
I_CmsPublishEventListener listener = it.next();
try {
listener.onRemove(publishJob);
} catch (Throwable t) {
// catch every thing including runtime exceptions
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_PUBLISH_JOB_REMOVE_ERROR_1,
listener.getClass().getName()),
t);
}
if (publishJob.m_publishJob.getPublishReport() != null) {
publishJob.m_publishJob.getPublishReport().println(t);
}
}
}
} | class class_name[name] begin[{]
method[fireRemove, return_type[void], modifier[protected], parameter[publishJob]] begin[{]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=I_CmsPublishEventListener, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=publishJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onRemove, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[], member=getBundle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ERR_PUBLISH_JOB_REMOVE_ERROR_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPublishReport, postfix_operators=[], prefix_operators=[], qualifier=publishJob.m_publishJob, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getPublishReport, postfix_operators=[], prefix_operators=[], qualifier=publishJob.m_publishJob, selectors=[MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=I_CmsPublishEventListener, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[fireRemove] operator[SEP] identifier[CmsPublishJobFinished] identifier[publishJob] 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_PUBLISH_JOB_REMOVE_0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[I_CmsPublishEventListener] operator[>] identifier[it] operator[=] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[I_CmsPublishEventListener] identifier[listener] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[listener] operator[SEP] identifier[onRemove] operator[SEP] identifier[publishJob] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] 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[ERR_PUBLISH_JOB_REMOVE_ERROR_1] , identifier[listener] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[publishJob] operator[SEP] identifier[m_publishJob] operator[SEP] identifier[getPublishReport] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[publishJob] operator[SEP] identifier[m_publishJob] operator[SEP] identifier[getPublishReport] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public CommerceRegion findByCommerceCountryId_First(
long commerceCountryId,
OrderByComparator<CommerceRegion> orderByComparator)
throws NoSuchRegionException {
CommerceRegion commerceRegion = fetchByCommerceCountryId_First(commerceCountryId,
orderByComparator);
if (commerceRegion != null) {
return commerceRegion;
}
StringBundler msg = new StringBundler(4);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("commerceCountryId=");
msg.append(commerceCountryId);
msg.append("}");
throw new NoSuchRegionException(msg.toString());
} | class class_name[name] begin[{]
method[findByCommerceCountryId_First, return_type[type[CommerceRegion]], modifier[public], parameter[commerceCountryId, orderByComparator]] begin[{]
local_variable[type[CommerceRegion], commerceRegion]
if[binary_operation[member[.commerceRegion], !=, literal[null]]] begin[{]
return[member[.commerceRegion]]
else begin[{]
None
end[}]
local_variable[type[StringBundler], msg]
call[msg.append, parameter[member[._NO_SUCH_ENTITY_WITH_KEY]]]
call[msg.append, parameter[literal["commerceCountryId="]]]
call[msg.append, parameter[member[.commerceCountryId]]]
call[msg.append, parameter[literal["}"]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchRegionException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CommerceRegion] identifier[findByCommerceCountryId_First] operator[SEP] Keyword[long] identifier[commerceCountryId] , identifier[OrderByComparator] operator[<] identifier[CommerceRegion] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[NoSuchRegionException] {
identifier[CommerceRegion] identifier[commerceRegion] operator[=] identifier[fetchByCommerceCountryId_First] operator[SEP] identifier[commerceCountryId] , identifier[orderByComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commerceRegion] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[commerceRegion] operator[SEP]
}
identifier[StringBundler] identifier[msg] operator[=] Keyword[new] identifier[StringBundler] operator[SEP] Other[4] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[_NO_SUCH_ENTITY_WITH_KEY] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[commerceCountryId] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NoSuchRegionException] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@BetaApi
public final Operation setSslPolicyTargetHttpsProxy(
String targetHttpsProxy, SslPolicyReference sslPolicyReferenceResource) {
SetSslPolicyTargetHttpsProxyHttpRequest request =
SetSslPolicyTargetHttpsProxyHttpRequest.newBuilder()
.setTargetHttpsProxy(targetHttpsProxy)
.setSslPolicyReferenceResource(sslPolicyReferenceResource)
.build();
return setSslPolicyTargetHttpsProxy(request);
} | class class_name[name] begin[{]
method[setSslPolicyTargetHttpsProxy, return_type[type[Operation]], modifier[final public], parameter[targetHttpsProxy, sslPolicyReferenceResource]] begin[{]
local_variable[type[SetSslPolicyTargetHttpsProxyHttpRequest], request]
return[call[.setSslPolicyTargetHttpsProxy, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[Operation] identifier[setSslPolicyTargetHttpsProxy] operator[SEP] identifier[String] identifier[targetHttpsProxy] , identifier[SslPolicyReference] identifier[sslPolicyReferenceResource] operator[SEP] {
identifier[SetSslPolicyTargetHttpsProxyHttpRequest] identifier[request] operator[=] identifier[SetSslPolicyTargetHttpsProxyHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setTargetHttpsProxy] operator[SEP] identifier[targetHttpsProxy] operator[SEP] operator[SEP] identifier[setSslPolicyReferenceResource] operator[SEP] identifier[sslPolicyReferenceResource] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[setSslPolicyTargetHttpsProxy] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected StateHelper getStateHelper(boolean create)
{
if (_stateHelper != null)
{
return _stateHelper;
}
if (create)
{
_stateHelper = new _DeltaStateHelper(this);
}
return _stateHelper;
} | class class_name[name] begin[{]
method[getStateHelper, return_type[type[StateHelper]], modifier[protected], parameter[create]] begin[{]
if[binary_operation[member[._stateHelper], !=, literal[null]]] begin[{]
return[member[._stateHelper]]
else begin[{]
None
end[}]
if[member[.create]] begin[{]
assign[member[._stateHelper], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=_DeltaStateHelper, sub_type=None))]
else begin[{]
None
end[}]
return[member[._stateHelper]]
end[}]
END[}] | Keyword[protected] identifier[StateHelper] identifier[getStateHelper] operator[SEP] Keyword[boolean] identifier[create] operator[SEP] {
Keyword[if] operator[SEP] identifier[_stateHelper] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[_stateHelper] operator[SEP]
}
Keyword[if] operator[SEP] identifier[create] operator[SEP] {
identifier[_stateHelper] operator[=] Keyword[new] identifier[_DeltaStateHelper] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_stateHelper] operator[SEP]
}
|
public void marshall(ListApplicationsRequest listApplicationsRequest, ProtocolMarshaller protocolMarshaller) {
if (listApplicationsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listApplicationsRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listApplicationsRequest.getExclusiveStartApplicationName(), EXCLUSIVESTARTAPPLICATIONNAME_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[listApplicationsRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.listApplicationsRequest], ==, 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=getLimit, postfix_operators=[], prefix_operators=[], qualifier=listApplicationsRequest, selectors=[], type_arguments=None), MemberReference(member=LIMIT_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=getExclusiveStartApplicationName, postfix_operators=[], prefix_operators=[], qualifier=listApplicationsRequest, selectors=[], type_arguments=None), MemberReference(member=EXCLUSIVESTARTAPPLICATIONNAME_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[ListApplicationsRequest] identifier[listApplicationsRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[listApplicationsRequest] 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[listApplicationsRequest] operator[SEP] identifier[getLimit] operator[SEP] operator[SEP] , identifier[LIMIT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listApplicationsRequest] operator[SEP] identifier[getExclusiveStartApplicationName] operator[SEP] operator[SEP] , identifier[EXCLUSIVESTARTAPPLICATIONNAME_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]
}
}
|
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final <R> Flowable<R> replay(final Function<? super Flowable<T>, ? extends Publisher<R>> selector, final Scheduler scheduler) {
ObjectHelper.requireNonNull(selector, "selector is null");
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return FlowableReplay.multicastSelector(FlowableInternalHelper.replayCallable(this),
FlowableInternalHelper.replayFunction(selector, scheduler));
} | class class_name[name] begin[{]
method[replay, return_type[type[Flowable]], modifier[final public], parameter[selector, scheduler]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.selector], literal["selector is null"]]]
call[ObjectHelper.requireNonNull, parameter[member[.scheduler], literal["scheduler is null"]]]
return[call[FlowableReplay.multicastSelector, parameter[call[FlowableInternalHelper.replayCallable, parameter[THIS[]]], call[FlowableInternalHelper.replayFunction, parameter[member[.selector], member[.scheduler]]]]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[NonNull] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[CUSTOM] operator[SEP] Keyword[public] Keyword[final] operator[<] identifier[R] operator[>] identifier[Flowable] operator[<] identifier[R] operator[>] identifier[replay] operator[SEP] Keyword[final] identifier[Function] operator[<] operator[?] Keyword[super] identifier[Flowable] operator[<] identifier[T] operator[>] , operator[?] Keyword[extends] identifier[Publisher] operator[<] identifier[R] operator[>] operator[>] identifier[selector] , Keyword[final] identifier[Scheduler] identifier[scheduler] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[selector] , literal[String] operator[SEP] operator[SEP] identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[scheduler] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[FlowableReplay] operator[SEP] identifier[multicastSelector] operator[SEP] identifier[FlowableInternalHelper] operator[SEP] identifier[replayCallable] operator[SEP] Keyword[this] operator[SEP] , identifier[FlowableInternalHelper] operator[SEP] identifier[replayFunction] operator[SEP] identifier[selector] , identifier[scheduler] operator[SEP] operator[SEP] operator[SEP]
}
|
private void addRow() {
BloomFilter[] tmp = new BloomFilter[matrix.length + 1];
for (int i = 0; i < matrix.length; i++) {
tmp[i] = matrix[i];
}
tmp[tmp.length-1] = new BloomFilter(vectorSize, nbHash, hashType);
matrix = tmp;
} | class class_name[name] begin[{]
method[addRow, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[BloomFilter], tmp]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=matrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.tmp], ClassCreator(arguments=[MemberReference(member=vectorSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nbHash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hashType, 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=BloomFilter, sub_type=None))]
assign[member[.matrix], member[.tmp]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addRow] operator[SEP] operator[SEP] {
identifier[BloomFilter] operator[SEP] operator[SEP] identifier[tmp] operator[=] Keyword[new] identifier[BloomFilter] operator[SEP] identifier[matrix] operator[SEP] identifier[length] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[matrix] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[tmp] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[matrix] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[tmp] operator[SEP] identifier[tmp] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[=] Keyword[new] identifier[BloomFilter] operator[SEP] identifier[vectorSize] , identifier[nbHash] , identifier[hashType] operator[SEP] operator[SEP] identifier[matrix] operator[=] identifier[tmp] operator[SEP]
}
|
public Rectangle calculateScreenBounds(Rectangle2D modelBounds) {
double scale = rendererModel.getParameter(Scale.class).getValue();
double zoom = rendererModel.getParameter(ZoomFactor.class).getValue();
double margin = rendererModel.getParameter(Margin.class).getValue();
Point2d modelScreenCenter = this.toScreenCoordinates(modelBounds.getCenterX(), modelBounds.getCenterY());
double width = (scale * zoom * modelBounds.getWidth()) + (2 * margin);
double height = (scale * zoom * modelBounds.getHeight()) + (2 * margin);
return new Rectangle((int) (modelScreenCenter.x - width / 2), (int) (modelScreenCenter.y - height / 2),
(int) width, (int) height);
} | class class_name[name] begin[{]
method[calculateScreenBounds, return_type[type[Rectangle]], modifier[public], parameter[modelBounds]] begin[{]
local_variable[type[double], scale]
local_variable[type[double], zoom]
local_variable[type[double], margin]
local_variable[type[Point2d], modelScreenCenter]
local_variable[type[double], width]
local_variable[type[double], height]
return[ClassCreator(arguments=[Cast(expression=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=modelScreenCenter, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=-), type=BasicType(dimensions=[], name=int)), Cast(expression=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=modelScreenCenter, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=-), type=BasicType(dimensions=[], name=int)), Cast(expression=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int)), Cast(expression=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Rectangle, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Rectangle] identifier[calculateScreenBounds] operator[SEP] identifier[Rectangle2D] identifier[modelBounds] operator[SEP] {
Keyword[double] identifier[scale] operator[=] identifier[rendererModel] operator[SEP] identifier[getParameter] operator[SEP] identifier[Scale] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[zoom] operator[=] identifier[rendererModel] operator[SEP] identifier[getParameter] operator[SEP] identifier[ZoomFactor] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[margin] operator[=] identifier[rendererModel] operator[SEP] identifier[getParameter] operator[SEP] identifier[Margin] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[Point2d] identifier[modelScreenCenter] operator[=] Keyword[this] operator[SEP] identifier[toScreenCoordinates] operator[SEP] identifier[modelBounds] operator[SEP] identifier[getCenterX] operator[SEP] operator[SEP] , identifier[modelBounds] operator[SEP] identifier[getCenterY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[width] operator[=] operator[SEP] identifier[scale] operator[*] identifier[zoom] operator[*] identifier[modelBounds] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] operator[+] operator[SEP] Other[2] operator[*] identifier[margin] operator[SEP] operator[SEP] Keyword[double] identifier[height] operator[=] operator[SEP] identifier[scale] operator[*] identifier[zoom] operator[*] identifier[modelBounds] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] operator[+] operator[SEP] Other[2] operator[*] identifier[margin] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Rectangle] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[modelScreenCenter] operator[SEP] identifier[x] operator[-] identifier[width] operator[/] Other[2] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[modelScreenCenter] operator[SEP] identifier[y] operator[-] identifier[height] operator[/] Other[2] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] identifier[width] , operator[SEP] Keyword[int] operator[SEP] identifier[height] operator[SEP] operator[SEP]
}
|
public static Kidnummer mod10Kid(String baseNumber, int targetLength) {
if (baseNumber.length() >= targetLength)
throw new IllegalArgumentException("baseNumber too long");
String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber));
Kidnummer k = new Kidnummer(padded + "0");
return KidnummerValidator.getKidnummer(padded + calculateMod10CheckSum(getMod10Weights(k), k));
} | class class_name[name] begin[{]
method[mod10Kid, return_type[type[Kidnummer]], modifier[public static], parameter[baseNumber, targetLength]] begin[{]
if[binary_operation[call[baseNumber.length, parameter[]], >=, member[.targetLength]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="baseNumber too long")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], padded]
local_variable[type[Kidnummer], k]
return[call[KidnummerValidator.getKidnummer, parameter[binary_operation[member[.padded], +, call[.calculateMod10CheckSum, parameter[call[.getMod10Weights, parameter[member[.k]]], member[.k]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Kidnummer] identifier[mod10Kid] operator[SEP] identifier[String] identifier[baseNumber] , Keyword[int] identifier[targetLength] operator[SEP] {
Keyword[if] operator[SEP] identifier[baseNumber] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>=] identifier[targetLength] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[padded] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] operator[SEP] identifier[targetLength] operator[-] Other[1] operator[SEP] operator[+] literal[String] , Keyword[new] identifier[BigInteger] operator[SEP] identifier[baseNumber] operator[SEP] operator[SEP] operator[SEP] identifier[Kidnummer] identifier[k] operator[=] Keyword[new] identifier[Kidnummer] operator[SEP] identifier[padded] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[KidnummerValidator] operator[SEP] identifier[getKidnummer] operator[SEP] identifier[padded] operator[+] identifier[calculateMod10CheckSum] operator[SEP] identifier[getMod10Weights] operator[SEP] identifier[k] operator[SEP] , identifier[k] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean isunixtimeleap( double unixTime ) {
double gpsTime = unixTime - 315964800;
gpsTime += countleaps(gpsTime, true) - 1;
return isleap(gpsTime);
} | class class_name[name] begin[{]
method[isunixtimeleap, return_type[type[boolean]], modifier[private static], parameter[unixTime]] begin[{]
local_variable[type[double], gpsTime]
assign[member[.gpsTime], binary_operation[call[.countleaps, parameter[member[.gpsTime], literal[true]]], -, literal[1]]]
return[call[.isleap, parameter[member[.gpsTime]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isunixtimeleap] operator[SEP] Keyword[double] identifier[unixTime] operator[SEP] {
Keyword[double] identifier[gpsTime] operator[=] identifier[unixTime] operator[-] Other[315964800] operator[SEP] identifier[gpsTime] operator[+=] identifier[countleaps] operator[SEP] identifier[gpsTime] , literal[boolean] operator[SEP] operator[-] Other[1] operator[SEP] Keyword[return] identifier[isleap] operator[SEP] identifier[gpsTime] operator[SEP] operator[SEP]
}
|
public OvhCompany register_company_companyId_GET(String companyId) throws IOException {
String qPath = "/partners/register/company/{companyId}";
StringBuilder sb = path(qPath, companyId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCompany.class);
} | class class_name[name] begin[{]
method[register_company_companyId_GET, return_type[type[OvhCompany]], modifier[public], parameter[companyId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhCompany, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhCompany] identifier[register_company_companyId_GET] operator[SEP] identifier[String] identifier[companyId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[companyId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhCompany] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public AddressTemplate append(String template) {
String slashTemplate = template.startsWith("/") ? template : "/" + template;
return AddressTemplate.of(this.template + slashTemplate);
} | class class_name[name] begin[{]
method[append, return_type[type[AddressTemplate]], modifier[public], parameter[template]] begin[{]
local_variable[type[String], slashTemplate]
return[call[AddressTemplate.of, parameter[binary_operation[THIS[member[None.template]], +, member[.slashTemplate]]]]]
end[}]
END[}] | Keyword[public] identifier[AddressTemplate] identifier[append] operator[SEP] identifier[String] identifier[template] operator[SEP] {
identifier[String] identifier[slashTemplate] operator[=] identifier[template] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[?] identifier[template] operator[:] literal[String] operator[+] identifier[template] operator[SEP] Keyword[return] identifier[AddressTemplate] operator[SEP] identifier[of] operator[SEP] Keyword[this] operator[SEP] identifier[template] operator[+] identifier[slashTemplate] operator[SEP] operator[SEP]
}
|
public ClinicalImpression addAction(Reference t) { //3
if (t == null)
return this;
if (this.action == null)
this.action = new ArrayList<Reference>();
this.action.add(t);
return this;
} | class class_name[name] begin[{]
method[addAction, return_type[type[ClinicalImpression]], modifier[public], parameter[t]] begin[{]
if[binary_operation[member[.t], ==, literal[null]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.action]], ==, literal[null]]] begin[{]
assign[THIS[member[None.action]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Reference, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.action]call[None.add, parameter[member[.t]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ClinicalImpression] identifier[addAction] operator[SEP] identifier[Reference] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[this] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[action] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[action] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Reference] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[action] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) {
if (sourceList.contains("message")) {
logConduit.addSyncHandler(handler);
} else {
logConduit.removeSyncHandler(handler);
}
if (sourceList.contains("trace")) {
traceConduit.addSyncHandler(handler);
} else {
traceConduit.removeSyncHandler(handler);
}
} | class class_name[name] begin[{]
method[updateConduitSyncHandlerConnection, return_type[void], modifier[private], parameter[sourceList, handler]] begin[{]
if[call[sourceList.contains, parameter[literal["message"]]]] begin[{]
call[logConduit.addSyncHandler, parameter[member[.handler]]]
else begin[{]
call[logConduit.removeSyncHandler, parameter[member[.handler]]]
end[}]
if[call[sourceList.contains, parameter[literal["trace"]]]] begin[{]
call[traceConduit.addSyncHandler, parameter[member[.handler]]]
else begin[{]
call[traceConduit.removeSyncHandler, parameter[member[.handler]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateConduitSyncHandlerConnection] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[sourceList] , identifier[SynchronousHandler] identifier[handler] operator[SEP] {
Keyword[if] operator[SEP] identifier[sourceList] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[logConduit] operator[SEP] identifier[addSyncHandler] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[logConduit] operator[SEP] identifier[removeSyncHandler] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sourceList] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[traceConduit] operator[SEP] identifier[addSyncHandler] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[traceConduit] operator[SEP] identifier[removeSyncHandler] operator[SEP] identifier[handler] operator[SEP] operator[SEP]
}
}
|
@Override
public OracleDatabase setSequence(final Connection _con,
final String _name,
final long _value)
throws SQLException
{
deleteSequence(_con, _name);
createSequence(_con, _name, _value);
return this;
} | class class_name[name] begin[{]
method[setSequence, return_type[type[OracleDatabase]], modifier[public], parameter[_con, _name, _value]] begin[{]
call[.deleteSequence, parameter[member[._con], member[._name]]]
call[.createSequence, parameter[member[._con], member[._name], member[._value]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[OracleDatabase] identifier[setSequence] operator[SEP] Keyword[final] identifier[Connection] identifier[_con] , Keyword[final] identifier[String] identifier[_name] , Keyword[final] Keyword[long] identifier[_value] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[deleteSequence] operator[SEP] identifier[_con] , identifier[_name] operator[SEP] operator[SEP] identifier[createSequence] operator[SEP] identifier[_con] , identifier[_name] , identifier[_value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static boolean compareSignatures(String plainSignature, String genericSignature) {
GenericSignatureParser plainParser = new GenericSignatureParser(plainSignature);
GenericSignatureParser genericParser = new GenericSignatureParser(genericSignature);
return plainParser.getNumParameters() == genericParser.getNumParameters();
} | class class_name[name] begin[{]
method[compareSignatures, return_type[type[boolean]], modifier[public static], parameter[plainSignature, genericSignature]] begin[{]
local_variable[type[GenericSignatureParser], plainParser]
local_variable[type[GenericSignatureParser], genericParser]
return[binary_operation[call[plainParser.getNumParameters, parameter[]], ==, call[genericParser.getNumParameters, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[compareSignatures] operator[SEP] identifier[String] identifier[plainSignature] , identifier[String] identifier[genericSignature] operator[SEP] {
identifier[GenericSignatureParser] identifier[plainParser] operator[=] Keyword[new] identifier[GenericSignatureParser] operator[SEP] identifier[plainSignature] operator[SEP] operator[SEP] identifier[GenericSignatureParser] identifier[genericParser] operator[=] Keyword[new] identifier[GenericSignatureParser] operator[SEP] identifier[genericSignature] operator[SEP] operator[SEP] Keyword[return] identifier[plainParser] operator[SEP] identifier[getNumParameters] operator[SEP] operator[SEP] operator[==] identifier[genericParser] operator[SEP] identifier[getNumParameters] operator[SEP] operator[SEP] operator[SEP]
}
|
public OptionalThing<String> analyzeRestfulHttpMethod(Method executeMethod) {
final String extracted = extractRestfulHttpMethod(executeMethod);
assertResfulHttpMethodIfExists(executeMethod, extracted);
return OptionalThing.ofNullable(extracted, () -> {
throw new IllegalStateException("Not found RESTful HTTP method: " + toSimpleMethodExp(executeMethod));
});
} | class class_name[name] begin[{]
method[analyzeRestfulHttpMethod, return_type[type[OptionalThing]], modifier[public], parameter[executeMethod]] begin[{]
local_variable[type[String], extracted]
call[.assertResfulHttpMethodIfExists, parameter[member[.executeMethod], member[.extracted]]]
return[call[OptionalThing.ofNullable, parameter[member[.extracted], LambdaExpression(body=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not found RESTful HTTP method: "), operandr=MethodInvocation(arguments=[MemberReference(member=executeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toSimpleMethodExp, 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=IllegalStateException, sub_type=None)), label=None)], parameters=[])]]]
end[}]
END[}] | Keyword[public] identifier[OptionalThing] operator[<] identifier[String] operator[>] identifier[analyzeRestfulHttpMethod] operator[SEP] identifier[Method] identifier[executeMethod] operator[SEP] {
Keyword[final] identifier[String] identifier[extracted] operator[=] identifier[extractRestfulHttpMethod] operator[SEP] identifier[executeMethod] operator[SEP] operator[SEP] identifier[assertResfulHttpMethodIfExists] operator[SEP] identifier[executeMethod] , identifier[extracted] operator[SEP] operator[SEP] Keyword[return] identifier[OptionalThing] operator[SEP] identifier[ofNullable] operator[SEP] identifier[extracted] , operator[SEP] operator[SEP] operator[->] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[toSimpleMethodExp] operator[SEP] identifier[executeMethod] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public final Cache2kBuilder<K, V> name(Class<?> _class) {
config().setName(_class.getName());
return this;
} | class class_name[name] begin[{]
method[name, return_type[type[Cache2kBuilder]], modifier[final public], parameter[_class]] begin[{]
call[.config, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Cache2kBuilder] operator[<] identifier[K] , identifier[V] operator[>] identifier[name] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[_class] operator[SEP] {
identifier[config] operator[SEP] operator[SEP] operator[SEP] identifier[setName] operator[SEP] identifier[_class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void abort(int slot) {
try {
HttpGet httpGet = httpGets.get(slot);
httpGet.abort();
abortListeners(httpGet.getURI().toString());
} catch(Exception e) {
log.error(e.getMessage());
}
} | class class_name[name] begin[{]
method[abort, return_type[void], modifier[public], parameter[slot]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=slot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=httpGets, selectors=[], type_arguments=None), name=httpGet)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpGet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=abort, postfix_operators=[], prefix_operators=[], qualifier=httpGet, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getURI, postfix_operators=[], prefix_operators=[], qualifier=httpGet, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=abortListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[abort] operator[SEP] Keyword[int] identifier[slot] operator[SEP] {
Keyword[try] {
identifier[HttpGet] identifier[httpGet] operator[=] identifier[httpGets] operator[SEP] identifier[get] operator[SEP] identifier[slot] operator[SEP] operator[SEP] identifier[httpGet] operator[SEP] identifier[abort] operator[SEP] operator[SEP] operator[SEP] identifier[abortListeners] operator[SEP] identifier[httpGet] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Iterator<Component> iterator(final JTabbedPane self) {
return new Iterator<Component>() {
private int index = 0;
public boolean hasNext() {
return index > -1 && index < self.getTabCount();
}
public Component next() {
return self.getComponentAt(index++);
}
public void remove() {
if (hasNext()) self.removeTabAt(index--);
}
};
} | class class_name[name] begin[{]
method[iterator, return_type[type[Iterator]], modifier[public static], parameter[self]] begin[{]
return[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=index)], documentation=None, modifiers={'private'}, type=BasicType(dimensions=[], name=int)), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), operandr=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getTabCount, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None), operator=<), operator=&&), label=None)], documentation=None, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])], member=getComponentAt, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Component, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[IfStatement(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])], member=removeTabAt, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None), label=None))], documentation=None, modifiers={'public'}, name=remove, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Component, sub_type=None))], dimensions=None, name=Iterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Iterator] operator[<] identifier[Component] operator[>] identifier[iterator] operator[SEP] Keyword[final] identifier[JTabbedPane] identifier[self] operator[SEP] {
Keyword[return] Keyword[new] identifier[Iterator] operator[<] identifier[Component] operator[>] operator[SEP] operator[SEP] {
Keyword[private] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] identifier[index] operator[>] operator[-] Other[1] operator[&&] identifier[index] operator[<] identifier[self] operator[SEP] identifier[getTabCount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] identifier[Component] identifier[next] operator[SEP] operator[SEP] {
Keyword[return] identifier[self] operator[SEP] identifier[getComponentAt] operator[SEP] identifier[index] operator[++] operator[SEP] operator[SEP]
}
Keyword[public] Keyword[void] identifier[remove] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[self] operator[SEP] identifier[removeTabAt] operator[SEP] identifier[index] operator[--] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
private void createKuduTable(TableInfo tableInfo)
{
List<ColumnSchema> columns = new ArrayList<ColumnSchema>();
// add key
if (tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class))
{
// composite keys
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
puMetadata.getPersistenceUnitName());
EmbeddableType embeddableIdType = metaModel.embeddable(tableInfo.getTableIdType());
Field[] fields = tableInfo.getTableIdType().getDeclaredFields();
addPrimaryKeyColumnsFromEmbeddable(columns, embeddableIdType, fields, metaModel);
}
else
{
// simple key
columns.add(new ColumnSchema.ColumnSchemaBuilder(tableInfo.getIdColumnName(), KuduDBValidationClassMapper
.getValidTypeForClass(tableInfo.getTableIdType())).key(true).build());
}
// add other columns
for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
{
ColumnSchemaBuilder columnSchemaBuilder = new ColumnSchema.ColumnSchemaBuilder(columnInfo.getColumnName(),
KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType()));
columns.add(columnSchemaBuilder.build());
}
// add embedded columns
for (EmbeddedColumnInfo embColumnInfo : tableInfo.getEmbeddedColumnMetadatas())
{
if (embColumnInfo.getEmbeddedColumnName().equals(tableInfo.getIdColumnName()))
{
// skip for embeddable ids
continue;
}
buildColumnsFromEmbeddableColumn(embColumnInfo, columns);
}
Schema schema = new Schema(columns);
try
{
CreateTableOptions builder = new CreateTableOptions();
List<String> rangeKeys = new ArrayList<>();
// handle for composite Id
if (tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class))
{
Iterator<ColumnSchema> colIter = columns.iterator();
while (colIter.hasNext())
{
ColumnSchema col = colIter.next();
if (col.isKey())
{
rangeKeys.add(col.getName());
}
}
}
else
{
rangeKeys.add(tableInfo.getIdColumnName());
}
// TODO: Hard Coded Range Partitioning
builder.setRangePartitionColumns(rangeKeys);
client.createTable(tableInfo.getTableName(), schema, builder);
logger.debug("Table: " + tableInfo.getTableName() + " created successfully");
}
catch (Exception e)
{
logger.error("Table: " + tableInfo.getTableName() + " cannot be created, Caused by: " + e.getMessage(), e);
throw new SchemaGenerationException("Table: " + tableInfo.getTableName()
+ " cannot be created, Caused by: " + e.getMessage(), e, "Kudu");
}
} | class class_name[name] begin[{]
method[createKuduTable, return_type[void], modifier[private], parameter[tableInfo]] begin[{]
local_variable[type[List], columns]
if[call[tableInfo.getTableIdType, parameter[]]] begin[{]
local_variable[type[MetamodelImpl], metaModel]
local_variable[type[EmbeddableType], embeddableIdType]
local_variable[type[Field], fields]
call[.addPrimaryKeyColumnsFromEmbeddable, parameter[member[.columns], member[.embeddableIdType], member[.fields], member[.metaModel]]]
else begin[{]
call[columns.add, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getIdColumnName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableIdType, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None)], member=getValidTypeForClass, postfix_operators=[], prefix_operators=[], qualifier=KuduDBValidationClassMapper, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ColumnSchema, sub_type=ReferenceType(arguments=None, dimensions=None, name=ColumnSchemaBuilder, sub_type=None)))]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=columnInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=columnInfo, selectors=[], type_arguments=None)], member=getValidTypeForClass, postfix_operators=[], prefix_operators=[], qualifier=KuduDBValidationClassMapper, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ColumnSchema, sub_type=ReferenceType(arguments=None, dimensions=None, name=ColumnSchemaBuilder, sub_type=None))), name=columnSchemaBuilder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnSchemaBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=columnSchemaBuilder, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=columns, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getColumnMetadatas, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=columnInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnInfo, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getEmbeddedColumnName, postfix_operators=[], prefix_operators=[], qualifier=embColumnInfo, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdColumnName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, 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=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=embColumnInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildColumnsFromEmbeddableColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getEmbeddedColumnMetadatas, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=embColumnInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EmbeddedColumnInfo, sub_type=None))), label=None)
local_variable[type[Schema], schema]
TryStatement(block=[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=CreateTableOptions, sub_type=None)), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateTableOptions, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=rangeKeys)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getTableIdType, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Embeddable, sub_type=None))], member=isAnnotationPresent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdColumnName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=rangeKeys, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=columns, selectors=[], type_arguments=None), name=colIter)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ColumnSchema, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=colIter, selectors=[], type_arguments=None), name=col)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnSchema, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isKey, postfix_operators=[], prefix_operators=[], qualifier=col, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=col, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=rangeKeys, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=colIter, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rangeKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRangePartitionColumns, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createTable, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table: "), operandr=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" created successfully"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table: "), operandr=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" cannot be created, Caused by: "), operator=+), 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=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table: "), operandr=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tableInfo, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" cannot be created, Caused by: "), operator=+), 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=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Kudu")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SchemaGenerationException, 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[private] Keyword[void] identifier[createKuduTable] operator[SEP] identifier[TableInfo] identifier[tableInfo] operator[SEP] {
identifier[List] operator[<] identifier[ColumnSchema] operator[>] identifier[columns] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ColumnSchema] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getTableIdType] operator[SEP] operator[SEP] operator[SEP] identifier[isAnnotationPresent] operator[SEP] identifier[Embeddable] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[MetamodelImpl] identifier[metaModel] operator[=] operator[SEP] identifier[MetamodelImpl] operator[SEP] identifier[kunderaMetadata] operator[SEP] identifier[getApplicationMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getMetamodel] operator[SEP] identifier[puMetadata] operator[SEP] identifier[getPersistenceUnitName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[EmbeddableType] identifier[embeddableIdType] operator[=] identifier[metaModel] operator[SEP] identifier[embeddable] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getTableIdType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Field] operator[SEP] operator[SEP] identifier[fields] operator[=] identifier[tableInfo] operator[SEP] identifier[getTableIdType] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] identifier[addPrimaryKeyColumnsFromEmbeddable] operator[SEP] identifier[columns] , identifier[embeddableIdType] , identifier[fields] , identifier[metaModel] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[columns] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ColumnSchema] operator[SEP] identifier[ColumnSchemaBuilder] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getIdColumnName] operator[SEP] operator[SEP] , identifier[KuduDBValidationClassMapper] operator[SEP] identifier[getValidTypeForClass] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getTableIdType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ColumnInfo] identifier[columnInfo] operator[:] identifier[tableInfo] operator[SEP] identifier[getColumnMetadatas] operator[SEP] operator[SEP] operator[SEP] {
identifier[ColumnSchemaBuilder] identifier[columnSchemaBuilder] operator[=] Keyword[new] identifier[ColumnSchema] operator[SEP] identifier[ColumnSchemaBuilder] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , identifier[KuduDBValidationClassMapper] operator[SEP] identifier[getValidTypeForClass] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[add] operator[SEP] identifier[columnSchemaBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[EmbeddedColumnInfo] identifier[embColumnInfo] operator[:] identifier[tableInfo] operator[SEP] identifier[getEmbeddedColumnMetadatas] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[embColumnInfo] operator[SEP] identifier[getEmbeddedColumnName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getIdColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[buildColumnsFromEmbeddableColumn] operator[SEP] identifier[embColumnInfo] , identifier[columns] operator[SEP] operator[SEP]
}
identifier[Schema] identifier[schema] operator[=] Keyword[new] identifier[Schema] operator[SEP] identifier[columns] operator[SEP] operator[SEP] Keyword[try] {
identifier[CreateTableOptions] identifier[builder] operator[=] Keyword[new] identifier[CreateTableOptions] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[rangeKeys] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getTableIdType] operator[SEP] operator[SEP] operator[SEP] identifier[isAnnotationPresent] operator[SEP] identifier[Embeddable] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[Iterator] operator[<] identifier[ColumnSchema] operator[>] identifier[colIter] operator[=] identifier[columns] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[colIter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[ColumnSchema] identifier[col] operator[=] identifier[colIter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[col] operator[SEP] identifier[isKey] operator[SEP] operator[SEP] operator[SEP] {
identifier[rangeKeys] operator[SEP] identifier[add] operator[SEP] identifier[col] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[rangeKeys] operator[SEP] identifier[add] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getIdColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[setRangePartitionColumns] operator[SEP] identifier[rangeKeys] operator[SEP] operator[SEP] identifier[client] operator[SEP] identifier[createTable] operator[SEP] identifier[tableInfo] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[schema] , identifier[builder] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[tableInfo] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[tableInfo] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SchemaGenerationException] operator[SEP] literal[String] operator[+] identifier[tableInfo] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] , literal[String] operator[SEP] operator[SEP]
}
}
|
private void connect() {
try {
WebSocketFactory factory = new WebSocketFactory();
String webSocketUri = getGateway(api) + "?encoding=json&v=" + Javacord.DISCORD_GATEWAY_VERSION;
Proxy proxy = api.getProxy().orElseGet(() -> {
List<Proxy> proxies = api.getProxySelector().orElseGet(ProxySelector::getDefault).select(URI.create(
webSocketUri.replace("wss://", "https://").replace("ws://", "http://")));
return proxies.stream()
.filter(p -> p.type() == Proxy.Type.DIRECT)
.findAny()
.orElseGet(() -> proxies.stream()
.filter(p -> p.type() == Proxy.Type.HTTP)
.findAny()
.orElseGet(() -> proxies.get(0)));
});
switch (proxy.type()) {
case DIRECT:
// nothing to do
break;
case HTTP:
SocketAddress proxyAddress = proxy.address();
if (!(proxyAddress instanceof InetSocketAddress)) {
throw new WebSocketException(
null, "HTTP proxies without an InetSocketAddress are not supported currently");
}
InetSocketAddress proxyInetAddress = ((InetSocketAddress) proxyAddress);
String proxyHost = proxyInetAddress.getHostString();
int proxyPort = proxyInetAddress.getPort();
ProxySettings proxySettings = factory.getProxySettings();
proxySettings.setHost(proxyHost).setPort(proxyPort);
Optional<Authenticator> proxyAuthenticator = api.getProxyAuthenticator();
URL webSocketUrl = URI.create(
webSocketUri.replace("wss://", "https://").replace("ws://", "http://")).toURL();
if (proxyAuthenticator.isPresent()) {
Map<String, List<String>> requestHeaders = proxyAuthenticator.get().authenticate(
new NvWebSocketRouteImpl(webSocketUrl, proxy, proxyInetAddress),
new Request() { },
new NvWebSocketResponseImpl());
if (requestHeaders != null) {
requestHeaders.forEach((headerName, headerValues) -> {
if (headerValues == null) {
proxySettings.getHeaders().remove(headerName);
return;
}
if (headerValues.isEmpty()) {
return;
}
String firstHeaderValue = headerValues.get(0);
if (firstHeaderValue == null) {
proxySettings.getHeaders().remove(headerName);
} else {
proxySettings.addHeader(headerName, firstHeaderValue);
}
headerValues.stream().skip(1).forEach(
headerValue -> proxySettings.addHeader(headerName, headerValue));
});
}
} else {
PasswordAuthentication credentials = java.net.Authenticator.requestPasswordAuthentication(
proxyHost, proxyInetAddress.getAddress(), proxyPort, webSocketUrl.getProtocol(), null,
"Basic", webSocketUrl, java.net.Authenticator.RequestorType.PROXY);
if (credentials != null) {
proxySettings
.setId(credentials.getUserName())
.setPassword(String.valueOf(credentials.getPassword()));
}
}
break;
default:
throw new WebSocketException(
null, "Proxies of type '" + proxy.type() + "' are not supported currently");
}
if (api.isTrustAllCertificates()) {
factory.setSSLSocketFactory(new TrustAllTrustManager().createSslSocketFactory());
}
WebSocket websocket = factory.createSocket(webSocketUri);
this.websocket.set(websocket);
websocket.addHeader("Accept-Encoding", "gzip");
websocket.addListener(this);
websocket.addListener(new WebSocketLogger());
waitForIdentifyRateLimit();
websocket.connect();
} catch (Throwable t) {
logger.warn("An error occurred while connecting to websocket", t);
if (reconnect) {
reconnectAttempt.incrementAndGet();
logger.info("Trying to reconnect/resume in {} seconds!", api.getReconnectDelay(reconnectAttempt.get()));
// Reconnect after a (short?) delay depending on the amount of reconnect attempts
api.getThreadPool().getScheduler()
.schedule(() -> {
gatewayWriteLock.lock();
try {
gateway = null;
} finally {
gatewayWriteLock.unlock();
}
this.connect();
}, api.getReconnectDelay(reconnectAttempt.get()), TimeUnit.SECONDS);
}
}
} | class class_name[name] begin[{]
method[connect, return_type[void], modifier[private], parameter[]] begin[{]
TryStatement(block=[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=WebSocketFactory, sub_type=None)), name=factory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WebSocketFactory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=api, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getGateway, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="?encoding=json&v="), operator=+), operandr=MemberReference(member=DISCORD_GATEWAY_VERSION, postfix_operators=[], prefix_operators=[], qualifier=Javacord, selectors=[]), operator=+), name=webSocketUri)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getProxy, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[MethodInvocation(arguments=[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getProxySelector, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[MethodInvocation(arguments=[MethodReference(expression=MemberReference(member=ProxySelector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=orElseGet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="wss://"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="https://")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=webSocketUri, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ws://"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http://")], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=URI, selectors=[], type_arguments=None)], member=select, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=proxies)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Proxy, sub_type=None))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=proxies, selectors=[MethodInvocation(arguments=[LambdaExpression(body=BinaryOperation(operandl=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), operandr=MemberReference(member=DIRECT, postfix_operators=[], prefix_operators=[], qualifier=Proxy.Type, selectors=[]), operator===), parameters=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=filter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=findAny, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=proxies, selectors=[MethodInvocation(arguments=[LambdaExpression(body=BinaryOperation(operandl=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), operandr=MemberReference(member=HTTP, postfix_operators=[], prefix_operators=[], qualifier=Proxy.Type, selectors=[]), operator===), parameters=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=filter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=findAny, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=proxies, selectors=[], type_arguments=None), parameters=[])], member=orElseGet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[])], member=orElseGet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[])], member=orElseGet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=proxy)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Proxy, sub_type=None)), SwitchStatement(cases=[SwitchStatementCase(case=['DIRECT'], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['HTTP'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=address, postfix_operators=[], prefix_operators=[], qualifier=proxy, selectors=[], type_arguments=None), name=proxyAddress)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SocketAddress, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=proxyAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=InetSocketAddress, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="HTTP proxies without an InetSocketAddress are not supported currently")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebSocketException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=proxyAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InetSocketAddress, sub_type=None)), name=proxyInetAddress)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InetSocketAddress, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHostString, postfix_operators=[], prefix_operators=[], qualifier=proxyInetAddress, selectors=[], type_arguments=None), name=proxyHost)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPort, postfix_operators=[], prefix_operators=[], qualifier=proxyInetAddress, selectors=[], type_arguments=None), name=proxyPort)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getProxySettings, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), name=proxySettings)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ProxySettings, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=proxyHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHost, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[MethodInvocation(arguments=[MemberReference(member=proxyPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getProxyAuthenticator, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[], type_arguments=None), name=proxyAuthenticator)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Authenticator, sub_type=None))], dimensions=[], name=Optional, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="wss://"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="https://")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=webSocketUri, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ws://"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http://")], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=URI, selectors=[MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=webSocketUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isPresent, postfix_operators=[], prefix_operators=[], qualifier=proxyAuthenticator, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=proxyHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=proxyInetAddress, selectors=[], type_arguments=None), MemberReference(member=proxyPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getProtocol, postfix_operators=[], prefix_operators=[], qualifier=webSocketUrl, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Basic"), MemberReference(member=webSocketUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PROXY, postfix_operators=[], prefix_operators=[], qualifier=java.net.Authenticator.RequestorType, selectors=[])], member=requestPasswordAuthentication, postfix_operators=[], prefix_operators=[], qualifier=java.net.Authenticator, selectors=[], type_arguments=None), name=credentials)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PasswordAuthentication, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=credentials, 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=[MethodInvocation(arguments=[], member=getUserName, postfix_operators=[], prefix_operators=[], qualifier=credentials, selectors=[], type_arguments=None)], member=setId, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPassword, postfix_operators=[], prefix_operators=[], qualifier=credentials, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=setPassword, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=proxyAuthenticator, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=webSocketUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=proxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=proxyInetAddress, 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=NvWebSocketRouteImpl, sub_type=None)), ClassCreator(arguments=[], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Request, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NvWebSocketResponseImpl, sub_type=None))], member=authenticate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=requestHeaders)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=requestHeaders, 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=[LambdaExpression(body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=headerValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getHeaders, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[MethodInvocation(arguments=[MemberReference(member=headerName, 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), ReturnStatement(expression=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=headerValues, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=headerValues, selectors=[], type_arguments=None), name=firstHeaderValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=firstHeaderValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=headerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=firstHeaderValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getHeaders, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[MethodInvocation(arguments=[MemberReference(member=headerName, 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)])), StatementExpression(expression=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=headerValues, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=skip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=headerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=headerValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=proxySettings, selectors=[], type_arguments=None), parameters=[MemberReference(member=headerValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=forEach, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[InferredFormalParameter(name=headerName), InferredFormalParameter(name=headerValues)])], member=forEach, postfix_operators=[], prefix_operators=[], qualifier=requestHeaders, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Proxies of type '"), operandr=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=proxy, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' are not supported currently"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebSocketException, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=proxy, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isTrustAllCertificates, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=createSslSocketFactory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=TrustAllTrustManager, sub_type=None))], member=setSSLSocketFactory, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=webSocketUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSocket, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), name=websocket)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WebSocket, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=websocket, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=websocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Accept-Encoding"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gzip")], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=websocket, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addListener, postfix_operators=[], prefix_operators=[], qualifier=websocket, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebSocketLogger, sub_type=None))], member=addListener, postfix_operators=[], prefix_operators=[], qualifier=websocket, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=waitForIdentifyRateLimit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=connect, postfix_operators=[], prefix_operators=[], qualifier=websocket, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An error occurred while connecting to websocket"), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=reconnect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=incrementAndGet, postfix_operators=[], prefix_operators=[], qualifier=reconnectAttempt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Trying to reconnect/resume in {} seconds!"), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=reconnectAttempt, selectors=[], type_arguments=None)], member=getReconnectDelay, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getThreadPool, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[MethodInvocation(arguments=[], member=getScheduler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[], member=lock, postfix_operators=[], prefix_operators=[], qualifier=gatewayWriteLock, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=gateway, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=gatewayWriteLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=connect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], parameters=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=reconnectAttempt, selectors=[], type_arguments=None)], member=getReconnectDelay, postfix_operators=[], prefix_operators=[], qualifier=api, selectors=[], type_arguments=None), MemberReference(member=SECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=schedule, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[connect] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[WebSocketFactory] identifier[factory] operator[=] Keyword[new] identifier[WebSocketFactory] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[webSocketUri] operator[=] identifier[getGateway] operator[SEP] identifier[api] operator[SEP] operator[+] literal[String] operator[+] identifier[Javacord] operator[SEP] identifier[DISCORD_GATEWAY_VERSION] operator[SEP] identifier[Proxy] identifier[proxy] operator[=] identifier[api] operator[SEP] identifier[getProxy] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] {
identifier[List] operator[<] identifier[Proxy] operator[>] identifier[proxies] operator[=] identifier[api] operator[SEP] identifier[getProxySelector] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] identifier[ProxySelector] operator[::] identifier[getDefault] operator[SEP] operator[SEP] identifier[select] operator[SEP] identifier[URI] operator[SEP] identifier[create] operator[SEP] identifier[webSocketUri] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[proxies] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[p] operator[->] identifier[p] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[==] identifier[Proxy] operator[SEP] identifier[Type] operator[SEP] identifier[DIRECT] operator[SEP] operator[SEP] identifier[findAny] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[proxies] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[p] operator[->] identifier[p] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[==] identifier[Proxy] operator[SEP] identifier[Type] operator[SEP] identifier[HTTP] operator[SEP] operator[SEP] identifier[findAny] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[proxies] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[proxy] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[DIRECT] operator[:] Keyword[break] operator[SEP] Keyword[case] identifier[HTTP] operator[:] identifier[SocketAddress] identifier[proxyAddress] operator[=] identifier[proxy] operator[SEP] identifier[address] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[proxyAddress] Keyword[instanceof] identifier[InetSocketAddress] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WebSocketException] operator[SEP] Other[null] , literal[String] operator[SEP] operator[SEP]
}
identifier[InetSocketAddress] identifier[proxyInetAddress] operator[=] operator[SEP] operator[SEP] identifier[InetSocketAddress] operator[SEP] identifier[proxyAddress] operator[SEP] operator[SEP] identifier[String] identifier[proxyHost] operator[=] identifier[proxyInetAddress] operator[SEP] identifier[getHostString] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[proxyPort] operator[=] identifier[proxyInetAddress] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] identifier[ProxySettings] identifier[proxySettings] operator[=] identifier[factory] operator[SEP] identifier[getProxySettings] operator[SEP] operator[SEP] operator[SEP] identifier[proxySettings] operator[SEP] identifier[setHost] operator[SEP] identifier[proxyHost] operator[SEP] operator[SEP] identifier[setPort] operator[SEP] identifier[proxyPort] operator[SEP] operator[SEP] identifier[Optional] operator[<] identifier[Authenticator] operator[>] identifier[proxyAuthenticator] operator[=] identifier[api] operator[SEP] identifier[getProxyAuthenticator] operator[SEP] operator[SEP] operator[SEP] identifier[URL] identifier[webSocketUrl] operator[=] identifier[URI] operator[SEP] identifier[create] operator[SEP] identifier[webSocketUri] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proxyAuthenticator] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[requestHeaders] operator[=] identifier[proxyAuthenticator] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[authenticate] operator[SEP] Keyword[new] identifier[NvWebSocketRouteImpl] operator[SEP] identifier[webSocketUrl] , identifier[proxy] , identifier[proxyInetAddress] operator[SEP] , Keyword[new] identifier[Request] operator[SEP] operator[SEP] {
} , Keyword[new] identifier[NvWebSocketResponseImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[requestHeaders] operator[!=] Other[null] operator[SEP] {
identifier[requestHeaders] operator[SEP] identifier[forEach] operator[SEP] operator[SEP] identifier[headerName] , identifier[headerValues] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[headerValues] operator[==] Other[null] operator[SEP] {
identifier[proxySettings] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[headerName] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[headerValues] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[String] identifier[firstHeaderValue] operator[=] identifier[headerValues] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstHeaderValue] operator[==] Other[null] operator[SEP] {
identifier[proxySettings] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[headerName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[proxySettings] operator[SEP] identifier[addHeader] operator[SEP] identifier[headerName] , identifier[firstHeaderValue] operator[SEP] operator[SEP]
}
identifier[headerValues] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[skip] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[headerValue] operator[->] identifier[proxySettings] operator[SEP] identifier[addHeader] operator[SEP] identifier[headerName] , identifier[headerValue] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[PasswordAuthentication] identifier[credentials] operator[=] identifier[java] operator[SEP] identifier[net] operator[SEP] identifier[Authenticator] operator[SEP] identifier[requestPasswordAuthentication] operator[SEP] identifier[proxyHost] , identifier[proxyInetAddress] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[proxyPort] , identifier[webSocketUrl] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] , Other[null] , literal[String] , identifier[webSocketUrl] , identifier[java] operator[SEP] identifier[net] operator[SEP] identifier[Authenticator] operator[SEP] identifier[RequestorType] operator[SEP] identifier[PROXY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[credentials] operator[!=] Other[null] operator[SEP] {
identifier[proxySettings] operator[SEP] identifier[setId] operator[SEP] identifier[credentials] operator[SEP] identifier[getUserName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setPassword] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[credentials] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[WebSocketException] operator[SEP] Other[null] , literal[String] operator[+] identifier[proxy] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[api] operator[SEP] identifier[isTrustAllCertificates] operator[SEP] operator[SEP] operator[SEP] {
identifier[factory] operator[SEP] identifier[setSSLSocketFactory] operator[SEP] Keyword[new] identifier[TrustAllTrustManager] operator[SEP] operator[SEP] operator[SEP] identifier[createSslSocketFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[WebSocket] identifier[websocket] operator[=] identifier[factory] operator[SEP] identifier[createSocket] operator[SEP] identifier[webSocketUri] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[websocket] operator[SEP] identifier[set] operator[SEP] identifier[websocket] operator[SEP] operator[SEP] identifier[websocket] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[websocket] operator[SEP] identifier[addListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[websocket] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[WebSocketLogger] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[waitForIdentifyRateLimit] operator[SEP] operator[SEP] operator[SEP] identifier[websocket] operator[SEP] identifier[connect] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[t] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reconnect] operator[SEP] {
identifier[reconnectAttempt] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[api] operator[SEP] identifier[getReconnectDelay] operator[SEP] identifier[reconnectAttempt] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[api] operator[SEP] identifier[getThreadPool] operator[SEP] operator[SEP] operator[SEP] identifier[getScheduler] operator[SEP] operator[SEP] operator[SEP] identifier[schedule] operator[SEP] operator[SEP] operator[SEP] operator[->] {
identifier[gatewayWriteLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[gateway] operator[=] Other[null] operator[SEP]
}
Keyword[finally] {
identifier[gatewayWriteLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[connect] operator[SEP] operator[SEP] operator[SEP]
} , identifier[api] operator[SEP] identifier[getReconnectDelay] operator[SEP] identifier[reconnectAttempt] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
}
}
}
|
private long[] determinePreferenceVectorByMaxIntersection(ModifiableDBIDs[] neighborIDs, StringBuilder msg) {
int dimensionality = neighborIDs.length;
long[] preferenceVector = BitsUtil.zero(dimensionality);
Map<Integer, ModifiableDBIDs> candidates = new HashMap<>(dimensionality);
for(int i = 0; i < dimensionality; i++) {
ModifiableDBIDs s_i = neighborIDs[i];
if(s_i.size() > minpts) {
candidates.put(i, s_i);
}
}
if(msg != null) {
msg.append("\n candidates ").append(candidates.keySet());
}
if(!candidates.isEmpty()) {
int i = max(candidates);
ModifiableDBIDs intersection = candidates.remove(i);
BitsUtil.setI(preferenceVector, i);
while(!candidates.isEmpty()) {
i = maxIntersection(candidates, intersection);
candidates.remove(i);
if(intersection.size() < minpts) {
break;
}
BitsUtil.setI(preferenceVector, i);
}
}
if(msg != null) {
msg.append("\n preference ").append(BitsUtil.toStringLow(preferenceVector, dimensionality));
LOG.debug(msg.toString());
}
return preferenceVector;
} | class class_name[name] begin[{]
method[determinePreferenceVectorByMaxIntersection, return_type[type[long]], modifier[private], parameter[neighborIDs, msg]] begin[{]
local_variable[type[int], dimensionality]
local_variable[type[long], preferenceVector]
local_variable[type[Map], candidates]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=neighborIDs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=s_i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ModifiableDBIDs, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=s_i, selectors=[], type_arguments=None), operandr=MemberReference(member=minpts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=s_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dimensionality, 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[.msg], !=, literal[null]]] begin[{]
call[msg.append, parameter[literal["\n candidates "]]]
else begin[{]
None
end[}]
if[call[candidates.isEmpty, parameter[]]] begin[{]
local_variable[type[int], i]
local_variable[type[ModifiableDBIDs], intersection]
call[BitsUtil.setI, parameter[member[.preferenceVector], member[.i]]]
while[call[candidates.isEmpty, parameter[]]] begin[{]
assign[member[.i], call[.maxIntersection, parameter[member[.candidates], member[.intersection]]]]
call[candidates.remove, parameter[member[.i]]]
if[binary_operation[call[intersection.size, parameter[]], <, member[.minpts]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[BitsUtil.setI, parameter[member[.preferenceVector], member[.i]]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.msg], !=, literal[null]]] begin[{]
call[msg.append, parameter[literal["\n preference "]]]
call[LOG.debug, parameter[call[msg.toString, parameter[]]]]
else begin[{]
None
end[}]
return[member[.preferenceVector]]
end[}]
END[}] | Keyword[private] Keyword[long] operator[SEP] operator[SEP] identifier[determinePreferenceVectorByMaxIntersection] operator[SEP] identifier[ModifiableDBIDs] operator[SEP] operator[SEP] identifier[neighborIDs] , identifier[StringBuilder] identifier[msg] operator[SEP] {
Keyword[int] identifier[dimensionality] operator[=] identifier[neighborIDs] operator[SEP] identifier[length] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[preferenceVector] operator[=] identifier[BitsUtil] operator[SEP] identifier[zero] operator[SEP] identifier[dimensionality] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Integer] , identifier[ModifiableDBIDs] operator[>] identifier[candidates] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] identifier[dimensionality] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[dimensionality] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ModifiableDBIDs] identifier[s_i] operator[=] identifier[neighborIDs] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s_i] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] identifier[minpts] operator[SEP] {
identifier[candidates] operator[SEP] identifier[put] operator[SEP] identifier[i] , identifier[s_i] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[msg] operator[!=] Other[null] operator[SEP] {
identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[candidates] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[candidates] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[max] operator[SEP] identifier[candidates] operator[SEP] operator[SEP] identifier[ModifiableDBIDs] identifier[intersection] operator[=] identifier[candidates] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[BitsUtil] operator[SEP] identifier[setI] operator[SEP] identifier[preferenceVector] , identifier[i] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[candidates] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[=] identifier[maxIntersection] operator[SEP] identifier[candidates] , identifier[intersection] operator[SEP] operator[SEP] identifier[candidates] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[intersection] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[minpts] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[BitsUtil] operator[SEP] identifier[setI] operator[SEP] identifier[preferenceVector] , identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[msg] operator[!=] Other[null] operator[SEP] {
identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[BitsUtil] operator[SEP] identifier[toStringLow] operator[SEP] identifier[preferenceVector] , identifier[dimensionality] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[preferenceVector] operator[SEP]
}
|
public static String parseResource(String XMPPAddress) {
if (XMPPAddress == null) {
return null;
}
int slashIndex = XMPPAddress.indexOf("/");
if (slashIndex + 1 > XMPPAddress.length() || slashIndex < 0) {
return "";
} else {
return XMPPAddress.substring(slashIndex + 1);
}
} | class class_name[name] begin[{]
method[parseResource, return_type[type[String]], modifier[public static], parameter[XMPPAddress]] begin[{]
if[binary_operation[member[.XMPPAddress], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], slashIndex]
if[binary_operation[binary_operation[binary_operation[member[.slashIndex], +, literal[1]], >, call[XMPPAddress.length, parameter[]]], ||, binary_operation[member[.slashIndex], <, literal[0]]]] begin[{]
return[literal[""]]
else begin[{]
return[call[XMPPAddress.substring, parameter[binary_operation[member[.slashIndex], +, literal[1]]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[parseResource] operator[SEP] identifier[String] identifier[XMPPAddress] operator[SEP] {
Keyword[if] operator[SEP] identifier[XMPPAddress] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[slashIndex] operator[=] identifier[XMPPAddress] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[slashIndex] operator[+] Other[1] operator[>] identifier[XMPPAddress] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] identifier[slashIndex] operator[<] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[XMPPAddress] operator[SEP] identifier[substring] operator[SEP] identifier[slashIndex] operator[+] Other[1] operator[SEP] operator[SEP]
}
}
|
private void leftSearch(
SearchComparator comp,
GBSNode p,
GBSNode r,
Object searchKey,
SearchNode point)
{
if (r == null) /* There is no upper predecessor */
{
int idx = p.searchLeft(comp, searchKey);
if ( !(idx < 0) )
point.setFound(p, idx);
}
else /* There is an upper predecessor */
{
int xcc = comp.compare(searchKey, r.rightMostKey());
if (xcc == 0) /* Target is right-most in upper pred. */
point.setFound(r, r.rightMostIndex());
else if (xcc > 0) /* Target (if it exists) is in left */
{
/* half of current node */
int idx = p.searchLeft(comp, searchKey);
if ( !(idx < 0) )
point.setFound(p, idx);
}
else /* Target (if it exists) is in right */
{
/* half of predecessor (if it exists) */
int idx = r.searchRight(comp, searchKey);
if ( !(idx < 0) )
point.setFound(r, idx);
}
}
} | class class_name[name] begin[{]
method[leftSearch, return_type[void], modifier[private], parameter[comp, p, r, searchKey, point]] begin[{]
if[binary_operation[member[.r], ==, literal[null]]] begin[{]
local_variable[type[int], idx]
if[binary_operation[member[.idx], <, literal[0]]] begin[{]
call[point.setFound, parameter[member[.p], member[.idx]]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[int], xcc]
if[binary_operation[member[.xcc], ==, literal[0]]] begin[{]
call[point.setFound, parameter[member[.r], call[r.rightMostIndex, parameter[]]]]
else begin[{]
if[binary_operation[member[.xcc], >, literal[0]]] begin[{]
local_variable[type[int], idx]
if[binary_operation[member[.idx], <, literal[0]]] begin[{]
call[point.setFound, parameter[member[.p], member[.idx]]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[int], idx]
if[binary_operation[member[.idx], <, literal[0]]] begin[{]
call[point.setFound, parameter[member[.r], member[.idx]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[leftSearch] operator[SEP] identifier[SearchComparator] identifier[comp] , identifier[GBSNode] identifier[p] , identifier[GBSNode] identifier[r] , identifier[Object] identifier[searchKey] , identifier[SearchNode] identifier[point] operator[SEP] {
Keyword[if] operator[SEP] identifier[r] operator[==] Other[null] operator[SEP] {
Keyword[int] identifier[idx] operator[=] identifier[p] operator[SEP] identifier[searchLeft] operator[SEP] identifier[comp] , identifier[searchKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[idx] operator[<] Other[0] operator[SEP] operator[SEP] identifier[point] operator[SEP] identifier[setFound] operator[SEP] identifier[p] , identifier[idx] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[xcc] operator[=] identifier[comp] operator[SEP] identifier[compare] operator[SEP] identifier[searchKey] , identifier[r] operator[SEP] identifier[rightMostKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[xcc] operator[==] Other[0] operator[SEP] identifier[point] operator[SEP] identifier[setFound] operator[SEP] identifier[r] , identifier[r] operator[SEP] identifier[rightMostIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[xcc] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[idx] operator[=] identifier[p] operator[SEP] identifier[searchLeft] operator[SEP] identifier[comp] , identifier[searchKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[idx] operator[<] Other[0] operator[SEP] operator[SEP] identifier[point] operator[SEP] identifier[setFound] operator[SEP] identifier[p] , identifier[idx] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[idx] operator[=] identifier[r] operator[SEP] identifier[searchRight] operator[SEP] identifier[comp] , identifier[searchKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[idx] operator[<] Other[0] operator[SEP] operator[SEP] identifier[point] operator[SEP] identifier[setFound] operator[SEP] identifier[r] , identifier[idx] operator[SEP] operator[SEP]
}
}
}
|
public final void pinsrw(MMRegister dst, Register src, Immediate imm8)
{
emitX86(INST_PINSRW, dst, src, imm8);
} | class class_name[name] begin[{]
method[pinsrw, return_type[void], modifier[final public], parameter[dst, src, imm8]] begin[{]
call[.emitX86, parameter[member[.INST_PINSRW], member[.dst], member[.src], member[.imm8]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[pinsrw] operator[SEP] identifier[MMRegister] identifier[dst] , identifier[Register] identifier[src] , identifier[Immediate] identifier[imm8] operator[SEP] {
identifier[emitX86] operator[SEP] identifier[INST_PINSRW] , identifier[dst] , identifier[src] , identifier[imm8] operator[SEP] operator[SEP]
}
|
public DUser findByEmail(java.lang.String email) {
return queryUniqueByField(null, DUserMapper.Field.EMAIL.getFieldName(), email);
} | class class_name[name] begin[{]
method[findByEmail, return_type[type[DUser]], modifier[public], parameter[email]] begin[{]
return[call[.queryUniqueByField, parameter[literal[null], call[DUserMapper.Field.EMAIL.getFieldName, parameter[]], member[.email]]]]
end[}]
END[}] | Keyword[public] identifier[DUser] identifier[findByEmail] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[email] operator[SEP] {
Keyword[return] identifier[queryUniqueByField] operator[SEP] Other[null] , identifier[DUserMapper] operator[SEP] identifier[Field] operator[SEP] identifier[EMAIL] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] , identifier[email] operator[SEP] operator[SEP]
}
|
public void marshall(CreateChannelRequest createChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (createChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createChannelRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createChannelRequest.getId(), ID_BINDING);
protocolMarshaller.marshall(createChannelRequest.getTags(), TAGS_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[createChannelRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createChannelRequest], ==, 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=getDescription, postfix_operators=[], prefix_operators=[], qualifier=createChannelRequest, selectors=[], type_arguments=None), MemberReference(member=DESCRIPTION_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=getId, postfix_operators=[], prefix_operators=[], qualifier=createChannelRequest, 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=getTags, postfix_operators=[], prefix_operators=[], qualifier=createChannelRequest, selectors=[], type_arguments=None), MemberReference(member=TAGS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], 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[CreateChannelRequest] identifier[createChannelRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createChannelRequest] 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[createChannelRequest] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] , identifier[DESCRIPTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createChannelRequest] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createChannelRequest] operator[SEP] identifier[getTags] operator[SEP] operator[SEP] , identifier[TAGS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void run()
{
BaseMessage internalTrxMessage = (BaseMessage)this.getTargetMessage(); // Create my standard message.
if (internalTrxMessage != null)
{
// Get the transport type from the header and merge the transport properties with my header properties.
BaseMessageTransport transport = this.getMessageTransport(internalTrxMessage);
transport.sendMessage(internalTrxMessage, this);
transport.free();
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[BaseMessage], internalTrxMessage]
if[binary_operation[member[.internalTrxMessage], !=, literal[null]]] begin[{]
local_variable[type[BaseMessageTransport], transport]
call[transport.sendMessage, parameter[member[.internalTrxMessage], THIS[]]]
call[transport.free, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[BaseMessage] identifier[internalTrxMessage] operator[=] operator[SEP] identifier[BaseMessage] operator[SEP] Keyword[this] operator[SEP] identifier[getTargetMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[internalTrxMessage] operator[!=] Other[null] operator[SEP] {
identifier[BaseMessageTransport] identifier[transport] operator[=] Keyword[this] operator[SEP] identifier[getMessageTransport] operator[SEP] identifier[internalTrxMessage] operator[SEP] operator[SEP] identifier[transport] operator[SEP] identifier[sendMessage] operator[SEP] identifier[internalTrxMessage] , Keyword[this] operator[SEP] operator[SEP] identifier[transport] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public ForwardToView with(String varName, Object value) {
attributes.put(varName,value);
return this;
} | class class_name[name] begin[{]
method[with, return_type[type[ForwardToView]], modifier[public], parameter[varName, value]] begin[{]
call[attributes.put, parameter[member[.varName], member[.value]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ForwardToView] identifier[with] operator[SEP] identifier[String] identifier[varName] , identifier[Object] identifier[value] operator[SEP] {
identifier[attributes] operator[SEP] identifier[put] operator[SEP] identifier[varName] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void addOutgoingFor(String[] varNames, DifferentialFunction function) {
if (function.getOwnName() == null)
throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly");
if (ops.get(function.getOwnName()).getOutputsOfOp() != null && !ops.get(function.getOwnName()).getOutputsOfOp().isEmpty()) {
throw new ND4JIllegalStateException("Outgoing arguments already declared for " + function);
}
if (varNames == null)
throw new ND4JIllegalStateException("Var names can not be null!");
for (int i = 0; i < varNames.length; i++) {
if (varNames[i] == null)
throw new ND4JIllegalStateException("Variable name elements can not be null!");
}
ops.get(function.getOwnName()).setOutputsOfOp(Arrays.asList(varNames));
for (String resultName : varNames) {
variables.get(resultName).setOutputOfOp(function.getOwnName());
}
} | class class_name[name] begin[{]
method[addOutgoingFor, return_type[void], modifier[public], parameter[varNames, function]] begin[{]
if[binary_operation[call[function.getOwnName, parameter[]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Instance id can not be null. Function not initialized properly")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ND4JIllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[ops.get, parameter[call[function.getOwnName, parameter[]]]], !=, literal[null]], &&, call[ops.get, parameter[call[function.getOwnName, parameter[]]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Outgoing arguments already declared for "), operandr=MemberReference(member=function, 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=ND4JIllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.varNames], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Var names can not be null!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ND4JIllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=varNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Variable name elements can not be null!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ND4JIllegalStateException, sub_type=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=varNames, 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)
call[ops.get, parameter[call[function.getOwnName, parameter[]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resultName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=variables, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOwnName, postfix_operators=[], prefix_operators=[], qualifier=function, selectors=[], type_arguments=None)], member=setOutputOfOp, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=varNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=resultName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addOutgoingFor] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[varNames] , identifier[DifferentialFunction] identifier[function] operator[SEP] {
Keyword[if] operator[SEP] identifier[function] operator[SEP] identifier[getOwnName] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[ND4JIllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ops] operator[SEP] identifier[get] operator[SEP] identifier[function] operator[SEP] identifier[getOwnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getOutputsOfOp] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[ops] operator[SEP] identifier[get] operator[SEP] identifier[function] operator[SEP] identifier[getOwnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getOutputsOfOp] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ND4JIllegalStateException] operator[SEP] literal[String] operator[+] identifier[function] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[varNames] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[ND4JIllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[varNames] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[varNames] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[ND4JIllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ops] operator[SEP] identifier[get] operator[SEP] identifier[function] operator[SEP] identifier[getOwnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setOutputsOfOp] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[varNames] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[resultName] operator[:] identifier[varNames] operator[SEP] {
identifier[variables] operator[SEP] identifier[get] operator[SEP] identifier[resultName] operator[SEP] operator[SEP] identifier[setOutputOfOp] operator[SEP] identifier[function] operator[SEP] identifier[getOwnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void start() {
if (socket == null) {
throw new RuntimeException("Cannot bind a server that has not been initialized!");
}
running = true;
Thread t = new Thread(this);
t.setName("HttpServer");
t.start();
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.socket], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot bind a server that has not been initialized!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.running], literal[true]]
local_variable[type[Thread], t]
call[t.setName, parameter[literal["HttpServer"]]]
call[t.start, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[socket] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[running] operator[=] literal[boolean] operator[SEP] identifier[Thread] identifier[t] operator[=] Keyword[new] identifier[Thread] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[t] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[t] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void setRealObject(Serializable obj) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setRealObject", (obj == null ? "null" : obj.getClass()));
// Set all the values for the new 'real' object
realObject = obj;
hasRealObject = true;
hasSerializedRealObject = false;
// Clear any out of date information in the SoftReference
softRefToRealObject = null;
// We have a new payload so get rid of any serialized version of an old payload
getPayload().setChoiceField(JmsObjectBodyAccess.BODY, JmsObjectBodyAccess.IS_BODY_EMPTY);
clearCachedLengths();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setRealObject");
} | class class_name[name] begin[{]
method[setRealObject, return_type[void], modifier[public], parameter[obj]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setRealObject"], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null"))]]
else begin[{]
None
end[}]
assign[member[.realObject], member[.obj]]
assign[member[.hasRealObject], literal[true]]
assign[member[.hasSerializedRealObject], literal[false]]
assign[member[.softRefToRealObject], literal[null]]
call[.getPayload, parameter[]]
call[.clearCachedLengths, parameter[]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setRealObject"]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setRealObject] operator[SEP] identifier[Serializable] identifier[obj] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , operator[SEP] identifier[obj] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[obj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[realObject] operator[=] identifier[obj] operator[SEP] identifier[hasRealObject] operator[=] literal[boolean] operator[SEP] identifier[hasSerializedRealObject] operator[=] literal[boolean] operator[SEP] identifier[softRefToRealObject] operator[=] Other[null] operator[SEP] identifier[getPayload] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JmsObjectBodyAccess] operator[SEP] identifier[BODY] , identifier[JmsObjectBodyAccess] operator[SEP] identifier[IS_BODY_EMPTY] operator[SEP] operator[SEP] identifier[clearCachedLengths] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public void dispatch() {
// iterate by index to avoid concurrent modification exceptions
for (int i = 0; i < listeners.size(); i++) {
listeners.get(i).dispatch();
}
} | class class_name[name] begin[{]
method[dispatch, return_type[void], modifier[public], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=listeners, selectors=[MethodInvocation(arguments=[], member=dispatch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=listeners, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[dispatch] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[listeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[listeners] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dispatch] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static String handleLuceneSpecialChars(String condition){
if(condition == null || condition.equals("")){
return condition;
}
condition = condition.replace(":","/:");
condition = condition.replace("-","/-");
condition = condition.replace("+","/+");
condition = condition.replace("&","/&");
condition = condition.replace("!","/!");
condition = condition.replace("{","/{");
condition = condition.replace("}","/}");
condition = condition.replace("(","/(");
condition = condition.replace(")","/)");
condition = condition.replace("|","/|");
condition = condition.replace("~","/~");
condition = condition.replace("*","/*");
condition = condition.replace("?","/?");
condition = condition.replace("/","//");
// condition = condition.replace("\"","/\"");
return condition;
} | class class_name[name] begin[{]
method[handleLuceneSpecialChars, return_type[type[String]], modifier[public static], parameter[condition]] begin[{]
if[binary_operation[binary_operation[member[.condition], ==, literal[null]], ||, call[condition.equals, parameter[literal[""]]]]] begin[{]
return[member[.condition]]
else begin[{]
None
end[}]
assign[member[.condition], call[condition.replace, parameter[literal[":"], literal["/:"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["-"], literal["/-"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["+"], literal["/+"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["&"], literal["/&"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["!"], literal["/!"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["{"], literal["/{"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["}"], literal["/}"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["("], literal["/("]]]]
assign[member[.condition], call[condition.replace, parameter[literal[")"], literal["/)"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["|"], literal["/|"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["~"], literal["/~"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["*"], literal["/*"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["?"], literal["/?"]]]]
assign[member[.condition], call[condition.replace, parameter[literal["/"], literal["//"]]]]
return[member[.condition]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[handleLuceneSpecialChars] operator[SEP] identifier[String] identifier[condition] operator[SEP] {
Keyword[if] operator[SEP] identifier[condition] operator[==] Other[null] operator[||] identifier[condition] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[condition] operator[SEP]
}
identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[condition] operator[=] identifier[condition] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[condition] operator[SEP]
}
|
private void changeCursor(@Nullable Cursor newCursor) {
Cursor oldCursor = mCursor;
if (mCursor != newCursor) {
int oldSize = 0;
int deltaSize = 0;
if (oldCursor != null) {
int oldCount = oldCursor.getCount();
oldSize = oldCount;
deltaSize -= oldCount;
oldCursor.close();
}
mCursor = newCursor;
int newSize = 0;
if (newCursor != null) {
int newCount = newCursor.getCount();
deltaSize += newCount;
newSize = newCount;
}
updateCursorObserver();
int changed = min(oldSize, newSize);
if (changed > 0) {
notifyItemRangeChanged(0, changed);
}
if (deltaSize < 0) {
notifyItemRangeRemoved(oldSize + deltaSize, abs(deltaSize));
} else if (deltaSize > 0) {
notifyItemRangeInserted(oldSize, abs(deltaSize));
}
}
} | class class_name[name] begin[{]
method[changeCursor, return_type[void], modifier[private], parameter[newCursor]] begin[{]
local_variable[type[Cursor], oldCursor]
if[binary_operation[member[.mCursor], !=, member[.newCursor]]] begin[{]
local_variable[type[int], oldSize]
local_variable[type[int], deltaSize]
if[binary_operation[member[.oldCursor], !=, literal[null]]] begin[{]
local_variable[type[int], oldCount]
assign[member[.oldSize], member[.oldCount]]
assign[member[.deltaSize], member[.oldCount]]
call[oldCursor.close, parameter[]]
else begin[{]
None
end[}]
assign[member[.mCursor], member[.newCursor]]
local_variable[type[int], newSize]
if[binary_operation[member[.newCursor], !=, literal[null]]] begin[{]
local_variable[type[int], newCount]
assign[member[.deltaSize], member[.newCount]]
assign[member[.newSize], member[.newCount]]
else begin[{]
None
end[}]
call[.updateCursorObserver, parameter[]]
local_variable[type[int], changed]
if[binary_operation[member[.changed], >, literal[0]]] begin[{]
call[.notifyItemRangeChanged, parameter[literal[0], member[.changed]]]
else begin[{]
None
end[}]
if[binary_operation[member[.deltaSize], <, literal[0]]] begin[{]
call[.notifyItemRangeRemoved, parameter[binary_operation[member[.oldSize], +, member[.deltaSize]], call[.abs, parameter[member[.deltaSize]]]]]
else begin[{]
if[binary_operation[member[.deltaSize], >, literal[0]]] begin[{]
call[.notifyItemRangeInserted, parameter[member[.oldSize], call[.abs, parameter[member[.deltaSize]]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[changeCursor] operator[SEP] annotation[@] identifier[Nullable] identifier[Cursor] identifier[newCursor] operator[SEP] {
identifier[Cursor] identifier[oldCursor] operator[=] identifier[mCursor] operator[SEP] Keyword[if] operator[SEP] identifier[mCursor] operator[!=] identifier[newCursor] operator[SEP] {
Keyword[int] identifier[oldSize] operator[=] Other[0] operator[SEP] Keyword[int] identifier[deltaSize] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[oldCursor] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[oldCount] operator[=] identifier[oldCursor] operator[SEP] identifier[getCount] operator[SEP] operator[SEP] operator[SEP] identifier[oldSize] operator[=] identifier[oldCount] operator[SEP] identifier[deltaSize] operator[-=] identifier[oldCount] operator[SEP] identifier[oldCursor] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mCursor] operator[=] identifier[newCursor] operator[SEP] Keyword[int] identifier[newSize] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[newCursor] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[newCount] operator[=] identifier[newCursor] operator[SEP] identifier[getCount] operator[SEP] operator[SEP] operator[SEP] identifier[deltaSize] operator[+=] identifier[newCount] operator[SEP] identifier[newSize] operator[=] identifier[newCount] operator[SEP]
}
identifier[updateCursorObserver] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[changed] operator[=] identifier[min] operator[SEP] identifier[oldSize] , identifier[newSize] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[changed] operator[>] Other[0] operator[SEP] {
identifier[notifyItemRangeChanged] operator[SEP] Other[0] , identifier[changed] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[deltaSize] operator[<] Other[0] operator[SEP] {
identifier[notifyItemRangeRemoved] operator[SEP] identifier[oldSize] operator[+] identifier[deltaSize] , identifier[abs] operator[SEP] identifier[deltaSize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[deltaSize] operator[>] Other[0] operator[SEP] {
identifier[notifyItemRangeInserted] operator[SEP] identifier[oldSize] , identifier[abs] operator[SEP] identifier[deltaSize] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public Collection<Effort> effortRecords(EffortFilter filter) {
return get(Effort.class, (filter != null) ? filter : new EffortFilter());
} | class class_name[name] begin[{]
method[effortRecords, return_type[type[Collection]], modifier[public], parameter[filter]] begin[{]
return[call[.get, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Effort, sub_type=None)), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EffortFilter, sub_type=None)), if_true=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[Effort] operator[>] identifier[effortRecords] operator[SEP] identifier[EffortFilter] identifier[filter] operator[SEP] {
Keyword[return] identifier[get] operator[SEP] identifier[Effort] operator[SEP] Keyword[class] , operator[SEP] identifier[filter] operator[!=] Other[null] operator[SEP] operator[?] identifier[filter] operator[:] Keyword[new] identifier[EffortFilter] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static synchronized Random getThreadLocalRandom() {
if(threadLocalRandom == null) {
threadLocalRandom = new ThreadLocal<Random>() {
/**
* Builds a Random object using the globalSeed (if available).
*
* @return
*/
@Override
protected Random initialValue() {
if(globalSeed == null) {
return new Random();
}
else {
return new Random(globalSeed);
}
}
};
}
return threadLocalRandom.get();
} | class class_name[name] begin[{]
method[getThreadLocalRandom, return_type[type[Random]], modifier[synchronized public static], parameter[]] begin[{]
if[binary_operation[member[.threadLocalRandom], ==, literal[null]]] begin[{]
assign[member[.threadLocalRandom], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=globalSeed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=globalSeed, 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=Random, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Random, sub_type=None)), label=None)]))], documentation=/**
* Builds a Random object using the globalSeed (if available).
*
* @return
*/, modifiers={'protected'}, name=initialValue, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Random, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Random, sub_type=None))], dimensions=None, name=ThreadLocal, sub_type=None))]
else begin[{]
None
end[}]
return[call[threadLocalRandom.get, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] identifier[Random] identifier[getThreadLocalRandom] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[threadLocalRandom] operator[==] Other[null] operator[SEP] {
identifier[threadLocalRandom] operator[=] Keyword[new] identifier[ThreadLocal] operator[<] identifier[Random] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] identifier[Random] identifier[initialValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[globalSeed] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[Random] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[Random] operator[SEP] identifier[globalSeed] operator[SEP] operator[SEP]
}
}
} operator[SEP]
}
Keyword[return] identifier[threadLocalRandom] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
|
@FFDCIgnore({ NamingException.class })
@Sensitive
Object resolveObject(Object o, WSName subname) throws NamingException {
ServiceReference<?> ref = null;
try {
if (o instanceof ContextNode)
return new WSContext(userContext, (ContextNode) o, env);
if (tc.isDebugEnabled())
Tr.debug(tc, "Resolving object", o);
if (o instanceof ServiceReference) {
ref = (ServiceReference<?>) o;
if (tc.isDebugEnabled())
Tr.debug(tc, "External service registry entry.");
} else if (o instanceof AutoBindNode) {
if (tc.isDebugEnabled())
Tr.debug(tc, "AutoBindNode entry.");
AutoBindNode abNode = (AutoBindNode) o;
ref = (ServiceReference<?>) abNode.getLastEntry();
// null means the node was removed in another thread.
if (ref == null) {
// Use the same semantics as ContextNode.lookup.
throw new NameNotFoundException(subname.toString());
}
} else if (o instanceof ServiceRegistration) {
ref = ((ServiceRegistration<?>) o).getReference();
if (tc.isDebugEnabled())
Tr.debug(tc, "Programmatic JNDI entry.");
}
boolean getObjectInstance;
if (ref == null) {
getObjectInstance = true;
} else {
o = getReference(userContext, ref);
if (o == null) {
throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString()));
}
Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN);
if (tc.isDebugEnabled())
Tr.debug(tc, "Retrieved service from registry", o,
JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin,
Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS)));
getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) ||
contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName());
}
if (getObjectInstance) {
// give JNDI a chance to resolve any references
try {
Object oldO = o;
o = NamingManager.getObjectInstance(o, subname, this, env);
if (o != oldO)
if (tc.isDebugEnabled())
Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information.
} catch (NamingException e) {
throw e;
} catch (Exception e) {
// FFDC and proceed
}
}
return o;
} catch (NamingException e) {
throw e;
} catch (Exception e) {
NamingException ne = new NamingException();
ne.setRootCause(e);
throw ne;
}
} | class class_name[name] begin[{]
method[resolveObject, return_type[type[Object]], modifier[default], parameter[o, subname]] begin[{]
local_variable[type[ServiceReference], ref]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ContextNode, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=userContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ContextNode, sub_type=None)), MemberReference(member=env, 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=WSContext, sub_type=None)), label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Resolving object"), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ServiceReference, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=AutoBindNode, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ServiceRegistration, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ServiceRegistration, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Programmatic JNDI entry.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None))])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AutoBindNode entry.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AutoBindNode, sub_type=None)), name=abNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AutoBindNode, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=getLastEntry, postfix_operators=[], prefix_operators=[], qualifier=abNode, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ServiceReference, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=subname, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NameNotFoundException, sub_type=None)), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ServiceReference, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="External service registry entry.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=getObjectInstance)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=userContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getReference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jndi.servicereference.failed"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=subname, selectors=[], type_arguments=None)], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamingException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=OSGI_JNDI_SERVICE_ORIGIN, postfix_operators=[], prefix_operators=[], qualifier=JNDIServiceBinder, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None), name=origin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Retrieved service from registry"), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=OSGI_JNDI_SERVICE_ORIGIN, postfix_operators=[], prefix_operators=[], qualifier=JNDIServiceBinder, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MemberReference(member=origin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=OBJECTCLASS, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=OBJECTCLASS, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None))], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=getObjectInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=origin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=OBJECTCLASS, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Reference, sub_type=None))], member=contains, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=||)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getObjectInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), IfStatement(condition=MemberReference(member=getObjectInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=oldO)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=env, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjectInstance, postfix_operators=[], prefix_operators=[], qualifier=NamingManager, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=oldO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Resolved object through NamingManager")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NamingException'])), CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)])), ReturnStatement(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NamingException'])), CatchClause(block=[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=NamingException, sub_type=None)), name=ne)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NamingException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRootCause, postfix_operators=[], prefix_operators=[], qualifier=ne, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=ne, 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[}] | annotation[@] identifier[FFDCIgnore] operator[SEP] {
identifier[NamingException] operator[SEP] Keyword[class]
} operator[SEP] annotation[@] identifier[Sensitive] identifier[Object] identifier[resolveObject] operator[SEP] identifier[Object] identifier[o] , identifier[WSName] identifier[subname] operator[SEP] Keyword[throws] identifier[NamingException] {
identifier[ServiceReference] operator[<] operator[?] operator[>] identifier[ref] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[ContextNode] operator[SEP] Keyword[return] Keyword[new] identifier[WSContext] operator[SEP] identifier[userContext] , operator[SEP] identifier[ContextNode] operator[SEP] identifier[o] , identifier[env] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[o] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[ServiceReference] operator[SEP] {
identifier[ref] operator[=] operator[SEP] identifier[ServiceReference] operator[<] operator[?] operator[>] operator[SEP] identifier[o] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[AutoBindNode] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[AutoBindNode] identifier[abNode] operator[=] operator[SEP] identifier[AutoBindNode] operator[SEP] identifier[o] operator[SEP] identifier[ref] operator[=] operator[SEP] identifier[ServiceReference] operator[<] operator[?] operator[>] operator[SEP] identifier[abNode] operator[SEP] identifier[getLastEntry] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NameNotFoundException] operator[SEP] identifier[subname] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[ServiceRegistration] operator[SEP] {
identifier[ref] operator[=] operator[SEP] operator[SEP] identifier[ServiceRegistration] operator[<] operator[?] operator[>] operator[SEP] identifier[o] operator[SEP] operator[SEP] identifier[getReference] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[getObjectInstance] operator[SEP] Keyword[if] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] {
identifier[getObjectInstance] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[o] operator[=] identifier[getReference] operator[SEP] identifier[userContext] , identifier[ref] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NamingException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[subname] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] identifier[origin] operator[=] identifier[ref] operator[SEP] identifier[getProperty] operator[SEP] identifier[JNDIServiceBinder] operator[SEP] identifier[OSGI_JNDI_SERVICE_ORIGIN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[o] , identifier[JNDIServiceBinder] operator[SEP] identifier[OSGI_JNDI_SERVICE_ORIGIN] operator[+] literal[String] operator[+] identifier[origin] , identifier[Constants] operator[SEP] identifier[OBJECTCLASS] operator[+] literal[String] operator[+] identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[SEP] identifier[getProperty] operator[SEP] identifier[Constants] operator[SEP] identifier[OBJECTCLASS] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getObjectInstance] operator[=] identifier[JNDIServiceBinder] operator[SEP] identifier[OSGI_JNDI_SERVICE_ORIGIN_VALUE] operator[SEP] identifier[equals] operator[SEP] identifier[origin] operator[SEP] operator[||] identifier[contains] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[SEP] identifier[getProperty] operator[SEP] identifier[Constants] operator[SEP] identifier[OBJECTCLASS] operator[SEP] , identifier[Reference] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getObjectInstance] operator[SEP] {
Keyword[try] {
identifier[Object] identifier[oldO] operator[=] identifier[o] operator[SEP] identifier[o] operator[=] identifier[NamingManager] operator[SEP] identifier[getObjectInstance] operator[SEP] identifier[o] , identifier[subname] , Keyword[this] , identifier[env] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[!=] identifier[oldO] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NamingException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
Keyword[return] identifier[o] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NamingException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[NamingException] identifier[ne] operator[=] Keyword[new] identifier[NamingException] operator[SEP] operator[SEP] operator[SEP] identifier[ne] operator[SEP] identifier[setRootCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[ne] operator[SEP]
}
}
|
private void init() {
Collection<String> paths = StringSupport.split(classpath, ";:", false);
for (String location : paths) {
location = FileSupport.convertToUnixStylePath(location);
if (location.endsWith(".zip") || location.endsWith(".jar")) {
mapFilesInZip(location);
} else {
File dir = new File(location);
if (dir.isDirectory()) {
if (!location.endsWith("/")) {
location += '/';
}
Collection<File> classFiles = FileSupport.getFilesInDirectoryTree(dir);
for (File file : classFiles) {
String fileName = file.getPath();
if ((fileName.endsWith(".jar") || fileName.endsWith(".zip")) && !file.isHidden()) {
mapFilesInZip(fileName);
} else { // .class .properties etc.
mapClassResourceEntry(file.getPath().substring(location.length()), file);
fileCreationTimes.put(file, new Long(file.lastModified()));
}
}
} else {
//path can not be mapped
}
}
}
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[Collection], paths]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertToUnixStylePath, postfix_operators=[], prefix_operators=[], qualifier=FileSupport, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".zip")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".jar")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=dir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=dir, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=endsWith, postfix_operators=[], prefix_operators=['!'], qualifier=location, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/')), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFilesInDirectoryTree, postfix_operators=[], prefix_operators=[], qualifier=FileSupport, selectors=[], type_arguments=None), name=classFiles)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), name=fileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".jar")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".zip")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), operator=||), operandr=MethodInvocation(arguments=[], member=isHidden, postfix_operators=[], prefix_operators=['!'], qualifier=file, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapClassResourceEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[], member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=fileCreationTimes, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapFilesInZip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=classFiles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapFilesInZip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=location)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[init] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[String] operator[>] identifier[paths] operator[=] identifier[StringSupport] operator[SEP] identifier[split] operator[SEP] identifier[classpath] , literal[String] , literal[boolean] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[location] operator[:] identifier[paths] operator[SEP] {
identifier[location] operator[=] identifier[FileSupport] operator[SEP] identifier[convertToUnixStylePath] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[mapFilesInZip] operator[SEP] identifier[location] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[File] identifier[dir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dir] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[location] operator[+=] literal[String] operator[SEP]
}
identifier[Collection] operator[<] identifier[File] operator[>] identifier[classFiles] operator[=] identifier[FileSupport] operator[SEP] identifier[getFilesInDirectoryTree] operator[SEP] identifier[dir] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[File] identifier[file] operator[:] identifier[classFiles] operator[SEP] {
identifier[String] identifier[fileName] operator[=] identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[file] operator[SEP] identifier[isHidden] operator[SEP] operator[SEP] operator[SEP] {
identifier[mapFilesInZip] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[mapClassResourceEntry] operator[SEP] identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[location] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] , identifier[file] operator[SEP] operator[SEP] identifier[fileCreationTimes] operator[SEP] identifier[put] operator[SEP] identifier[file] , Keyword[new] identifier[Long] operator[SEP] identifier[file] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
}
}
}
}
|
private void label(final ExtendedTetrahedral element) {
final IAtom focus = element.focus();
final IAtom[] atoms = element.peripherals();
final IBond[] bonds = new IBond[4];
int p = parity(element.winding());
List<IBond> focusBonds = container.getConnectedBondsList(focus);
if (focusBonds.size() != 2) {
LoggingToolFactory.createLoggingTool(getClass()).warn(
"Non-cumulated carbon presented as the focus of extended tetrahedral stereo configuration");
return;
}
IAtom[] terminals = element.findTerminalAtoms(container);
IAtom left = terminals[0];
IAtom right = terminals[1];
// some bonds may be null if, this happens when an implicit atom
// is present and one or more 'atoms' is a terminal atom
for (int i = 0; i < 4; i++)
bonds[i] = findBond(left, right, atoms[i]);
// find the clockwise ordering (in the plane of the page) by sorting by
// polar coordinates
int[] rank = new int[4];
for (int i = 0; i < 4; i++)
rank[i] = i;
p *= sortClockwise(rank, focus, atoms, 4);
// assign all up/down labels to an auxiliary array
IBond.Stereo[] labels = new IBond.Stereo[4];
for (int i = 0; i < 4; i++) {
int v = rank[i];
p *= -1;
labels[v] = p > 0 ? UP : DOWN;
}
int[] priority = new int[]{5, 5, 5, 5};
// set the label for the highest priority and available bonds on one side
// of the cumulated system, setting both sides doesn't make sense
int i = 0;
for (int v : priority(atomToIndex.get(focus), atoms, 4)) {
IBond bond = bonds[v];
if (bond == null) continue;
if (bond.getStereo() == NONE && bond.getOrder() == SINGLE) priority[v] = i++;
}
// we now check which side was more favourable and assign two labels
// to that side only
if (priority[0] + priority[1] < priority[2] + priority[3]) {
if (priority[0] < 5)
setWedge(bonds[0], atoms[0], labels[0]);
if (priority[1] < 5)
setWedge(bonds[1], atoms[1], labels[1]);
} else {
if (priority[2] < 5)
setWedge(bonds[2], atoms[2], labels[2]);
if (priority[3] < 5)
setWedge(bonds[3], atoms[3], labels[3]);
}
} | class class_name[name] begin[{]
method[label, return_type[void], modifier[private], parameter[element]] begin[{]
local_variable[type[IAtom], focus]
local_variable[type[IAtom], atoms]
local_variable[type[IBond], bonds]
local_variable[type[int], p]
local_variable[type[List], focusBonds]
if[binary_operation[call[focusBonds.size, parameter[]], !=, literal[2]]] begin[{]
call[LoggingToolFactory.createLoggingTool, parameter[call[.getClass, parameter[]]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[IAtom], terminals]
local_variable[type[IAtom], left]
local_variable[type[IAtom], right]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=bonds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=atoms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=findBond, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=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=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[int], rank]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=rank, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=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=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.p], call[.sortClockwise, parameter[member[.rank], member[.focus], member[.atoms], literal[4]]]]
local_variable[type[IBond], labels]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=rank, 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=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=*=, value=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=MemberReference(member=DOWN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=UP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), 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], priority]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=bonds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=bond)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IBond, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bond, 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=ContinueStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStereo, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[], type_arguments=None), operandr=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getOrder, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[], type_arguments=None), operandr=MemberReference(member=SINGLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=priority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=focus, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=atomToIndex, selectors=[], type_arguments=None), MemberReference(member=atoms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=priority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
if[binary_operation[binary_operation[member[.priority], +, member[.priority]], <, binary_operation[member[.priority], +, member[.priority]]]] begin[{]
if[binary_operation[member[.priority], <, literal[5]]] begin[{]
call[.setWedge, parameter[member[.bonds], member[.atoms], member[.labels]]]
else begin[{]
None
end[}]
if[binary_operation[member[.priority], <, literal[5]]] begin[{]
call[.setWedge, parameter[member[.bonds], member[.atoms], member[.labels]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.priority], <, literal[5]]] begin[{]
call[.setWedge, parameter[member[.bonds], member[.atoms], member[.labels]]]
else begin[{]
None
end[}]
if[binary_operation[member[.priority], <, literal[5]]] begin[{]
call[.setWedge, parameter[member[.bonds], member[.atoms], member[.labels]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[label] operator[SEP] Keyword[final] identifier[ExtendedTetrahedral] identifier[element] operator[SEP] {
Keyword[final] identifier[IAtom] identifier[focus] operator[=] identifier[element] operator[SEP] identifier[focus] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[IAtom] operator[SEP] operator[SEP] identifier[atoms] operator[=] identifier[element] operator[SEP] identifier[peripherals] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[IBond] operator[SEP] operator[SEP] identifier[bonds] operator[=] Keyword[new] identifier[IBond] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[int] identifier[p] operator[=] identifier[parity] operator[SEP] identifier[element] operator[SEP] identifier[winding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[IBond] operator[>] identifier[focusBonds] operator[=] identifier[container] operator[SEP] identifier[getConnectedBondsList] operator[SEP] identifier[focus] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[focusBonds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[2] operator[SEP] {
identifier[LoggingToolFactory] operator[SEP] identifier[createLoggingTool] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[IAtom] operator[SEP] operator[SEP] identifier[terminals] operator[=] identifier[element] operator[SEP] identifier[findTerminalAtoms] operator[SEP] identifier[container] operator[SEP] operator[SEP] identifier[IAtom] identifier[left] operator[=] identifier[terminals] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[IAtom] identifier[right] operator[=] identifier[terminals] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[4] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[bonds] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[findBond] operator[SEP] identifier[left] , identifier[right] , identifier[atoms] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[rank] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[4] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[rank] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[i] operator[SEP] identifier[p] operator[*=] identifier[sortClockwise] operator[SEP] identifier[rank] , identifier[focus] , identifier[atoms] , Other[4] operator[SEP] operator[SEP] identifier[IBond] operator[SEP] identifier[Stereo] operator[SEP] operator[SEP] identifier[labels] operator[=] Keyword[new] identifier[IBond] operator[SEP] identifier[Stereo] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[4] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[v] operator[=] identifier[rank] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[p] operator[*=] operator[-] Other[1] operator[SEP] identifier[labels] operator[SEP] identifier[v] operator[SEP] operator[=] identifier[p] operator[>] Other[0] operator[?] identifier[UP] operator[:] identifier[DOWN] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[priority] operator[=] Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
Other[5] , Other[5] , Other[5] , Other[5]
} operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[v] operator[:] identifier[priority] operator[SEP] identifier[atomToIndex] operator[SEP] identifier[get] operator[SEP] identifier[focus] operator[SEP] , identifier[atoms] , Other[4] operator[SEP] operator[SEP] {
identifier[IBond] identifier[bond] operator[=] identifier[bonds] operator[SEP] identifier[v] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bond] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[bond] operator[SEP] identifier[getStereo] operator[SEP] operator[SEP] operator[==] identifier[NONE] operator[&&] identifier[bond] operator[SEP] identifier[getOrder] operator[SEP] operator[SEP] operator[==] identifier[SINGLE] operator[SEP] identifier[priority] operator[SEP] identifier[v] operator[SEP] operator[=] identifier[i] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[priority] operator[SEP] Other[0] operator[SEP] operator[+] identifier[priority] operator[SEP] Other[1] operator[SEP] operator[<] identifier[priority] operator[SEP] Other[2] operator[SEP] operator[+] identifier[priority] operator[SEP] Other[3] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[priority] operator[SEP] Other[0] operator[SEP] operator[<] Other[5] operator[SEP] identifier[setWedge] operator[SEP] identifier[bonds] operator[SEP] Other[0] operator[SEP] , identifier[atoms] operator[SEP] Other[0] operator[SEP] , identifier[labels] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[priority] operator[SEP] Other[1] operator[SEP] operator[<] Other[5] operator[SEP] identifier[setWedge] operator[SEP] identifier[bonds] operator[SEP] Other[1] operator[SEP] , identifier[atoms] operator[SEP] Other[1] operator[SEP] , identifier[labels] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[priority] operator[SEP] Other[2] operator[SEP] operator[<] Other[5] operator[SEP] identifier[setWedge] operator[SEP] identifier[bonds] operator[SEP] Other[2] operator[SEP] , identifier[atoms] operator[SEP] Other[2] operator[SEP] , identifier[labels] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[priority] operator[SEP] Other[3] operator[SEP] operator[<] Other[5] operator[SEP] identifier[setWedge] operator[SEP] identifier[bonds] operator[SEP] Other[3] operator[SEP] , identifier[atoms] operator[SEP] Other[3] operator[SEP] , identifier[labels] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void addFields(Document document, DecoratedKey partitionKey) {
String serializedKey = ByteBufferUtils.toString(partitionKey.getKey());
Field field = new StringField(FIELD_NAME, serializedKey, Store.YES);
document.add(field);
} | class class_name[name] begin[{]
method[addFields, return_type[void], modifier[public], parameter[document, partitionKey]] begin[{]
local_variable[type[String], serializedKey]
local_variable[type[Field], field]
call[document.add, parameter[member[.field]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addFields] operator[SEP] identifier[Document] identifier[document] , identifier[DecoratedKey] identifier[partitionKey] operator[SEP] {
identifier[String] identifier[serializedKey] operator[=] identifier[ByteBufferUtils] operator[SEP] identifier[toString] operator[SEP] identifier[partitionKey] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[field] operator[=] Keyword[new] identifier[StringField] operator[SEP] identifier[FIELD_NAME] , identifier[serializedKey] , identifier[Store] operator[SEP] identifier[YES] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
|
public List<Map<String, Object>> queryListMap(String sql, List<Object> params) {
return this.queryListMap(sql, params.toArray());
} | class class_name[name] begin[{]
method[queryListMap, return_type[type[List]], modifier[public], parameter[sql, params]] begin[{]
return[THIS[call[None.queryListMap, parameter[member[.sql], call[params.toArray, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[queryListMap] operator[SEP] identifier[String] identifier[sql] , identifier[List] operator[<] identifier[Object] operator[>] identifier[params] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[queryListMap] operator[SEP] identifier[sql] , identifier[params] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Map<String, String> getTelemetryProperties() {
final Map<String, String> map = new HashMap<>();
map.put(INSTALLATION_ID_KEY, getInstallationId());
map.put(PLUGIN_NAME_KEY, getPluginName());
map.put(PLUGIN_VERSION_KEY, getPluginVersion());
map.put(SUBSCRIPTION_ID_KEY, getSubscriptionId());
map.put(SESSION_ID_KEY, getSessionId());
map.put(AUTH_TYPE, getAuthType());
return map;
} | class class_name[name] begin[{]
method[getTelemetryProperties, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], map]
call[map.put, parameter[member[.INSTALLATION_ID_KEY], call[.getInstallationId, parameter[]]]]
call[map.put, parameter[member[.PLUGIN_NAME_KEY], call[.getPluginName, parameter[]]]]
call[map.put, parameter[member[.PLUGIN_VERSION_KEY], call[.getPluginVersion, parameter[]]]]
call[map.put, parameter[member[.SUBSCRIPTION_ID_KEY], call[.getSubscriptionId, parameter[]]]]
call[map.put, parameter[member[.SESSION_ID_KEY], call[.getSessionId, parameter[]]]]
call[map.put, parameter[member[.AUTH_TYPE], call[.getAuthType, parameter[]]]]
return[member[.map]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[getTelemetryProperties] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[map] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[INSTALLATION_ID_KEY] , identifier[getInstallationId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[PLUGIN_NAME_KEY] , identifier[getPluginName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[PLUGIN_VERSION_KEY] , identifier[getPluginVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[SUBSCRIPTION_ID_KEY] , identifier[getSubscriptionId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[SESSION_ID_KEY] , identifier[getSessionId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[AUTH_TYPE] , identifier[getAuthType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[map] operator[SEP]
}
|
public EClass getIfcDiscreteAccessoryType() {
if (ifcDiscreteAccessoryTypeEClass == null) {
ifcDiscreteAccessoryTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(156);
}
return ifcDiscreteAccessoryTypeEClass;
} | class class_name[name] begin[{]
method[getIfcDiscreteAccessoryType, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcDiscreteAccessoryTypeEClass], ==, literal[null]]] begin[{]
assign[member[.ifcDiscreteAccessoryTypeEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=156)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcDiscreteAccessoryTypeEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcDiscreteAccessoryType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcDiscreteAccessoryTypeEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcDiscreteAccessoryTypeEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[156] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcDiscreteAccessoryTypeEClass] operator[SEP]
}
|
public static <T> T[] offerArray(T[] prepend, T[] tail) {
if (prepend == null || prepend.length < 1) {
return tail;
} else if (tail == null || tail.length < 1) {
return prepend;
} else {
T[] result = newArrayInstance(tail, prepend.length + tail.length);
System.arraycopy(prepend, 0, result, 0, prepend.length);
System.arraycopy(tail, 0, result, prepend.length, tail.length);
return result;
}
} | class class_name[name] begin[{]
method[offerArray, return_type[type[T]], modifier[public static], parameter[prepend, tail]] begin[{]
if[binary_operation[binary_operation[member[.prepend], ==, literal[null]], ||, binary_operation[member[prepend.length], <, literal[1]]]] begin[{]
return[member[.tail]]
else begin[{]
if[binary_operation[binary_operation[member[.tail], ==, literal[null]], ||, binary_operation[member[tail.length], <, literal[1]]]] begin[{]
return[member[.prepend]]
else begin[{]
local_variable[type[T], result]
call[System.arraycopy, parameter[member[.prepend], literal[0], member[.result], literal[0], member[prepend.length]]]
call[System.arraycopy, parameter[member[.tail], literal[0], member[.result], member[prepend.length], member[tail.length]]]
return[member[.result]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[offerArray] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[prepend] , identifier[T] operator[SEP] operator[SEP] identifier[tail] operator[SEP] {
Keyword[if] operator[SEP] identifier[prepend] operator[==] Other[null] operator[||] identifier[prepend] operator[SEP] identifier[length] operator[<] Other[1] operator[SEP] {
Keyword[return] identifier[tail] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[tail] operator[==] Other[null] operator[||] identifier[tail] operator[SEP] identifier[length] operator[<] Other[1] operator[SEP] {
Keyword[return] identifier[prepend] operator[SEP]
}
Keyword[else] {
identifier[T] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[newArrayInstance] operator[SEP] identifier[tail] , identifier[prepend] operator[SEP] identifier[length] operator[+] identifier[tail] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[prepend] , Other[0] , identifier[result] , Other[0] , identifier[prepend] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[tail] , Other[0] , identifier[result] , identifier[prepend] operator[SEP] identifier[length] , identifier[tail] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
}
|
public static boolean areAllGranted(String authorities) throws IOException {
AuthorizeFaceletsTag authorizeTag = new AuthorizeFaceletsTag();
authorizeTag.setIfAllGranted(authorities);
return authorizeTag.authorize();
} | class class_name[name] begin[{]
method[areAllGranted, return_type[type[boolean]], modifier[public static], parameter[authorities]] begin[{]
local_variable[type[AuthorizeFaceletsTag], authorizeTag]
call[authorizeTag.setIfAllGranted, parameter[member[.authorities]]]
return[call[authorizeTag.authorize, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[areAllGranted] operator[SEP] identifier[String] identifier[authorities] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[AuthorizeFaceletsTag] identifier[authorizeTag] operator[=] Keyword[new] identifier[AuthorizeFaceletsTag] operator[SEP] operator[SEP] operator[SEP] identifier[authorizeTag] operator[SEP] identifier[setIfAllGranted] operator[SEP] identifier[authorities] operator[SEP] operator[SEP] Keyword[return] identifier[authorizeTag] operator[SEP] identifier[authorize] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void paint(final RenderContext renderContext) {
if (redirectUrl != null) {
if (renderContext instanceof WebXmlRenderContext) {
handleRenderRedirect(((WebXmlRenderContext) renderContext).getWriter());
}
return;
}
super.paint(renderContext);
} | class class_name[name] begin[{]
method[paint, return_type[void], modifier[public], parameter[renderContext]] begin[{]
if[binary_operation[member[.redirectUrl], !=, literal[null]]] begin[{]
if[binary_operation[member[.renderContext], instanceof, type[WebXmlRenderContext]]] begin[{]
call[.handleRenderRedirect, parameter[Cast(expression=MemberReference(member=renderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=WebXmlRenderContext, sub_type=None))]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=renderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[paint] operator[SEP] Keyword[final] identifier[RenderContext] identifier[renderContext] operator[SEP] {
Keyword[if] operator[SEP] identifier[redirectUrl] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[renderContext] Keyword[instanceof] identifier[WebXmlRenderContext] operator[SEP] {
identifier[handleRenderRedirect] operator[SEP] operator[SEP] operator[SEP] identifier[WebXmlRenderContext] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[paint] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP]
}
|
public static appfwprofile[] get(nitro_service service) throws Exception{
appfwprofile obj = new appfwprofile();
appfwprofile[] response = (appfwprofile[])obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[appfwprofile]], modifier[public static], parameter[service]] begin[{]
local_variable[type[appfwprofile], obj]
local_variable[type[appfwprofile], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[appfwprofile] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[appfwprofile] identifier[obj] operator[=] Keyword[new] identifier[appfwprofile] operator[SEP] operator[SEP] operator[SEP] identifier[appfwprofile] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[appfwprofile] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public Path getRequiredPath(String key) {
Optional<String> property = getString(key);
if (property.isPresent()) {
return Paths.get(property.get());
} else {
throw new IllegalStateException(String.format("required key [%s] not found", key));
}
} | class class_name[name] begin[{]
method[getRequiredPath, return_type[type[Path]], modifier[public], parameter[key]] begin[{]
local_variable[type[Optional], property]
if[call[property.isPresent, parameter[]]] begin[{]
return[call[Paths.get, parameter[call[property.get, parameter[]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="required key [%s] not found"), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[public] identifier[Path] identifier[getRequiredPath] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[Optional] operator[<] identifier[String] operator[>] identifier[property] operator[=] identifier[getString] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[property] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private final void reportPseudoAttrProblem(String attrName, String got,
String expVal1, String expVal2)
throws WstxException
{
String expStr = (expVal1 == null) ? "" :
("; expected \""+expVal1+"\" or \""+expVal2+"\"");
if (got == null || got.length() == 0) {
throw new WstxParsingException("Missing XML pseudo-attribute '"+attrName+"' value"+expStr,
getLocation());
}
throw new WstxParsingException("Invalid XML pseudo-attribute '"+attrName+"' value "+got+expStr,
getLocation());
} | class class_name[name] begin[{]
method[reportPseudoAttrProblem, return_type[void], modifier[final private], parameter[attrName, got, expVal1, expVal2]] begin[{]
local_variable[type[String], expStr]
if[binary_operation[binary_operation[member[.got], ==, literal[null]], ||, binary_operation[call[got.length, parameter[]], ==, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing XML pseudo-attribute '"), operandr=MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' value"), operator=+), operandr=MemberReference(member=expStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MethodInvocation(arguments=[], member=getLocation, 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=WstxParsingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid XML pseudo-attribute '"), operandr=MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' value "), operator=+), operandr=MemberReference(member=got, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=expStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MethodInvocation(arguments=[], member=getLocation, 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=WstxParsingException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[private] Keyword[final] Keyword[void] identifier[reportPseudoAttrProblem] operator[SEP] identifier[String] identifier[attrName] , identifier[String] identifier[got] , identifier[String] identifier[expVal1] , identifier[String] identifier[expVal2] operator[SEP] Keyword[throws] identifier[WstxException] {
identifier[String] identifier[expStr] operator[=] operator[SEP] identifier[expVal1] operator[==] Other[null] operator[SEP] operator[?] literal[String] operator[:] operator[SEP] literal[String] operator[+] identifier[expVal1] operator[+] literal[String] operator[+] identifier[expVal2] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[got] operator[==] Other[null] operator[||] identifier[got] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WstxParsingException] operator[SEP] literal[String] operator[+] identifier[attrName] operator[+] literal[String] operator[+] identifier[expStr] , identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[WstxParsingException] operator[SEP] literal[String] operator[+] identifier[attrName] operator[+] literal[String] operator[+] identifier[got] operator[+] identifier[expStr] , identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String genSequence4Tags(String[] wordArray){
StringBuilder sb = new StringBuilder();
for(int i=0; i<wordArray.length; i++) {
String word = wordArray[i];
for(int j=0; j<word.length(); j++) {
char c = word.charAt(j);
if(Chars.getType(c)==Chars.CharType.B){
System.err.println(word + " :包含空格(将序列标签转为BMES)");
}
sb.append(c);
sb.append('\t');
if(j == 0) {
if(word.length() == 1)
sb.append('S');
else
sb.append('B');
} else if(j == word.length()-1) {
sb.append('E');
} else {
sb.append('M');
}
sb.append('\n');
}
}
sb.append('\n');
return sb.toString();
} | class class_name[name] begin[{]
method[genSequence4Tags, return_type[type[String]], modifier[public static], parameter[wordArray]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=wordArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=Chars, selectors=[], type_arguments=None), operandr=MemberReference(member=B, postfix_operators=[], prefix_operators=[], qualifier=Chars.CharType, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" :包含空格(将序列标签转为BMES)"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='M')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='E')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='B')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='S')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None))])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=wordArray, 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)
call[sb.append, parameter[literal['\n']]]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[genSequence4Tags] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[wordArray] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[wordArray] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[word] operator[=] identifier[wordArray] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[word] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[word] operator[SEP] identifier[charAt] operator[SEP] identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Chars] operator[SEP] identifier[getType] operator[SEP] identifier[c] operator[SEP] operator[==] identifier[Chars] operator[SEP] identifier[CharType] operator[SEP] identifier[B] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[word] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[j] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[word] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[j] operator[==] identifier[word] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EEnum getIfcWorkCalendarTypeEnum() {
if (ifcWorkCalendarTypeEnumEEnum == null) {
ifcWorkCalendarTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1108);
}
return ifcWorkCalendarTypeEnumEEnum;
} | class class_name[name] begin[{]
method[getIfcWorkCalendarTypeEnum, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcWorkCalendarTypeEnumEEnum], ==, literal[null]]] begin[{]
assign[member[.ifcWorkCalendarTypeEnumEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1108)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcWorkCalendarTypeEnumEEnum]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EEnum] identifier[getIfcWorkCalendarTypeEnum] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcWorkCalendarTypeEnumEEnum] operator[==] Other[null] operator[SEP] {
identifier[ifcWorkCalendarTypeEnumEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[1108] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcWorkCalendarTypeEnumEEnum] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.