repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java | Compiler.compileExtension | private Expression compileExtension(int opPos)
throws TransformerException {
"""
Compile an extension function.
@param opPos The current position in the m_opMap array.
@return reference to {@link org.apache.xpath.functions.FuncExtFunction} instance.
@throws TransformerException if a error occurs creating the Expression.
"""
int endExtFunc = opPos + getOp(opPos + 1) - 1;
opPos = getFirstChildPos(opPos);
java.lang.String ns = (java.lang.String) getTokenQueue().elementAt(getOp(opPos));
opPos++;
java.lang.String funcName =
(java.lang.String) getTokenQueue().elementAt(getOp(opPos));
opPos++;
// We create a method key to uniquely identify this function so that we
// can cache the object needed to invoke it. This way, we only pay the
// reflection overhead on the first call.
Function extension = new FuncExtFunction(ns, funcName, String.valueOf(getNextMethodId()));
try
{
int i = 0;
while (opPos < endExtFunc)
{
int nextOpPos = getNextOpPos(opPos);
extension.setArg(this.compile(opPos), i);
opPos = nextOpPos;
i++;
}
}
catch (WrongNumberArgsException wnae)
{
; // should never happen
}
return extension;
} | java | private Expression compileExtension(int opPos)
throws TransformerException
{
int endExtFunc = opPos + getOp(opPos + 1) - 1;
opPos = getFirstChildPos(opPos);
java.lang.String ns = (java.lang.String) getTokenQueue().elementAt(getOp(opPos));
opPos++;
java.lang.String funcName =
(java.lang.String) getTokenQueue().elementAt(getOp(opPos));
opPos++;
// We create a method key to uniquely identify this function so that we
// can cache the object needed to invoke it. This way, we only pay the
// reflection overhead on the first call.
Function extension = new FuncExtFunction(ns, funcName, String.valueOf(getNextMethodId()));
try
{
int i = 0;
while (opPos < endExtFunc)
{
int nextOpPos = getNextOpPos(opPos);
extension.setArg(this.compile(opPos), i);
opPos = nextOpPos;
i++;
}
}
catch (WrongNumberArgsException wnae)
{
; // should never happen
}
return extension;
} | [
"private",
"Expression",
"compileExtension",
"(",
"int",
"opPos",
")",
"throws",
"TransformerException",
"{",
"int",
"endExtFunc",
"=",
"opPos",
"+",
"getOp",
"(",
"opPos",
"+",
"1",
")",
"-",
"1",
";",
"opPos",
"=",
"getFirstChildPos",
"(",
"opPos",
")",
";",
"java",
".",
"lang",
".",
"String",
"ns",
"=",
"(",
"java",
".",
"lang",
".",
"String",
")",
"getTokenQueue",
"(",
")",
".",
"elementAt",
"(",
"getOp",
"(",
"opPos",
")",
")",
";",
"opPos",
"++",
";",
"java",
".",
"lang",
".",
"String",
"funcName",
"=",
"(",
"java",
".",
"lang",
".",
"String",
")",
"getTokenQueue",
"(",
")",
".",
"elementAt",
"(",
"getOp",
"(",
"opPos",
")",
")",
";",
"opPos",
"++",
";",
"// We create a method key to uniquely identify this function so that we",
"// can cache the object needed to invoke it. This way, we only pay the",
"// reflection overhead on the first call.",
"Function",
"extension",
"=",
"new",
"FuncExtFunction",
"(",
"ns",
",",
"funcName",
",",
"String",
".",
"valueOf",
"(",
"getNextMethodId",
"(",
")",
")",
")",
";",
"try",
"{",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"opPos",
"<",
"endExtFunc",
")",
"{",
"int",
"nextOpPos",
"=",
"getNextOpPos",
"(",
"opPos",
")",
";",
"extension",
".",
"setArg",
"(",
"this",
".",
"compile",
"(",
"opPos",
")",
",",
"i",
")",
";",
"opPos",
"=",
"nextOpPos",
";",
"i",
"++",
";",
"}",
"}",
"catch",
"(",
"WrongNumberArgsException",
"wnae",
")",
"{",
";",
"// should never happen",
"}",
"return",
"extension",
";",
"}"
] | Compile an extension function.
@param opPos The current position in the m_opMap array.
@return reference to {@link org.apache.xpath.functions.FuncExtFunction} instance.
@throws TransformerException if a error occurs creating the Expression. | [
"Compile",
"an",
"extension",
"function",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L1100-L1144 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java | WebUtils.doGet | public static String doGet(String url, Map<String, String> params, String charset) throws IOException {
"""
执行HTTP GET请求。
@param url 请求地址
@param params 请求参数
@param charset 字符集,如UTF-8, GBK, GB2312
@return 响应字符串
"""
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/x-www-form-urlencoded;charset=" + charset;
String query = buildQuery(params, charset);
conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype, null);
rsp = getResponseAsString(conn);
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | java | public static String doGet(String url, Map<String, String> params, String charset) throws IOException {
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/x-www-form-urlencoded;charset=" + charset;
String query = buildQuery(params, charset);
conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype, null);
rsp = getResponseAsString(conn);
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | [
"public",
"static",
"String",
"doGet",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"conn",
"=",
"null",
";",
"String",
"rsp",
"=",
"null",
";",
"try",
"{",
"String",
"ctype",
"=",
"\"application/x-www-form-urlencoded;charset=\"",
"+",
"charset",
";",
"String",
"query",
"=",
"buildQuery",
"(",
"params",
",",
"charset",
")",
";",
"conn",
"=",
"getConnection",
"(",
"buildGetUrl",
"(",
"url",
",",
"query",
")",
",",
"METHOD_GET",
",",
"ctype",
",",
"null",
")",
";",
"rsp",
"=",
"getResponseAsString",
"(",
"conn",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"conn",
"!=",
"null",
")",
"{",
"conn",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"return",
"rsp",
";",
"}"
] | 执行HTTP GET请求。
@param url 请求地址
@param params 请求参数
@param charset 字符集,如UTF-8, GBK, GB2312
@return 响应字符串 | [
"执行HTTP",
"GET请求。"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L132-L149 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/model/VarConfig.java | VarConfig.getState | public int getState(Var var, int defaultState) {
"""
Gets the state (in this config) for a given variable if it exists, or the default otherwise.
"""
Integer state = config.get(var);
if (state == null) {
return defaultState;
} else {
return state;
}
} | java | public int getState(Var var, int defaultState) {
Integer state = config.get(var);
if (state == null) {
return defaultState;
} else {
return state;
}
} | [
"public",
"int",
"getState",
"(",
"Var",
"var",
",",
"int",
"defaultState",
")",
"{",
"Integer",
"state",
"=",
"config",
".",
"get",
"(",
"var",
")",
";",
"if",
"(",
"state",
"==",
"null",
")",
"{",
"return",
"defaultState",
";",
"}",
"else",
"{",
"return",
"state",
";",
"}",
"}"
] | Gets the state (in this config) for a given variable if it exists, or the default otherwise. | [
"Gets",
"the",
"state",
"(",
"in",
"this",
"config",
")",
"for",
"a",
"given",
"variable",
"if",
"it",
"exists",
"or",
"the",
"default",
"otherwise",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/VarConfig.java#L118-L125 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java | SoyNodeCompiler.calculateRangeArgs | private CompiledForeachRangeArgs calculateRangeArgs(ForNode forNode, Scope scope) {
"""
Interprets the given expressions as the arguments of a {@code range(...)} expression in a
{@code foreach} loop.
"""
RangeArgs rangeArgs = RangeArgs.createFromNode(forNode).get();
ForNonemptyNode nonEmptyNode = (ForNonemptyNode) forNode.getChild(0);
ImmutableList.Builder<Statement> initStatements = ImmutableList.builder();
Expression startExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeStart(nonEmptyNode),
rangeArgs.start(),
0,
scope,
initStatements);
Expression stepExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeStep(nonEmptyNode),
rangeArgs.increment(),
1,
scope,
initStatements);
Expression endExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeEnd(nonEmptyNode),
Optional.of(rangeArgs.limit()),
Integer.MAX_VALUE,
scope,
initStatements);
return new AutoValue_SoyNodeCompiler_CompiledForeachRangeArgs(
startExpression, endExpression, stepExpression, initStatements.build());
} | java | private CompiledForeachRangeArgs calculateRangeArgs(ForNode forNode, Scope scope) {
RangeArgs rangeArgs = RangeArgs.createFromNode(forNode).get();
ForNonemptyNode nonEmptyNode = (ForNonemptyNode) forNode.getChild(0);
ImmutableList.Builder<Statement> initStatements = ImmutableList.builder();
Expression startExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeStart(nonEmptyNode),
rangeArgs.start(),
0,
scope,
initStatements);
Expression stepExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeStep(nonEmptyNode),
rangeArgs.increment(),
1,
scope,
initStatements);
Expression endExpression =
computeRangeValue(
SyntheticVarName.foreachLoopRangeEnd(nonEmptyNode),
Optional.of(rangeArgs.limit()),
Integer.MAX_VALUE,
scope,
initStatements);
return new AutoValue_SoyNodeCompiler_CompiledForeachRangeArgs(
startExpression, endExpression, stepExpression, initStatements.build());
} | [
"private",
"CompiledForeachRangeArgs",
"calculateRangeArgs",
"(",
"ForNode",
"forNode",
",",
"Scope",
"scope",
")",
"{",
"RangeArgs",
"rangeArgs",
"=",
"RangeArgs",
".",
"createFromNode",
"(",
"forNode",
")",
".",
"get",
"(",
")",
";",
"ForNonemptyNode",
"nonEmptyNode",
"=",
"(",
"ForNonemptyNode",
")",
"forNode",
".",
"getChild",
"(",
"0",
")",
";",
"ImmutableList",
".",
"Builder",
"<",
"Statement",
">",
"initStatements",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"Expression",
"startExpression",
"=",
"computeRangeValue",
"(",
"SyntheticVarName",
".",
"foreachLoopRangeStart",
"(",
"nonEmptyNode",
")",
",",
"rangeArgs",
".",
"start",
"(",
")",
",",
"0",
",",
"scope",
",",
"initStatements",
")",
";",
"Expression",
"stepExpression",
"=",
"computeRangeValue",
"(",
"SyntheticVarName",
".",
"foreachLoopRangeStep",
"(",
"nonEmptyNode",
")",
",",
"rangeArgs",
".",
"increment",
"(",
")",
",",
"1",
",",
"scope",
",",
"initStatements",
")",
";",
"Expression",
"endExpression",
"=",
"computeRangeValue",
"(",
"SyntheticVarName",
".",
"foreachLoopRangeEnd",
"(",
"nonEmptyNode",
")",
",",
"Optional",
".",
"of",
"(",
"rangeArgs",
".",
"limit",
"(",
")",
")",
",",
"Integer",
".",
"MAX_VALUE",
",",
"scope",
",",
"initStatements",
")",
";",
"return",
"new",
"AutoValue_SoyNodeCompiler_CompiledForeachRangeArgs",
"(",
"startExpression",
",",
"endExpression",
",",
"stepExpression",
",",
"initStatements",
".",
"build",
"(",
")",
")",
";",
"}"
] | Interprets the given expressions as the arguments of a {@code range(...)} expression in a
{@code foreach} loop. | [
"Interprets",
"the",
"given",
"expressions",
"as",
"the",
"arguments",
"of",
"a",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L458-L486 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsAvatar.java | GVRPhysicsAvatar.loadPhysics | public void loadPhysics(String filename, GVRScene scene) throws IOException {
"""
Load physics information for the current avatar
@param filename name of physics file
@param scene scene the avatar is part of
@throws IOException if physics file cannot be parsed
"""
GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene);
} | java | public void loadPhysics(String filename, GVRScene scene) throws IOException
{
GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene);
} | [
"public",
"void",
"loadPhysics",
"(",
"String",
"filename",
",",
"GVRScene",
"scene",
")",
"throws",
"IOException",
"{",
"GVRPhysicsLoader",
".",
"loadPhysicsFile",
"(",
"getGVRContext",
"(",
")",
",",
"filename",
",",
"true",
",",
"scene",
")",
";",
"}"
] | Load physics information for the current avatar
@param filename name of physics file
@param scene scene the avatar is part of
@throws IOException if physics file cannot be parsed | [
"Load",
"physics",
"information",
"for",
"the",
"current",
"avatar"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsAvatar.java#L62-L65 |
redkale/redkale | src/org/redkale/net/http/WebSocket.java | WebSocket.send | public final CompletableFuture<Integer> send(Object message, boolean last) {
"""
给自身发送消息, 消息类型是String或byte[]或可JavaBean对象
@param message 不可为空, 只能是String或byte[]或可JavaBean对象
@param last 是否最后一条
@return 0表示成功, 非0表示错误码
"""
return send(false, message, last);
} | java | public final CompletableFuture<Integer> send(Object message, boolean last) {
return send(false, message, last);
} | [
"public",
"final",
"CompletableFuture",
"<",
"Integer",
">",
"send",
"(",
"Object",
"message",
",",
"boolean",
"last",
")",
"{",
"return",
"send",
"(",
"false",
",",
"message",
",",
"last",
")",
";",
"}"
] | 给自身发送消息, 消息类型是String或byte[]或可JavaBean对象
@param message 不可为空, 只能是String或byte[]或可JavaBean对象
@param last 是否最后一条
@return 0表示成功, 非0表示错误码 | [
"给自身发送消息",
"消息类型是String或byte",
"[]",
"或可JavaBean对象"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/WebSocket.java#L162-L164 |
google/error-prone | check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java | SuggestedFixes.removeModifiers | public static Optional<SuggestedFix> removeModifiers(
Tree tree, VisitorState state, Modifier... modifiers) {
"""
Remove modifiers from the given class, method, or field declaration.
"""
Set<Modifier> toRemove = ImmutableSet.copyOf(modifiers);
ModifiersTree originalModifiers = getModifiers(tree);
if (originalModifiers == null) {
return Optional.empty();
}
return removeModifiers(originalModifiers, state, toRemove);
} | java | public static Optional<SuggestedFix> removeModifiers(
Tree tree, VisitorState state, Modifier... modifiers) {
Set<Modifier> toRemove = ImmutableSet.copyOf(modifiers);
ModifiersTree originalModifiers = getModifiers(tree);
if (originalModifiers == null) {
return Optional.empty();
}
return removeModifiers(originalModifiers, state, toRemove);
} | [
"public",
"static",
"Optional",
"<",
"SuggestedFix",
">",
"removeModifiers",
"(",
"Tree",
"tree",
",",
"VisitorState",
"state",
",",
"Modifier",
"...",
"modifiers",
")",
"{",
"Set",
"<",
"Modifier",
">",
"toRemove",
"=",
"ImmutableSet",
".",
"copyOf",
"(",
"modifiers",
")",
";",
"ModifiersTree",
"originalModifiers",
"=",
"getModifiers",
"(",
"tree",
")",
";",
"if",
"(",
"originalModifiers",
"==",
"null",
")",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"return",
"removeModifiers",
"(",
"originalModifiers",
",",
"state",
",",
"toRemove",
")",
";",
"}"
] | Remove modifiers from the given class, method, or field declaration. | [
"Remove",
"modifiers",
"from",
"the",
"given",
"class",
"method",
"or",
"field",
"declaration",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L229-L237 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java | ORBConfigAdapter.createServerORB | @Override
public ORB createServerORB(Map<String, Object> config, Map<String, Object> extraConfig, List<IIOPEndpoint> endpoints, Collection<SubsystemFactory> subsystemFactories) throws ConfigException {
"""
Create an ORB for a CORBABean server context.
@param server The CORBABean that owns this ORB's configuration.
@return An ORB instance configured for the CORBABean.
@exception ConfigException
"""
ORB orb = createORB(translateToTargetArgs(config, subsystemFactories), translateToTargetProps(config, extraConfig, endpoints, subsystemFactories));
return orb;
} | java | @Override
public ORB createServerORB(Map<String, Object> config, Map<String, Object> extraConfig, List<IIOPEndpoint> endpoints, Collection<SubsystemFactory> subsystemFactories) throws ConfigException {
ORB orb = createORB(translateToTargetArgs(config, subsystemFactories), translateToTargetProps(config, extraConfig, endpoints, subsystemFactories));
return orb;
} | [
"@",
"Override",
"public",
"ORB",
"createServerORB",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"extraConfig",
",",
"List",
"<",
"IIOPEndpoint",
">",
"endpoints",
",",
"Collection",
"<",
"SubsystemFactory",
">",
"subsystemFactories",
")",
"throws",
"ConfigException",
"{",
"ORB",
"orb",
"=",
"createORB",
"(",
"translateToTargetArgs",
"(",
"config",
",",
"subsystemFactories",
")",
",",
"translateToTargetProps",
"(",
"config",
",",
"extraConfig",
",",
"endpoints",
",",
"subsystemFactories",
")",
")",
";",
"return",
"orb",
";",
"}"
] | Create an ORB for a CORBABean server context.
@param server The CORBABean that owns this ORB's configuration.
@return An ORB instance configured for the CORBABean.
@exception ConfigException | [
"Create",
"an",
"ORB",
"for",
"a",
"CORBABean",
"server",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L51-L55 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/TypedStreamReader.java | TypedStreamReader._handleEmptyValue | private void _handleEmptyValue(TypedValueDecoder dec)
throws XMLStreamException {
"""
Method called to handle value that has empty String
as representation. This will usually either lead to an
exception, or parsing to the default value for the
type in question (null for nullable types and so on).
"""
try { // default action is to throw an exception
dec.handleEmptyValue();
} catch (IllegalArgumentException iae) {
throw _constructTypeException(iae, "");
}
} | java | private void _handleEmptyValue(TypedValueDecoder dec)
throws XMLStreamException
{
try { // default action is to throw an exception
dec.handleEmptyValue();
} catch (IllegalArgumentException iae) {
throw _constructTypeException(iae, "");
}
} | [
"private",
"void",
"_handleEmptyValue",
"(",
"TypedValueDecoder",
"dec",
")",
"throws",
"XMLStreamException",
"{",
"try",
"{",
"// default action is to throw an exception",
"dec",
".",
"handleEmptyValue",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"iae",
")",
"{",
"throw",
"_constructTypeException",
"(",
"iae",
",",
"\"\"",
")",
";",
"}",
"}"
] | Method called to handle value that has empty String
as representation. This will usually either lead to an
exception, or parsing to the default value for the
type in question (null for nullable types and so on). | [
"Method",
"called",
"to",
"handle",
"value",
"that",
"has",
"empty",
"String",
"as",
"representation",
".",
"This",
"will",
"usually",
"either",
"lead",
"to",
"an",
"exception",
"or",
"parsing",
"to",
"the",
"default",
"value",
"for",
"the",
"type",
"in",
"question",
"(",
"null",
"for",
"nullable",
"types",
"and",
"so",
"on",
")",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/TypedStreamReader.java#L764-L772 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java | JedisUtils.newJedisCluster | public static JedisCluster newJedisCluster(JedisPoolConfig poolConfig, String hostsAndPorts,
String password, int timeoutMs, int maxAttempts) {
"""
Create a new {@link JedisCluster}.
@param poolConfig
format {@code host1:port1,host2:port2,...}, default Redis port is used if not
specified
@param password
@param timeoutMs
@param maxAttempts
@return
"""
Set<HostAndPort> clusterNodes = new HashSet<>();
String[] hapList = hostsAndPorts.split("[,;\\s]+");
for (String hostAndPort : hapList) {
String[] tokens = hostAndPort.split(":");
String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST;
int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT;
clusterNodes.add(new HostAndPort(host, port));
}
JedisCluster jedisCluster = new JedisCluster(clusterNodes, timeoutMs, timeoutMs,
maxAttempts, StringUtils.isBlank(password) ? null : password,
poolConfig != null ? poolConfig : defaultJedisPoolConfig());
return jedisCluster;
} | java | public static JedisCluster newJedisCluster(JedisPoolConfig poolConfig, String hostsAndPorts,
String password, int timeoutMs, int maxAttempts) {
Set<HostAndPort> clusterNodes = new HashSet<>();
String[] hapList = hostsAndPorts.split("[,;\\s]+");
for (String hostAndPort : hapList) {
String[] tokens = hostAndPort.split(":");
String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST;
int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT;
clusterNodes.add(new HostAndPort(host, port));
}
JedisCluster jedisCluster = new JedisCluster(clusterNodes, timeoutMs, timeoutMs,
maxAttempts, StringUtils.isBlank(password) ? null : password,
poolConfig != null ? poolConfig : defaultJedisPoolConfig());
return jedisCluster;
} | [
"public",
"static",
"JedisCluster",
"newJedisCluster",
"(",
"JedisPoolConfig",
"poolConfig",
",",
"String",
"hostsAndPorts",
",",
"String",
"password",
",",
"int",
"timeoutMs",
",",
"int",
"maxAttempts",
")",
"{",
"Set",
"<",
"HostAndPort",
">",
"clusterNodes",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"hapList",
"=",
"hostsAndPorts",
".",
"split",
"(",
"\"[,;\\\\s]+\"",
")",
";",
"for",
"(",
"String",
"hostAndPort",
":",
"hapList",
")",
"{",
"String",
"[",
"]",
"tokens",
"=",
"hostAndPort",
".",
"split",
"(",
"\":\"",
")",
";",
"String",
"host",
"=",
"tokens",
".",
"length",
">",
"0",
"?",
"tokens",
"[",
"0",
"]",
":",
"Protocol",
".",
"DEFAULT_HOST",
";",
"int",
"port",
"=",
"tokens",
".",
"length",
">",
"1",
"?",
"Integer",
".",
"parseInt",
"(",
"tokens",
"[",
"1",
"]",
")",
":",
"Protocol",
".",
"DEFAULT_PORT",
";",
"clusterNodes",
".",
"add",
"(",
"new",
"HostAndPort",
"(",
"host",
",",
"port",
")",
")",
";",
"}",
"JedisCluster",
"jedisCluster",
"=",
"new",
"JedisCluster",
"(",
"clusterNodes",
",",
"timeoutMs",
",",
"timeoutMs",
",",
"maxAttempts",
",",
"StringUtils",
".",
"isBlank",
"(",
"password",
")",
"?",
"null",
":",
"password",
",",
"poolConfig",
"!=",
"null",
"?",
"poolConfig",
":",
"defaultJedisPoolConfig",
"(",
")",
")",
";",
"return",
"jedisCluster",
";",
"}"
] | Create a new {@link JedisCluster}.
@param poolConfig
format {@code host1:port1,host2:port2,...}, default Redis port is used if not
specified
@param password
@param timeoutMs
@param maxAttempts
@return | [
"Create",
"a",
"new",
"{",
"@link",
"JedisCluster",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java#L314-L328 |
threerings/nenya | core/src/main/java/com/threerings/media/sprite/SpriteManager.java | SpriteManager.getHighestHitSprite | public Sprite getHighestHitSprite (int x, int y) {
"""
Finds the sprite with the highest render order that hits the specified pixel.
@param x the x (screen) coordinate to be checked
@param y the y (screen) coordinate to be checked
@return the highest sprite hit
"""
// since they're stored in lowest -> highest order..
for (int ii = _sprites.size() - 1; ii >= 0; ii--) {
Sprite sprite = _sprites.get(ii);
if (sprite.hitTest(x, y)) {
return sprite;
}
}
return null;
} | java | public Sprite getHighestHitSprite (int x, int y)
{
// since they're stored in lowest -> highest order..
for (int ii = _sprites.size() - 1; ii >= 0; ii--) {
Sprite sprite = _sprites.get(ii);
if (sprite.hitTest(x, y)) {
return sprite;
}
}
return null;
} | [
"public",
"Sprite",
"getHighestHitSprite",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"// since they're stored in lowest -> highest order..",
"for",
"(",
"int",
"ii",
"=",
"_sprites",
".",
"size",
"(",
")",
"-",
"1",
";",
"ii",
">=",
"0",
";",
"ii",
"--",
")",
"{",
"Sprite",
"sprite",
"=",
"_sprites",
".",
"get",
"(",
"ii",
")",
";",
"if",
"(",
"sprite",
".",
"hitTest",
"(",
"x",
",",
"y",
")",
")",
"{",
"return",
"sprite",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Finds the sprite with the highest render order that hits the specified pixel.
@param x the x (screen) coordinate to be checked
@param y the y (screen) coordinate to be checked
@return the highest sprite hit | [
"Finds",
"the",
"sprite",
"with",
"the",
"highest",
"render",
"order",
"that",
"hits",
"the",
"specified",
"pixel",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/SpriteManager.java#L89-L99 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.setBaseNameForFunctionInstanceId | public void setBaseNameForFunctionInstanceId(String baseName, DifferentialFunction function) {
"""
Sets a base name for the function id.
This is used for when calling {@link #generateOutputVariableForOp(DifferentialFunction, String)}
for ensuring original names for model import map to current samediff names
when names are generated.
@param baseName the base name to add
@param function the function to declare a base name for.
"""
baseNameForFunctionInstanceId.put(function.getOwnName(), baseName);
} | java | public void setBaseNameForFunctionInstanceId(String baseName, DifferentialFunction function) {
baseNameForFunctionInstanceId.put(function.getOwnName(), baseName);
} | [
"public",
"void",
"setBaseNameForFunctionInstanceId",
"(",
"String",
"baseName",
",",
"DifferentialFunction",
"function",
")",
"{",
"baseNameForFunctionInstanceId",
".",
"put",
"(",
"function",
".",
"getOwnName",
"(",
")",
",",
"baseName",
")",
";",
"}"
] | Sets a base name for the function id.
This is used for when calling {@link #generateOutputVariableForOp(DifferentialFunction, String)}
for ensuring original names for model import map to current samediff names
when names are generated.
@param baseName the base name to add
@param function the function to declare a base name for. | [
"Sets",
"a",
"base",
"name",
"for",
"the",
"function",
"id",
".",
"This",
"is",
"used",
"for",
"when",
"calling",
"{",
"@link",
"#generateOutputVariableForOp",
"(",
"DifferentialFunction",
"String",
")",
"}",
"for",
"ensuring",
"original",
"names",
"for",
"model",
"import",
"map",
"to",
"current",
"samediff",
"names",
"when",
"names",
"are",
"generated",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1060-L1062 |
calrissian/mango | mango-criteria/src/main/java/org/calrissian/mango/criteria/support/NodeUtils.java | NodeUtils.criteriaFromNode | public static Criteria criteriaFromNode(Node node, Comparator rangeComparator) {
"""
Creates criteria from a node. A Comparator is injected into all nodes which need to determine order or equality.
"""
return criteriaFromNode(node, rangeComparator, null);
} | java | public static Criteria criteriaFromNode(Node node, Comparator rangeComparator) {
return criteriaFromNode(node, rangeComparator, null);
} | [
"public",
"static",
"Criteria",
"criteriaFromNode",
"(",
"Node",
"node",
",",
"Comparator",
"rangeComparator",
")",
"{",
"return",
"criteriaFromNode",
"(",
"node",
",",
"rangeComparator",
",",
"null",
")",
";",
"}"
] | Creates criteria from a node. A Comparator is injected into all nodes which need to determine order or equality. | [
"Creates",
"criteria",
"from",
"a",
"node",
".",
"A",
"Comparator",
"is",
"injected",
"into",
"all",
"nodes",
"which",
"need",
"to",
"determine",
"order",
"or",
"equality",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-criteria/src/main/java/org/calrissian/mango/criteria/support/NodeUtils.java#L71-L73 |
sjamesr/jfreesane | src/main/java/au/com/southsky/jfreesane/SaneWord.java | SaneWord.fromBytes | public static SaneWord fromBytes(byte[] byteValue, int offset) {
"""
Creates a new {@link SaneWord} from a copy of the given bytes within the array.
{@code offset + SIZE_IN_BYTES} must be a valid index (i.e. there must be enough bytes in the
array at the given offset), otherwise a runtime exception is thrown.
"""
Preconditions.checkArgument(offset >= 0, "offset must be positive or zero");
Preconditions.checkArgument(offset + SIZE_IN_BYTES <= byteValue.length);
return new SaneWord(Arrays.copyOfRange(byteValue, offset, offset + SIZE_IN_BYTES));
} | java | public static SaneWord fromBytes(byte[] byteValue, int offset) {
Preconditions.checkArgument(offset >= 0, "offset must be positive or zero");
Preconditions.checkArgument(offset + SIZE_IN_BYTES <= byteValue.length);
return new SaneWord(Arrays.copyOfRange(byteValue, offset, offset + SIZE_IN_BYTES));
} | [
"public",
"static",
"SaneWord",
"fromBytes",
"(",
"byte",
"[",
"]",
"byteValue",
",",
"int",
"offset",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"offset",
">=",
"0",
",",
"\"offset must be positive or zero\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"offset",
"+",
"SIZE_IN_BYTES",
"<=",
"byteValue",
".",
"length",
")",
";",
"return",
"new",
"SaneWord",
"(",
"Arrays",
".",
"copyOfRange",
"(",
"byteValue",
",",
"offset",
",",
"offset",
"+",
"SIZE_IN_BYTES",
")",
")",
";",
"}"
] | Creates a new {@link SaneWord} from a copy of the given bytes within the array.
{@code offset + SIZE_IN_BYTES} must be a valid index (i.e. there must be enough bytes in the
array at the given offset), otherwise a runtime exception is thrown. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneWord.java#L148-L152 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/ButtonOptionsExample.java | ButtonOptionsExample.getButtonControls | private WFieldSet getButtonControls(final WValidationErrors errors) {
"""
build the button controls field set.
@param errors the error pane from the page.
@return a field set for the controls.
"""
// Options Layout
WFieldSet fieldSet = new WFieldSet("Button configuration");
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(30);
layout.addField("Text", tfButtonLabel);
layout.addField("AccessKey", tfAccesskey);
layout.addField("Render as link", cbRenderAsLink);
layout.addField("Disabled", cbDisabled);
layout.addField("setImage ('/image/pencil.png')", cbSetImage);
layout.addField("Image Position", ddImagePosition);
// Apply Button
WButton apply = new WButton("Apply");
apply.setAction(new ValidatingAction(errors, fieldSet) {
@Override
public void executeOnValid(final ActionEvent event) {
applySettings();
}
});
fieldSet.add(layout);
fieldSet.add(apply);
return fieldSet;
} | java | private WFieldSet getButtonControls(final WValidationErrors errors) {
// Options Layout
WFieldSet fieldSet = new WFieldSet("Button configuration");
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(30);
layout.addField("Text", tfButtonLabel);
layout.addField("AccessKey", tfAccesskey);
layout.addField("Render as link", cbRenderAsLink);
layout.addField("Disabled", cbDisabled);
layout.addField("setImage ('/image/pencil.png')", cbSetImage);
layout.addField("Image Position", ddImagePosition);
// Apply Button
WButton apply = new WButton("Apply");
apply.setAction(new ValidatingAction(errors, fieldSet) {
@Override
public void executeOnValid(final ActionEvent event) {
applySettings();
}
});
fieldSet.add(layout);
fieldSet.add(apply);
return fieldSet;
} | [
"private",
"WFieldSet",
"getButtonControls",
"(",
"final",
"WValidationErrors",
"errors",
")",
"{",
"// Options Layout",
"WFieldSet",
"fieldSet",
"=",
"new",
"WFieldSet",
"(",
"\"Button configuration\"",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"layout",
".",
"setLabelWidth",
"(",
"30",
")",
";",
"layout",
".",
"addField",
"(",
"\"Text\"",
",",
"tfButtonLabel",
")",
";",
"layout",
".",
"addField",
"(",
"\"AccessKey\"",
",",
"tfAccesskey",
")",
";",
"layout",
".",
"addField",
"(",
"\"Render as link\"",
",",
"cbRenderAsLink",
")",
";",
"layout",
".",
"addField",
"(",
"\"Disabled\"",
",",
"cbDisabled",
")",
";",
"layout",
".",
"addField",
"(",
"\"setImage ('/image/pencil.png')\"",
",",
"cbSetImage",
")",
";",
"layout",
".",
"addField",
"(",
"\"Image Position\"",
",",
"ddImagePosition",
")",
";",
"// Apply Button",
"WButton",
"apply",
"=",
"new",
"WButton",
"(",
"\"Apply\"",
")",
";",
"apply",
".",
"setAction",
"(",
"new",
"ValidatingAction",
"(",
"errors",
",",
"fieldSet",
")",
"{",
"@",
"Override",
"public",
"void",
"executeOnValid",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"applySettings",
"(",
")",
";",
"}",
"}",
")",
";",
"fieldSet",
".",
"add",
"(",
"layout",
")",
";",
"fieldSet",
".",
"add",
"(",
"apply",
")",
";",
"return",
"fieldSet",
";",
"}"
] | build the button controls field set.
@param errors the error pane from the page.
@return a field set for the controls. | [
"build",
"the",
"button",
"controls",
"field",
"set",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/ButtonOptionsExample.java#L100-L125 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/IDObject.java | IDObject.addProperty | public void addProperty(String name, Object value) {
"""
Adds an optional property to this object.
If null, any property with the given name will be removed.
If the property already exists, this new value will replace the old value.
@param name the name of the property
@param value the value of the property; must be JSON-serializable if not-null
"""
if (value != null) {
properties.put(name, value);
} else {
removeProperty(name);
}
} | java | public void addProperty(String name, Object value) {
if (value != null) {
properties.put(name, value);
} else {
removeProperty(name);
}
} | [
"public",
"void",
"addProperty",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"properties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"else",
"{",
"removeProperty",
"(",
"name",
")",
";",
"}",
"}"
] | Adds an optional property to this object.
If null, any property with the given name will be removed.
If the property already exists, this new value will replace the old value.
@param name the name of the property
@param value the value of the property; must be JSON-serializable if not-null | [
"Adds",
"an",
"optional",
"property",
"to",
"this",
"object",
".",
"If",
"null",
"any",
"property",
"with",
"the",
"given",
"name",
"will",
"be",
"removed",
".",
"If",
"the",
"property",
"already",
"exists",
"this",
"new",
"value",
"will",
"replace",
"the",
"old",
"value",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/IDObject.java#L69-L75 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/utils/EndpointUtil.java | EndpointUtil.decodeEndpointOperation | public static String decodeEndpointOperation(String endpoint, boolean stripped) {
"""
This method returns the operation part of the supplied endpoint.
@param endpoint The endpoint
@param stripped Whether brackets should be stripped
@return The operation
"""
int ind=endpoint.indexOf('[');
if (ind != -1) {
if (stripped) {
return endpoint.substring(ind+1, endpoint.length()-1);
}
return endpoint.substring(ind);
}
return null;
} | java | public static String decodeEndpointOperation(String endpoint, boolean stripped) {
int ind=endpoint.indexOf('[');
if (ind != -1) {
if (stripped) {
return endpoint.substring(ind+1, endpoint.length()-1);
}
return endpoint.substring(ind);
}
return null;
} | [
"public",
"static",
"String",
"decodeEndpointOperation",
"(",
"String",
"endpoint",
",",
"boolean",
"stripped",
")",
"{",
"int",
"ind",
"=",
"endpoint",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"ind",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"stripped",
")",
"{",
"return",
"endpoint",
".",
"substring",
"(",
"ind",
"+",
"1",
",",
"endpoint",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"endpoint",
".",
"substring",
"(",
"ind",
")",
";",
"}",
"return",
"null",
";",
"}"
] | This method returns the operation part of the supplied endpoint.
@param endpoint The endpoint
@param stripped Whether brackets should be stripped
@return The operation | [
"This",
"method",
"returns",
"the",
"operation",
"part",
"of",
"the",
"supplied",
"endpoint",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/utils/EndpointUtil.java#L76-L85 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.sizeDpY | @NonNull
public IconicsDrawable sizeDpY(@Dimension(unit = DP) int sizeDp) {
"""
Set the size of the drawable.
@param sizeDp The size in density-independent pixels (dp).
@return The current IconicsDrawable for chaining.
"""
return sizePxY(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable sizeDpY(@Dimension(unit = DP) int sizeDp) {
return sizePxY(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"sizeDpY",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"sizePxY",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";",
"}"
] | Set the size of the drawable.
@param sizeDp The size in density-independent pixels (dp).
@return The current IconicsDrawable for chaining. | [
"Set",
"the",
"size",
"of",
"the",
"drawable",
"."
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L718-L721 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/InnerClassAccessMap.java | InnerClassAccessMap.getInnerClassAccess | public InnerClassAccess getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) throws ClassNotFoundException {
"""
Get the inner class access object for given invokestatic instruction.
Returns null if the called method is not an inner class access.
@param inv
the invokestatic instruction
@param cpg
the ConstantPoolGen for the method
@return the InnerClassAccess, or null if the call is not an inner class
access
"""
String methodName = inv.getMethodName(cpg);
if (methodName.startsWith("access$")) {
String className = inv.getClassName(cpg);
return getInnerClassAccess(className, methodName);
}
return null;
} | java | public InnerClassAccess getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) throws ClassNotFoundException {
String methodName = inv.getMethodName(cpg);
if (methodName.startsWith("access$")) {
String className = inv.getClassName(cpg);
return getInnerClassAccess(className, methodName);
}
return null;
} | [
"public",
"InnerClassAccess",
"getInnerClassAccess",
"(",
"INVOKESTATIC",
"inv",
",",
"ConstantPoolGen",
"cpg",
")",
"throws",
"ClassNotFoundException",
"{",
"String",
"methodName",
"=",
"inv",
".",
"getMethodName",
"(",
"cpg",
")",
";",
"if",
"(",
"methodName",
".",
"startsWith",
"(",
"\"access$\"",
")",
")",
"{",
"String",
"className",
"=",
"inv",
".",
"getClassName",
"(",
"cpg",
")",
";",
"return",
"getInnerClassAccess",
"(",
"className",
",",
"methodName",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Get the inner class access object for given invokestatic instruction.
Returns null if the called method is not an inner class access.
@param inv
the invokestatic instruction
@param cpg
the ConstantPoolGen for the method
@return the InnerClassAccess, or null if the call is not an inner class
access | [
"Get",
"the",
"inner",
"class",
"access",
"object",
"for",
"given",
"invokestatic",
"instruction",
".",
"Returns",
"null",
"if",
"the",
"called",
"method",
"is",
"not",
"an",
"inner",
"class",
"access",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/InnerClassAccessMap.java#L109-L117 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java | ModelControllerImpl.awaitContainerStateChangeReport | ContainerStateMonitor.ContainerStateChangeReport awaitContainerStateChangeReport(long timeout, TimeUnit timeUnit)
throws InterruptedException, TimeoutException {
"""
Await service container stability and then report on container state changes. Does not reset change history,
so another run of this method with no intervening call to {@link #logContainerStateChangesAndReset()} will produce a report including
any changes included in a report returned by the first run.
@param timeout maximum period to wait for service container stability
@param timeUnit unit in which {@code timeout} is expressed
@return a change report, or {@code null} if there is nothing to report
@throws java.lang.InterruptedException if the thread is interrupted while awaiting service container stability
@throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout
"""
return stateMonitor.awaitContainerStateChangeReport(timeout, timeUnit);
} | java | ContainerStateMonitor.ContainerStateChangeReport awaitContainerStateChangeReport(long timeout, TimeUnit timeUnit)
throws InterruptedException, TimeoutException {
return stateMonitor.awaitContainerStateChangeReport(timeout, timeUnit);
} | [
"ContainerStateMonitor",
".",
"ContainerStateChangeReport",
"awaitContainerStateChangeReport",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"return",
"stateMonitor",
".",
"awaitContainerStateChangeReport",
"(",
"timeout",
",",
"timeUnit",
")",
";",
"}"
] | Await service container stability and then report on container state changes. Does not reset change history,
so another run of this method with no intervening call to {@link #logContainerStateChangesAndReset()} will produce a report including
any changes included in a report returned by the first run.
@param timeout maximum period to wait for service container stability
@param timeUnit unit in which {@code timeout} is expressed
@return a change report, or {@code null} if there is nothing to report
@throws java.lang.InterruptedException if the thread is interrupted while awaiting service container stability
@throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout | [
"Await",
"service",
"container",
"stability",
"and",
"then",
"report",
"on",
"container",
"state",
"changes",
".",
"Does",
"not",
"reset",
"change",
"history",
"so",
"another",
"run",
"of",
"this",
"method",
"with",
"no",
"intervening",
"call",
"to",
"{",
"@link",
"#logContainerStateChangesAndReset",
"()",
"}",
"will",
"produce",
"a",
"report",
"including",
"any",
"changes",
"included",
"in",
"a",
"report",
"returned",
"by",
"the",
"first",
"run",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L838-L841 |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/gateway/GatewayManagementBeanImpl.java | GatewayManagementBeanImpl.doExceptionCaughtListeners | @Override
public void doExceptionCaughtListeners(final long sessionId, final Throwable cause) {
"""
Notify the management listeners on a filterWrite.
<p/>
NOTE: this starts on the IO thread, but runs a task OFF the thread.
"""
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doExceptionCaught(GatewayManagementBeanImpl.this, sessionId);
}
markChanged(); // mark ourselves as changed, possibly tell listeners
} catch (Exception ex) {
logger.warn("Error during exceptionCaught gateway listener notifications:", ex);
}
}
});
} | java | @Override
public void doExceptionCaughtListeners(final long sessionId, final Throwable cause) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doExceptionCaught(GatewayManagementBeanImpl.this, sessionId);
}
markChanged(); // mark ourselves as changed, possibly tell listeners
} catch (Exception ex) {
logger.warn("Error during exceptionCaught gateway listener notifications:", ex);
}
}
});
} | [
"@",
"Override",
"public",
"void",
"doExceptionCaughtListeners",
"(",
"final",
"long",
"sessionId",
",",
"final",
"Throwable",
"cause",
")",
"{",
"runManagementTask",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"// The particular management listeners change on strategy, so get them here.",
"for",
"(",
"final",
"GatewayManagementListener",
"listener",
":",
"getManagementListeners",
"(",
")",
")",
"{",
"listener",
".",
"doExceptionCaught",
"(",
"GatewayManagementBeanImpl",
".",
"this",
",",
"sessionId",
")",
";",
"}",
"markChanged",
"(",
")",
";",
"// mark ourselves as changed, possibly tell listeners",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Error during exceptionCaught gateway listener notifications:\"",
",",
"ex",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Notify the management listeners on a filterWrite.
<p/>
NOTE: this starts on the IO thread, but runs a task OFF the thread. | [
"Notify",
"the",
"management",
"listeners",
"on",
"a",
"filterWrite",
".",
"<p",
"/",
">",
"NOTE",
":",
"this",
"starts",
"on",
"the",
"IO",
"thread",
"but",
"runs",
"a",
"task",
"OFF",
"the",
"thread",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/gateway/GatewayManagementBeanImpl.java#L560-L577 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java | PrimaveraPMFileWriter.setUserFieldValue | private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value) {
"""
Sets the value of a UDF.
@param udf user defined field
@param dataType MPXJ data type
@param value field value
"""
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
} | java | private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value)
{
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
} | [
"private",
"void",
"setUserFieldValue",
"(",
"UDFAssignmentType",
"udf",
",",
"DataType",
"dataType",
",",
"Object",
"value",
")",
"{",
"switch",
"(",
"dataType",
")",
"{",
"case",
"DURATION",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"(",
"(",
"Duration",
")",
"value",
")",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"}",
"case",
"CURRENCY",
":",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Double",
")",
")",
"{",
"value",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"udf",
".",
"setCostValue",
"(",
"(",
"Double",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"BINARY",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"\"\"",
")",
";",
"break",
";",
"}",
"case",
"STRING",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"(",
"String",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"DATE",
":",
"{",
"udf",
".",
"setStartDateValue",
"(",
"(",
"Date",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"NUMERIC",
":",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Double",
")",
")",
"{",
"value",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"udf",
".",
"setDoubleValue",
"(",
"(",
"Double",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"BOOLEAN",
":",
"{",
"udf",
".",
"setIntegerValue",
"(",
"BooleanHelper",
".",
"getBoolean",
"(",
"(",
"Boolean",
")",
"value",
")",
"?",
"Integer",
".",
"valueOf",
"(",
"1",
")",
":",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
";",
"break",
";",
"}",
"case",
"INTEGER",
":",
"case",
"SHORT",
":",
"{",
"udf",
".",
"setIntegerValue",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"(",
"Number",
")",
"value",
")",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unconvertible data type: \"",
"+",
"dataType",
")",
";",
"}",
"}",
"}"
] | Sets the value of a UDF.
@param udf user defined field
@param dataType MPXJ data type
@param value field value | [
"Sets",
"the",
"value",
"of",
"a",
"UDF",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L821-L887 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java | GuildWars2.setInstance | public static void setInstance(OkHttpClient client) throws GuildWars2Exception {
"""
You need to call {@link #setInstance(Cache)} to create instance with custom
caching<br/>
This method will create instance with your custom Client
@param client
your custom client
"""
if (instance != null)
throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized");
instance = new GuildWars2(client);
} | java | public static void setInstance(OkHttpClient client) throws GuildWars2Exception {
if (instance != null)
throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized");
instance = new GuildWars2(client);
} | [
"public",
"static",
"void",
"setInstance",
"(",
"OkHttpClient",
"client",
")",
"throws",
"GuildWars2Exception",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"throw",
"new",
"GuildWars2Exception",
"(",
"ErrorCode",
".",
"Other",
",",
"\"Instance already initialized\"",
")",
";",
"instance",
"=",
"new",
"GuildWars2",
"(",
"client",
")",
";",
"}"
] | You need to call {@link #setInstance(Cache)} to create instance with custom
caching<br/>
This method will create instance with your custom Client
@param client
your custom client | [
"You",
"need",
"to",
"call",
"{"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java#L62-L66 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.beginCreateOrUpdateById | public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) {
"""
Create a resource by ID.
@param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
@param apiVersion The API version to use for the operation.
@param parameters Create or update resource parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the GenericResourceInner object if successful.
"""
return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body();
} | java | public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) {
return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body();
} | [
"public",
"GenericResourceInner",
"beginCreateOrUpdateById",
"(",
"String",
"resourceId",
",",
"String",
"apiVersion",
",",
"GenericResourceInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateByIdWithServiceResponseAsync",
"(",
"resourceId",
",",
"apiVersion",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create a resource by ID.
@param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
@param apiVersion The API version to use for the operation.
@param parameters Create or update resource parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the GenericResourceInner object if successful. | [
"Create",
"a",
"resource",
"by",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2141-L2143 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_templatesControl_POST | public void serviceName_templatesControl_POST(String serviceName, OvhTypeTemplateEnum activity, String description, String message, String name, String reason) throws IOException {
"""
Create the sms template control given
REST: POST /sms/{serviceName}/templatesControl
@param message [required] Message pattern to be moderated. Use "#VALUE#" format for dynamic text area.
@param description [required] Template description
@param name [required] Name of the template
@param reason [required] Message seen by the moderator
@param activity [required] Specify the kind of template
@param serviceName [required] The internal name of your SMS offer
"""
String qPath = "/sms/{serviceName}/templatesControl";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
addBody(o, "description", description);
addBody(o, "message", message);
addBody(o, "name", name);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_templatesControl_POST(String serviceName, OvhTypeTemplateEnum activity, String description, String message, String name, String reason) throws IOException {
String qPath = "/sms/{serviceName}/templatesControl";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
addBody(o, "description", description);
addBody(o, "message", message);
addBody(o, "name", name);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_templatesControl_POST",
"(",
"String",
"serviceName",
",",
"OvhTypeTemplateEnum",
"activity",
",",
"String",
"description",
",",
"String",
"message",
",",
"String",
"name",
",",
"String",
"reason",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/templatesControl\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"activity\"",
",",
"activity",
")",
";",
"addBody",
"(",
"o",
",",
"\"description\"",
",",
"description",
")",
";",
"addBody",
"(",
"o",
",",
"\"message\"",
",",
"message",
")",
";",
"addBody",
"(",
"o",
",",
"\"name\"",
",",
"name",
")",
";",
"addBody",
"(",
"o",
",",
"\"reason\"",
",",
"reason",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Create the sms template control given
REST: POST /sms/{serviceName}/templatesControl
@param message [required] Message pattern to be moderated. Use "#VALUE#" format for dynamic text area.
@param description [required] Template description
@param name [required] Name of the template
@param reason [required] Message seen by the moderator
@param activity [required] Specify the kind of template
@param serviceName [required] The internal name of your SMS offer | [
"Create",
"the",
"sms",
"template",
"control",
"given"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1682-L1692 |
undertow-io/undertow | core/src/main/java/io/undertow/util/LegacyCookieSupport.java | LegacyCookieSupport.escapeDoubleQuotes | private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
"""
Escapes any double quotes in the given string.
@param s the input string
@param beginIndex start index inclusive
@param endIndex exclusive
@return The (possibly) escaped string
"""
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuilder b = new StringBuilder();
for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
}
return b.toString();
} | java | private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuilder b = new StringBuilder();
for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
}
return b.toString();
} | [
"private",
"static",
"String",
"escapeDoubleQuotes",
"(",
"String",
"s",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
"||",
"s",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"{",
"return",
"s",
";",
"}",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"beginIndex",
";",
"i",
"<",
"endIndex",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"b",
".",
"append",
"(",
"c",
")",
";",
"//ignore the character after an escape, just append it",
"if",
"(",
"++",
"i",
">=",
"endIndex",
")",
"throw",
"UndertowMessages",
".",
"MESSAGES",
".",
"invalidEscapeCharacter",
"(",
")",
";",
"b",
".",
"append",
"(",
"s",
".",
"charAt",
"(",
"i",
")",
")",
";",
"}",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"b",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"else",
"b",
".",
"append",
"(",
"c",
")",
";",
"}",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}"
] | Escapes any double quotes in the given string.
@param s the input string
@param beginIndex start index inclusive
@param endIndex exclusive
@return The (possibly) escaped string | [
"Escapes",
"any",
"double",
"quotes",
"in",
"the",
"given",
"string",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/LegacyCookieSupport.java#L211-L232 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/WhitelistingApi.java | WhitelistingApi.getRejectedRowList | public RejectedCSVRowsEnvelope getRejectedRowList(String dtid, String uploadId, Integer count, Integer offset) throws ApiException {
"""
Get the list of rejected rows for an uploaded CSV file.
Get the list of rejected rows for an uploaded CSV file.
@param dtid Device type id related to the uploaded CSV file. (required)
@param uploadId Upload id related to the uploaded CSV file. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@return RejectedCSVRowsEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<RejectedCSVRowsEnvelope> resp = getRejectedRowListWithHttpInfo(dtid, uploadId, count, offset);
return resp.getData();
} | java | public RejectedCSVRowsEnvelope getRejectedRowList(String dtid, String uploadId, Integer count, Integer offset) throws ApiException {
ApiResponse<RejectedCSVRowsEnvelope> resp = getRejectedRowListWithHttpInfo(dtid, uploadId, count, offset);
return resp.getData();
} | [
"public",
"RejectedCSVRowsEnvelope",
"getRejectedRowList",
"(",
"String",
"dtid",
",",
"String",
"uploadId",
",",
"Integer",
"count",
",",
"Integer",
"offset",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"RejectedCSVRowsEnvelope",
">",
"resp",
"=",
"getRejectedRowListWithHttpInfo",
"(",
"dtid",
",",
"uploadId",
",",
"count",
",",
"offset",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Get the list of rejected rows for an uploaded CSV file.
Get the list of rejected rows for an uploaded CSV file.
@param dtid Device type id related to the uploaded CSV file. (required)
@param uploadId Upload id related to the uploaded CSV file. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@return RejectedCSVRowsEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"list",
"of",
"rejected",
"rows",
"for",
"an",
"uploaded",
"CSV",
"file",
".",
"Get",
"the",
"list",
"of",
"rejected",
"rows",
"for",
"an",
"uploaded",
"CSV",
"file",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L526-L529 |
zalando/riptide | riptide-opentracing/src/main/java/org/zalando/riptide/opentracing/OpenTracingPlugin.java | OpenTracingPlugin.withAdditionalSpanDecorators | @CheckReturnValue
public OpenTracingPlugin withAdditionalSpanDecorators(final SpanDecorator first,
final SpanDecorator... decorators) {
"""
Creates a new {@link OpenTracingPlugin plugin} by <strong>combining</strong> the {@link SpanDecorator decorator(s)} of
{@code this} plugin with the supplied ones.
@param first first decorator
@param decorators optional, remaining decorators
@return a new {@link OpenTracingPlugin}
"""
return withSpanDecorators(decorator, SpanDecorator.composite(first, decorators));
} | java | @CheckReturnValue
public OpenTracingPlugin withAdditionalSpanDecorators(final SpanDecorator first,
final SpanDecorator... decorators) {
return withSpanDecorators(decorator, SpanDecorator.composite(first, decorators));
} | [
"@",
"CheckReturnValue",
"public",
"OpenTracingPlugin",
"withAdditionalSpanDecorators",
"(",
"final",
"SpanDecorator",
"first",
",",
"final",
"SpanDecorator",
"...",
"decorators",
")",
"{",
"return",
"withSpanDecorators",
"(",
"decorator",
",",
"SpanDecorator",
".",
"composite",
"(",
"first",
",",
"decorators",
")",
")",
";",
"}"
] | Creates a new {@link OpenTracingPlugin plugin} by <strong>combining</strong> the {@link SpanDecorator decorator(s)} of
{@code this} plugin with the supplied ones.
@param first first decorator
@param decorators optional, remaining decorators
@return a new {@link OpenTracingPlugin} | [
"Creates",
"a",
"new",
"{",
"@link",
"OpenTracingPlugin",
"plugin",
"}",
"by",
"<strong",
">",
"combining<",
"/",
"strong",
">",
"the",
"{",
"@link",
"SpanDecorator",
"decorator",
"(",
"s",
")",
"}",
"of",
"{",
"@code",
"this",
"}",
"plugin",
"with",
"the",
"supplied",
"ones",
"."
] | train | https://github.com/zalando/riptide/blob/0f53529a69c864203ced5fa067dcf3d42dba0e26/riptide-opentracing/src/main/java/org/zalando/riptide/opentracing/OpenTracingPlugin.java#L89-L93 |
netceteragroup/trema-core | src/main/java/com/netcetera/trema/core/exporting/PropertiesExporter.java | PropertiesExporter.getProperties | protected SortedProperties getProperties(ITextNode[]nodes, String language, Status[] status) {
"""
Constructs a {@link SortedProperties} map form the database with
the given language and status to export.
@param nodes the nodes
@param language the language
@param status the states
@return the {@link SortedProperties}
"""
SortedProperties properties = new SortedProperties();
for (ITextNode node : nodes) {
IValueNode valueNode = node.getValueNode(language);
if (valueNode != null) {
if (status == null || TremaCoreUtil.containsStatus(valueNode.getStatus(), status)) {
IKeyValuePair keyValuePair = new KeyValuePair(node.getKey(), valueNode.getValue());
if (iExportFilters != null) {
for (IExportFilter filter : iExportFilters) {
filter.filter(keyValuePair);
}
}
properties.setProperty(keyValuePair.getKey(), keyValuePair.getValue());
}
}
}
return properties;
} | java | protected SortedProperties getProperties(ITextNode[]nodes, String language, Status[] status) {
SortedProperties properties = new SortedProperties();
for (ITextNode node : nodes) {
IValueNode valueNode = node.getValueNode(language);
if (valueNode != null) {
if (status == null || TremaCoreUtil.containsStatus(valueNode.getStatus(), status)) {
IKeyValuePair keyValuePair = new KeyValuePair(node.getKey(), valueNode.getValue());
if (iExportFilters != null) {
for (IExportFilter filter : iExportFilters) {
filter.filter(keyValuePair);
}
}
properties.setProperty(keyValuePair.getKey(), keyValuePair.getValue());
}
}
}
return properties;
} | [
"protected",
"SortedProperties",
"getProperties",
"(",
"ITextNode",
"[",
"]",
"nodes",
",",
"String",
"language",
",",
"Status",
"[",
"]",
"status",
")",
"{",
"SortedProperties",
"properties",
"=",
"new",
"SortedProperties",
"(",
")",
";",
"for",
"(",
"ITextNode",
"node",
":",
"nodes",
")",
"{",
"IValueNode",
"valueNode",
"=",
"node",
".",
"getValueNode",
"(",
"language",
")",
";",
"if",
"(",
"valueNode",
"!=",
"null",
")",
"{",
"if",
"(",
"status",
"==",
"null",
"||",
"TremaCoreUtil",
".",
"containsStatus",
"(",
"valueNode",
".",
"getStatus",
"(",
")",
",",
"status",
")",
")",
"{",
"IKeyValuePair",
"keyValuePair",
"=",
"new",
"KeyValuePair",
"(",
"node",
".",
"getKey",
"(",
")",
",",
"valueNode",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"iExportFilters",
"!=",
"null",
")",
"{",
"for",
"(",
"IExportFilter",
"filter",
":",
"iExportFilters",
")",
"{",
"filter",
".",
"filter",
"(",
"keyValuePair",
")",
";",
"}",
"}",
"properties",
".",
"setProperty",
"(",
"keyValuePair",
".",
"getKey",
"(",
")",
",",
"keyValuePair",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"properties",
";",
"}"
] | Constructs a {@link SortedProperties} map form the database with
the given language and status to export.
@param nodes the nodes
@param language the language
@param status the states
@return the {@link SortedProperties} | [
"Constructs",
"a",
"{"
] | train | https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/PropertiesExporter.java#L55-L72 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java | AnnotationTypeOptionalMemberBuilder.buildDefaultValueInfo | public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
"""
Build the default value for this optional member.
@param node the XML element that specifies which components to document
@param annotationDocTree the content tree to which the documentation will be added
"""
((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
(MemberDoc) members.get(currentMemberIndex),
annotationDocTree);
} | java | public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
(MemberDoc) members.get(currentMemberIndex),
annotationDocTree);
} | [
"public",
"void",
"buildDefaultValueInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"annotationDocTree",
")",
"{",
"(",
"(",
"AnnotationTypeOptionalMemberWriter",
")",
"writer",
")",
".",
"addDefaultValueInfo",
"(",
"(",
"MemberDoc",
")",
"members",
".",
"get",
"(",
"currentMemberIndex",
")",
",",
"annotationDocTree",
")",
";",
"}"
] | Build the default value for this optional member.
@param node the XML element that specifies which components to document
@param annotationDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"default",
"value",
"for",
"this",
"optional",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java#L102-L106 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTreeRenderer.java | WTreeRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
"""
Paints the given WTree.
@param component the WTree to paint.
@param renderContext the RenderContext to paint to.
"""
WTree tree = (WTree) component;
XmlStringBuilder xml = renderContext.getWriter();
// Check if rendering an open item request
String openId = tree.getOpenRequestItemId();
if (openId != null) {
handleOpenItemRequest(tree, xml, openId);
return;
}
// Check the tree has tree items (WCAG requirement)
TreeItemModel model = tree.getTreeModel();
if (model == null || model.getRowCount() <= 0) {
LOG.warn("Tree not rendered as it has no items.");
return;
}
xml.appendTagOpen("ui:tree");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("htree", WTree.Type.HORIZONTAL == tree.getType(), "true");
xml.appendOptionalAttribute("multiple", WTree.SelectMode.MULTIPLE == tree.getSelectMode(), "true");
xml.appendOptionalAttribute("disabled", tree.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", tree.isHidden(), "true");
xml.appendOptionalAttribute("required", tree.isMandatory(), "true");
switch (tree.getExpandMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
default:
throw new IllegalStateException("Invalid expand mode: " + tree.getType());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(tree, renderContext);
if (tree.getCustomTree() == null) {
handlePaintItems(tree, xml);
} else {
handlePaintCustom(tree, xml);
}
DiagnosticRenderUtil.renderDiagnostics(tree, renderContext);
xml.appendEndTag("ui:tree");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTree tree = (WTree) component;
XmlStringBuilder xml = renderContext.getWriter();
// Check if rendering an open item request
String openId = tree.getOpenRequestItemId();
if (openId != null) {
handleOpenItemRequest(tree, xml, openId);
return;
}
// Check the tree has tree items (WCAG requirement)
TreeItemModel model = tree.getTreeModel();
if (model == null || model.getRowCount() <= 0) {
LOG.warn("Tree not rendered as it has no items.");
return;
}
xml.appendTagOpen("ui:tree");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("htree", WTree.Type.HORIZONTAL == tree.getType(), "true");
xml.appendOptionalAttribute("multiple", WTree.SelectMode.MULTIPLE == tree.getSelectMode(), "true");
xml.appendOptionalAttribute("disabled", tree.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", tree.isHidden(), "true");
xml.appendOptionalAttribute("required", tree.isMandatory(), "true");
switch (tree.getExpandMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
default:
throw new IllegalStateException("Invalid expand mode: " + tree.getType());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(tree, renderContext);
if (tree.getCustomTree() == null) {
handlePaintItems(tree, xml);
} else {
handlePaintCustom(tree, xml);
}
DiagnosticRenderUtil.renderDiagnostics(tree, renderContext);
xml.appendEndTag("ui:tree");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WTree",
"tree",
"=",
"(",
"WTree",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"// Check if rendering an open item request",
"String",
"openId",
"=",
"tree",
".",
"getOpenRequestItemId",
"(",
")",
";",
"if",
"(",
"openId",
"!=",
"null",
")",
"{",
"handleOpenItemRequest",
"(",
"tree",
",",
"xml",
",",
"openId",
")",
";",
"return",
";",
"}",
"// Check the tree has tree items (WCAG requirement)",
"TreeItemModel",
"model",
"=",
"tree",
".",
"getTreeModel",
"(",
")",
";",
"if",
"(",
"model",
"==",
"null",
"||",
"model",
".",
"getRowCount",
"(",
")",
"<=",
"0",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Tree not rendered as it has no items.\"",
")",
";",
"return",
";",
"}",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:tree\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"htree\"",
",",
"WTree",
".",
"Type",
".",
"HORIZONTAL",
"==",
"tree",
".",
"getType",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"multiple\"",
",",
"WTree",
".",
"SelectMode",
".",
"MULTIPLE",
"==",
"tree",
".",
"getSelectMode",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"tree",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"tree",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"tree",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"tree",
".",
"getExpandMode",
"(",
")",
")",
"{",
"case",
"CLIENT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"client\"",
")",
";",
"break",
";",
"case",
"DYNAMIC",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"dynamic\"",
")",
";",
"break",
";",
"case",
"LAZY",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"lazy\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"Invalid expand mode: \"",
"+",
"tree",
".",
"getType",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"tree",
",",
"renderContext",
")",
";",
"if",
"(",
"tree",
".",
"getCustomTree",
"(",
")",
"==",
"null",
")",
"{",
"handlePaintItems",
"(",
"tree",
",",
"xml",
")",
";",
"}",
"else",
"{",
"handlePaintCustom",
"(",
"tree",
",",
"xml",
")",
";",
"}",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"tree",
",",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:tree\"",
")",
";",
"}"
] | Paints the given WTree.
@param component the WTree to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WTree",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTreeRenderer.java#L36-L95 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.getAsync | public Observable<OrderInner> getAsync(String deviceName, String resourceGroupName) {
"""
Gets a specific order by name.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OrderInner object
"""
return getWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | java | public Observable<OrderInner> getAsync(String deviceName, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OrderInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OrderInner",
">",
",",
"OrderInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OrderInner",
"call",
"(",
"ServiceResponse",
"<",
"OrderInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a specific order by name.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OrderInner object | [
"Gets",
"a",
"specific",
"order",
"by",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L253-L260 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkDoWhile | private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) {
"""
Type check a do-while statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
@throws ResolveError
If a named type within this statement cannot be resolved within
the enclosing project.
"""
// Type check loop body
environment = checkBlock(stmt.getBody(), environment, scope);
// Type check invariants
checkConditions(stmt.getInvariant(), true, environment);
// Determine and update modified variables
Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody());
stmt.setModified(stmt.getHeap().allocate(modified));
// Type condition assuming its false to represent the terminated loop.
// This is important if the condition contains a type test, as we'll
// know that doesn't hold here.
return checkCondition(stmt.getCondition(), false, environment);
} | java | private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) {
// Type check loop body
environment = checkBlock(stmt.getBody(), environment, scope);
// Type check invariants
checkConditions(stmt.getInvariant(), true, environment);
// Determine and update modified variables
Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody());
stmt.setModified(stmt.getHeap().allocate(modified));
// Type condition assuming its false to represent the terminated loop.
// This is important if the condition contains a type test, as we'll
// know that doesn't hold here.
return checkCondition(stmt.getCondition(), false, environment);
} | [
"private",
"Environment",
"checkDoWhile",
"(",
"Stmt",
".",
"DoWhile",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// Type check loop body",
"environment",
"=",
"checkBlock",
"(",
"stmt",
".",
"getBody",
"(",
")",
",",
"environment",
",",
"scope",
")",
";",
"// Type check invariants",
"checkConditions",
"(",
"stmt",
".",
"getInvariant",
"(",
")",
",",
"true",
",",
"environment",
")",
";",
"// Determine and update modified variables",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"modified",
"=",
"FlowTypeUtils",
".",
"determineModifiedVariables",
"(",
"stmt",
".",
"getBody",
"(",
")",
")",
";",
"stmt",
".",
"setModified",
"(",
"stmt",
".",
"getHeap",
"(",
")",
".",
"allocate",
"(",
"modified",
")",
")",
";",
"// Type condition assuming its false to represent the terminated loop.",
"// This is important if the condition contains a type test, as we'll",
"// know that doesn't hold here.",
"return",
"checkCondition",
"(",
"stmt",
".",
"getCondition",
"(",
")",
",",
"false",
",",
"environment",
")",
";",
"}"
] | Type check a do-while statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
@throws ResolveError
If a named type within this statement cannot be resolved within
the enclosing project. | [
"Type",
"check",
"a",
"do",
"-",
"while",
"statement",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L518-L530 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java | JideOverlayService.setVisible | protected final Boolean setVisible(JComponent targetComponent, JComponent overlay, Boolean show) {
"""
Show or hide the given overlay depending on the given <code>show</code> parameter.
@param targetComponent
the target component.
@param overlay
the overlay component.
@param show
whether to show or hide the given overlay (<code>true</code> for showing).
@return <code>true</code> if success and <code>false</code> in other case.
"""
Assert.notNull(targetComponent, JideOverlayService.TARGET_COMPONENT_PARAM);
Assert.notNull(overlay, JideOverlayService.OVERLAY);
Assert.notNull(show, "show");
// If overlay is installed...
if (this.isOverlayInstalled(targetComponent, overlay)) {
// Definitely show or hide overlay
overlay.setVisible(show);
overlay.repaint();
return Boolean.TRUE;
}
return Boolean.FALSE;
} | java | protected final Boolean setVisible(JComponent targetComponent, JComponent overlay, Boolean show) {
Assert.notNull(targetComponent, JideOverlayService.TARGET_COMPONENT_PARAM);
Assert.notNull(overlay, JideOverlayService.OVERLAY);
Assert.notNull(show, "show");
// If overlay is installed...
if (this.isOverlayInstalled(targetComponent, overlay)) {
// Definitely show or hide overlay
overlay.setVisible(show);
overlay.repaint();
return Boolean.TRUE;
}
return Boolean.FALSE;
} | [
"protected",
"final",
"Boolean",
"setVisible",
"(",
"JComponent",
"targetComponent",
",",
"JComponent",
"overlay",
",",
"Boolean",
"show",
")",
"{",
"Assert",
".",
"notNull",
"(",
"targetComponent",
",",
"JideOverlayService",
".",
"TARGET_COMPONENT_PARAM",
")",
";",
"Assert",
".",
"notNull",
"(",
"overlay",
",",
"JideOverlayService",
".",
"OVERLAY",
")",
";",
"Assert",
".",
"notNull",
"(",
"show",
",",
"\"show\"",
")",
";",
"// If overlay is installed...",
"if",
"(",
"this",
".",
"isOverlayInstalled",
"(",
"targetComponent",
",",
"overlay",
")",
")",
"{",
"// Definitely show or hide overlay",
"overlay",
".",
"setVisible",
"(",
"show",
")",
";",
"overlay",
".",
"repaint",
"(",
")",
";",
"return",
"Boolean",
".",
"TRUE",
";",
"}",
"return",
"Boolean",
".",
"FALSE",
";",
"}"
] | Show or hide the given overlay depending on the given <code>show</code> parameter.
@param targetComponent
the target component.
@param overlay
the overlay component.
@param show
whether to show or hide the given overlay (<code>true</code> for showing).
@return <code>true</code> if success and <code>false</code> in other case. | [
"Show",
"or",
"hide",
"the",
"given",
"overlay",
"depending",
"on",
"the",
"given",
"<code",
">",
"show<",
"/",
"code",
">",
"parameter",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java#L252-L269 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java | CommandArgsAccessor.getFirstInteger | @SuppressWarnings("unchecked")
public static <K, V> Long getFirstInteger(CommandArgs<K, V> commandArgs) {
"""
Get the first {@link Long integer} argument.
@param commandArgs must not be null.
@return the first {@link Long integer} argument or {@literal null}.
"""
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.IntegerArgument) {
return ((CommandArgs.IntegerArgument) singularArgument).val;
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <K, V> Long getFirstInteger(CommandArgs<K, V> commandArgs) {
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.IntegerArgument) {
return ((CommandArgs.IntegerArgument) singularArgument).val;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Long",
"getFirstInteger",
"(",
"CommandArgs",
"<",
"K",
",",
"V",
">",
"commandArgs",
")",
"{",
"for",
"(",
"SingularArgument",
"singularArgument",
":",
"commandArgs",
".",
"singularArguments",
")",
"{",
"if",
"(",
"singularArgument",
"instanceof",
"CommandArgs",
".",
"IntegerArgument",
")",
"{",
"return",
"(",
"(",
"CommandArgs",
".",
"IntegerArgument",
")",
"singularArgument",
")",
".",
"val",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Get the first {@link Long integer} argument.
@param commandArgs must not be null.
@return the first {@link Long integer} argument or {@literal null}. | [
"Get",
"the",
"first",
"{",
"@link",
"Long",
"integer",
"}",
"argument",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java#L96-L107 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryRawService.java | JobHistoryRawService.getAggregatedStatusPut | public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
"""
creates a put to be updated into the RAW table for aggregation status
@param row key
@param status of aggregation
@return {@link Put}
"""
Put put = new Put(row);
put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
try {
LOG.info(" agg status " + status + " and put " + put.toJSON());
} catch (IOException e) {
// ignore json exception
}
return put;
} | java | public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
Put put = new Put(row);
put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
try {
LOG.info(" agg status " + status + " and put " + put.toJSON());
} catch (IOException e) {
// ignore json exception
}
return put;
} | [
"public",
"Put",
"getAggregatedStatusPut",
"(",
"byte",
"[",
"]",
"row",
",",
"byte",
"[",
"]",
"col",
",",
"Boolean",
"status",
")",
"{",
"Put",
"put",
"=",
"new",
"Put",
"(",
"row",
")",
";",
"put",
".",
"addColumn",
"(",
"Constants",
".",
"INFO_FAM_BYTES",
",",
"col",
",",
"Bytes",
".",
"toBytes",
"(",
"status",
")",
")",
";",
"try",
"{",
"LOG",
".",
"info",
"(",
"\" agg status \"",
"+",
"status",
"+",
"\" and put \"",
"+",
"put",
".",
"toJSON",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// ignore json exception",
"}",
"return",
"put",
";",
"}"
] | creates a put to be updated into the RAW table for aggregation status
@param row key
@param status of aggregation
@return {@link Put} | [
"creates",
"a",
"put",
"to",
"be",
"updated",
"into",
"the",
"RAW",
"table",
"for",
"aggregation",
"status"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryRawService.java#L591-L600 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java | MenuItem.parseLocation | public void parseLocation(String location, String value) {
"""
Recover from the service the location object and set it and the value to
this item.
@param location The id to look into the conficuration file pm.locations.xml
@param value The location value
"""
setLocationValue(value);
setLocation(PresentationManager.getPm().getLocation(location));
} | java | public void parseLocation(String location, String value) {
setLocationValue(value);
setLocation(PresentationManager.getPm().getLocation(location));
} | [
"public",
"void",
"parseLocation",
"(",
"String",
"location",
",",
"String",
"value",
")",
"{",
"setLocationValue",
"(",
"value",
")",
";",
"setLocation",
"(",
"PresentationManager",
".",
"getPm",
"(",
")",
".",
"getLocation",
"(",
"location",
")",
")",
";",
"}"
] | Recover from the service the location object and set it and the value to
this item.
@param location The id to look into the conficuration file pm.locations.xml
@param value The location value | [
"Recover",
"from",
"the",
"service",
"the",
"location",
"object",
"and",
"set",
"it",
"and",
"the",
"value",
"to",
"this",
"item",
"."
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java#L60-L63 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java | StreamGraph.addVirtualSideOutputNode | public void addVirtualSideOutputNode(Integer originalId, Integer virtualId, OutputTag outputTag) {
"""
Adds a new virtual node that is used to connect a downstream vertex to only the outputs with
the selected side-output {@link OutputTag}.
@param originalId ID of the node that should be connected to.
@param virtualId ID of the virtual node.
@param outputTag The selected side-output {@code OutputTag}.
"""
if (virtualSideOutputNodes.containsKey(virtualId)) {
throw new IllegalStateException("Already has virtual output node with id " + virtualId);
}
// verify that we don't already have a virtual node for the given originalId/outputTag
// combination with a different TypeInformation. This would indicate that someone is trying
// to read a side output from an operation with a different type for the same side output
// id.
for (Tuple2<Integer, OutputTag> tag : virtualSideOutputNodes.values()) {
if (!tag.f0.equals(originalId)) {
// different source operator
continue;
}
if (tag.f1.getId().equals(outputTag.getId()) &&
!tag.f1.getTypeInfo().equals(outputTag.getTypeInfo())) {
throw new IllegalArgumentException("Trying to add a side output for the same " +
"side-output id with a different type. This is not allowed. Side-output ID: " +
tag.f1.getId());
}
}
virtualSideOutputNodes.put(virtualId, new Tuple2<>(originalId, outputTag));
} | java | public void addVirtualSideOutputNode(Integer originalId, Integer virtualId, OutputTag outputTag) {
if (virtualSideOutputNodes.containsKey(virtualId)) {
throw new IllegalStateException("Already has virtual output node with id " + virtualId);
}
// verify that we don't already have a virtual node for the given originalId/outputTag
// combination with a different TypeInformation. This would indicate that someone is trying
// to read a side output from an operation with a different type for the same side output
// id.
for (Tuple2<Integer, OutputTag> tag : virtualSideOutputNodes.values()) {
if (!tag.f0.equals(originalId)) {
// different source operator
continue;
}
if (tag.f1.getId().equals(outputTag.getId()) &&
!tag.f1.getTypeInfo().equals(outputTag.getTypeInfo())) {
throw new IllegalArgumentException("Trying to add a side output for the same " +
"side-output id with a different type. This is not allowed. Side-output ID: " +
tag.f1.getId());
}
}
virtualSideOutputNodes.put(virtualId, new Tuple2<>(originalId, outputTag));
} | [
"public",
"void",
"addVirtualSideOutputNode",
"(",
"Integer",
"originalId",
",",
"Integer",
"virtualId",
",",
"OutputTag",
"outputTag",
")",
"{",
"if",
"(",
"virtualSideOutputNodes",
".",
"containsKey",
"(",
"virtualId",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already has virtual output node with id \"",
"+",
"virtualId",
")",
";",
"}",
"// verify that we don't already have a virtual node for the given originalId/outputTag",
"// combination with a different TypeInformation. This would indicate that someone is trying",
"// to read a side output from an operation with a different type for the same side output",
"// id.",
"for",
"(",
"Tuple2",
"<",
"Integer",
",",
"OutputTag",
">",
"tag",
":",
"virtualSideOutputNodes",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"tag",
".",
"f0",
".",
"equals",
"(",
"originalId",
")",
")",
"{",
"// different source operator",
"continue",
";",
"}",
"if",
"(",
"tag",
".",
"f1",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"outputTag",
".",
"getId",
"(",
")",
")",
"&&",
"!",
"tag",
".",
"f1",
".",
"getTypeInfo",
"(",
")",
".",
"equals",
"(",
"outputTag",
".",
"getTypeInfo",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Trying to add a side output for the same \"",
"+",
"\"side-output id with a different type. This is not allowed. Side-output ID: \"",
"+",
"tag",
".",
"f1",
".",
"getId",
"(",
")",
")",
";",
"}",
"}",
"virtualSideOutputNodes",
".",
"put",
"(",
"virtualId",
",",
"new",
"Tuple2",
"<>",
"(",
"originalId",
",",
"outputTag",
")",
")",
";",
"}"
] | Adds a new virtual node that is used to connect a downstream vertex to only the outputs with
the selected side-output {@link OutputTag}.
@param originalId ID of the node that should be connected to.
@param virtualId ID of the virtual node.
@param outputTag The selected side-output {@code OutputTag}. | [
"Adds",
"a",
"new",
"virtual",
"node",
"that",
"is",
"used",
"to",
"connect",
"a",
"downstream",
"vertex",
"to",
"only",
"the",
"outputs",
"with",
"the",
"selected",
"side",
"-",
"output",
"{",
"@link",
"OutputTag",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java#L308-L334 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.revisionContainsTemplateFragmentWithoutIndex | public boolean revisionContainsTemplateFragmentWithoutIndex(int revId, String templateFragment) throws WikiApiException {
"""
Does the same as revisionContainsTemplateFragment() without using a template index
@param revId
@param templateFragment
@return
@throws WikiApiException
"""
if(revApi==null){
revApi = new RevisionApi(wiki.getDatabaseConfiguration());
}
if(parser==null){
//TODO switch to SWEBLE
MediaWikiParserFactory pf = new MediaWikiParserFactory(
wiki.getDatabaseConfiguration().getLanguage());
pf.setTemplateParserClass(ShowTemplateNamesAndParameters.class);
parser = pf.createParser();
}
List<Template> tplList = parser.parse(revApi.getRevision(revId).getRevisionText()).getTemplates();
for(Template tpl:tplList){
if(tpl.getName().toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | java | public boolean revisionContainsTemplateFragmentWithoutIndex(int revId, String templateFragment) throws WikiApiException{
if(revApi==null){
revApi = new RevisionApi(wiki.getDatabaseConfiguration());
}
if(parser==null){
//TODO switch to SWEBLE
MediaWikiParserFactory pf = new MediaWikiParserFactory(
wiki.getDatabaseConfiguration().getLanguage());
pf.setTemplateParserClass(ShowTemplateNamesAndParameters.class);
parser = pf.createParser();
}
List<Template> tplList = parser.parse(revApi.getRevision(revId).getRevisionText()).getTemplates();
for(Template tpl:tplList){
if(tpl.getName().toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | [
"public",
"boolean",
"revisionContainsTemplateFragmentWithoutIndex",
"(",
"int",
"revId",
",",
"String",
"templateFragment",
")",
"throws",
"WikiApiException",
"{",
"if",
"(",
"revApi",
"==",
"null",
")",
"{",
"revApi",
"=",
"new",
"RevisionApi",
"(",
"wiki",
".",
"getDatabaseConfiguration",
"(",
")",
")",
";",
"}",
"if",
"(",
"parser",
"==",
"null",
")",
"{",
"//TODO switch to SWEBLE",
"MediaWikiParserFactory",
"pf",
"=",
"new",
"MediaWikiParserFactory",
"(",
"wiki",
".",
"getDatabaseConfiguration",
"(",
")",
".",
"getLanguage",
"(",
")",
")",
";",
"pf",
".",
"setTemplateParserClass",
"(",
"ShowTemplateNamesAndParameters",
".",
"class",
")",
";",
"parser",
"=",
"pf",
".",
"createParser",
"(",
")",
";",
"}",
"List",
"<",
"Template",
">",
"tplList",
"=",
"parser",
".",
"parse",
"(",
"revApi",
".",
"getRevision",
"(",
"revId",
")",
".",
"getRevisionText",
"(",
")",
")",
".",
"getTemplates",
"(",
")",
";",
"for",
"(",
"Template",
"tpl",
":",
"tplList",
")",
"{",
"if",
"(",
"tpl",
".",
"getName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"templateFragment",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Does the same as revisionContainsTemplateFragment() without using a template index
@param revId
@param templateFragment
@return
@throws WikiApiException | [
"Does",
"the",
"same",
"as",
"revisionContainsTemplateFragment",
"()",
"without",
"using",
"a",
"template",
"index"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1332-L1351 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java | SM2Engine.processBlock | public byte[] processBlock(byte[] in, int inOff, int inLen) {
"""
处理块,包括加密和解密
@param in 数据
@param inOff 数据开始位置
@param inLen 数据长度
@return 结果
"""
if (forEncryption) {
return encrypt(in, inOff, inLen);
} else {
return decrypt(in, inOff, inLen);
}
} | java | public byte[] processBlock(byte[] in, int inOff, int inLen) {
if (forEncryption) {
return encrypt(in, inOff, inLen);
} else {
return decrypt(in, inOff, inLen);
}
} | [
"public",
"byte",
"[",
"]",
"processBlock",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"inOff",
",",
"int",
"inLen",
")",
"{",
"if",
"(",
"forEncryption",
")",
"{",
"return",
"encrypt",
"(",
"in",
",",
"inOff",
",",
"inLen",
")",
";",
"}",
"else",
"{",
"return",
"decrypt",
"(",
"in",
",",
"inOff",
",",
"inLen",
")",
";",
"}",
"}"
] | 处理块,包括加密和解密
@param in 数据
@param inOff 数据开始位置
@param inLen 数据长度
@return 结果 | [
"处理块,包括加密和解密"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L131-L137 |
HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseStyleDeclaration | public void parseStyleDeclaration(final CSSStyleDeclarationImpl sd, final String styleDecl) throws IOException {
"""
Parses a input string into a CSSOM style declaration.
@param styleDecl the input string
@param sd the CSSOM style declaration
@throws IOException if the underlying SAC parser throws an IOException
"""
try (InputSource source = new InputSource(new StringReader(styleDecl))) {
final Stack<Object> nodeStack = new Stack<>();
nodeStack.push(sd);
final CSSOMHandler handler = new CSSOMHandler(nodeStack);
parser_.setDocumentHandler(handler);
parser_.parseStyleDeclaration(source);
}
} | java | public void parseStyleDeclaration(final CSSStyleDeclarationImpl sd, final String styleDecl) throws IOException {
try (InputSource source = new InputSource(new StringReader(styleDecl))) {
final Stack<Object> nodeStack = new Stack<>();
nodeStack.push(sd);
final CSSOMHandler handler = new CSSOMHandler(nodeStack);
parser_.setDocumentHandler(handler);
parser_.parseStyleDeclaration(source);
}
} | [
"public",
"void",
"parseStyleDeclaration",
"(",
"final",
"CSSStyleDeclarationImpl",
"sd",
",",
"final",
"String",
"styleDecl",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"styleDecl",
")",
")",
")",
"{",
"final",
"Stack",
"<",
"Object",
">",
"nodeStack",
"=",
"new",
"Stack",
"<>",
"(",
")",
";",
"nodeStack",
".",
"push",
"(",
"sd",
")",
";",
"final",
"CSSOMHandler",
"handler",
"=",
"new",
"CSSOMHandler",
"(",
"nodeStack",
")",
";",
"parser_",
".",
"setDocumentHandler",
"(",
"handler",
")",
";",
"parser_",
".",
"parseStyleDeclaration",
"(",
"source",
")",
";",
"}",
"}"
] | Parses a input string into a CSSOM style declaration.
@param styleDecl the input string
@param sd the CSSOM style declaration
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"input",
"string",
"into",
"a",
"CSSOM",
"style",
"declaration",
"."
] | train | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L111-L119 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java | CleaneLingSolver.pushExtension | private void pushExtension(final CLClause c, final int blit) {
"""
Pushes and logs a clause and its blocking literal to the extension.
@param c the clause
@param blit the blocking literal
"""
pushExtension(0);
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != blit) { pushExtension(lit); }
}
pushExtension(blit);
} | java | private void pushExtension(final CLClause c, final int blit) {
pushExtension(0);
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != blit) { pushExtension(lit); }
}
pushExtension(blit);
} | [
"private",
"void",
"pushExtension",
"(",
"final",
"CLClause",
"c",
",",
"final",
"int",
"blit",
")",
"{",
"pushExtension",
"(",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"c",
".",
"lits",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"int",
"lit",
"=",
"c",
".",
"lits",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"lit",
"!=",
"blit",
")",
"{",
"pushExtension",
"(",
"lit",
")",
";",
"}",
"}",
"pushExtension",
"(",
"blit",
")",
";",
"}"
] | Pushes and logs a clause and its blocking literal to the extension.
@param c the clause
@param blit the blocking literal | [
"Pushes",
"and",
"logs",
"a",
"clause",
"and",
"its",
"blocking",
"literal",
"to",
"the",
"extension",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1044-L1051 |
wcm-io/wcm-io-tooling | netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupCompleter.java | MemberLookupCompleter.resolveClass | private Set<String> resolveClass(String variableName, String text, Document document) {
"""
This method tries to find the class which is defined for the given filter and returns a set with all methods and fields of the class
@param variableName
@param text
@param document
@return Set of methods and fields, never null
"""
Set<String> items = new LinkedHashSet<>();
FileObject fo = getFileObject(document);
ClassPath sourcePath = ClassPath.getClassPath(fo, ClassPath.SOURCE);
ClassPath compilePath = ClassPath.getClassPath(fo, ClassPath.COMPILE);
ClassPath bootPath = ClassPath.getClassPath(fo, ClassPath.BOOT);
if (sourcePath == null) {
return items;
}
ClassPath cp = ClassPathSupport.createProxyClassPath(sourcePath, compilePath, bootPath);
MemberLookupResolver resolver = new MemberLookupResolver(text, cp);
Set<MemberLookupResult> results = resolver.performMemberLookup(StringUtils.defaultString(StringUtils.substringBeforeLast(variableName, "."), variableName));
for (MemberLookupResult result : results) {
Matcher m = GETTER_PATTERN.matcher(result.getMethodName());
if (m.matches() && m.groupCount() >= 2) {
items.add(result.getVariableName() + "." + WordUtils.uncapitalize(m.group(2)));
}
else {
items.add(result.getVariableName() + "." + WordUtils.uncapitalize(result.getMethodName()));
}
}
return items;
} | java | private Set<String> resolveClass(String variableName, String text, Document document) {
Set<String> items = new LinkedHashSet<>();
FileObject fo = getFileObject(document);
ClassPath sourcePath = ClassPath.getClassPath(fo, ClassPath.SOURCE);
ClassPath compilePath = ClassPath.getClassPath(fo, ClassPath.COMPILE);
ClassPath bootPath = ClassPath.getClassPath(fo, ClassPath.BOOT);
if (sourcePath == null) {
return items;
}
ClassPath cp = ClassPathSupport.createProxyClassPath(sourcePath, compilePath, bootPath);
MemberLookupResolver resolver = new MemberLookupResolver(text, cp);
Set<MemberLookupResult> results = resolver.performMemberLookup(StringUtils.defaultString(StringUtils.substringBeforeLast(variableName, "."), variableName));
for (MemberLookupResult result : results) {
Matcher m = GETTER_PATTERN.matcher(result.getMethodName());
if (m.matches() && m.groupCount() >= 2) {
items.add(result.getVariableName() + "." + WordUtils.uncapitalize(m.group(2)));
}
else {
items.add(result.getVariableName() + "." + WordUtils.uncapitalize(result.getMethodName()));
}
}
return items;
} | [
"private",
"Set",
"<",
"String",
">",
"resolveClass",
"(",
"String",
"variableName",
",",
"String",
"text",
",",
"Document",
"document",
")",
"{",
"Set",
"<",
"String",
">",
"items",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"FileObject",
"fo",
"=",
"getFileObject",
"(",
"document",
")",
";",
"ClassPath",
"sourcePath",
"=",
"ClassPath",
".",
"getClassPath",
"(",
"fo",
",",
"ClassPath",
".",
"SOURCE",
")",
";",
"ClassPath",
"compilePath",
"=",
"ClassPath",
".",
"getClassPath",
"(",
"fo",
",",
"ClassPath",
".",
"COMPILE",
")",
";",
"ClassPath",
"bootPath",
"=",
"ClassPath",
".",
"getClassPath",
"(",
"fo",
",",
"ClassPath",
".",
"BOOT",
")",
";",
"if",
"(",
"sourcePath",
"==",
"null",
")",
"{",
"return",
"items",
";",
"}",
"ClassPath",
"cp",
"=",
"ClassPathSupport",
".",
"createProxyClassPath",
"(",
"sourcePath",
",",
"compilePath",
",",
"bootPath",
")",
";",
"MemberLookupResolver",
"resolver",
"=",
"new",
"MemberLookupResolver",
"(",
"text",
",",
"cp",
")",
";",
"Set",
"<",
"MemberLookupResult",
">",
"results",
"=",
"resolver",
".",
"performMemberLookup",
"(",
"StringUtils",
".",
"defaultString",
"(",
"StringUtils",
".",
"substringBeforeLast",
"(",
"variableName",
",",
"\".\"",
")",
",",
"variableName",
")",
")",
";",
"for",
"(",
"MemberLookupResult",
"result",
":",
"results",
")",
"{",
"Matcher",
"m",
"=",
"GETTER_PATTERN",
".",
"matcher",
"(",
"result",
".",
"getMethodName",
"(",
")",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
"&&",
"m",
".",
"groupCount",
"(",
")",
">=",
"2",
")",
"{",
"items",
".",
"add",
"(",
"result",
".",
"getVariableName",
"(",
")",
"+",
"\".\"",
"+",
"WordUtils",
".",
"uncapitalize",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
")",
";",
"}",
"else",
"{",
"items",
".",
"add",
"(",
"result",
".",
"getVariableName",
"(",
")",
"+",
"\".\"",
"+",
"WordUtils",
".",
"uncapitalize",
"(",
"result",
".",
"getMethodName",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"items",
";",
"}"
] | This method tries to find the class which is defined for the given filter and returns a set with all methods and fields of the class
@param variableName
@param text
@param document
@return Set of methods and fields, never null | [
"This",
"method",
"tries",
"to",
"find",
"the",
"class",
"which",
"is",
"defined",
"for",
"the",
"given",
"filter",
"and",
"returns",
"a",
"set",
"with",
"all",
"methods",
"and",
"fields",
"of",
"the",
"class"
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupCompleter.java#L117-L139 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java | TileBoundingBoxUtils.tileGridZoomIncrease | public static TileGrid tileGridZoomIncrease(TileGrid tileGrid,
int zoomLevels) {
"""
Get the tile grid starting from the tile grid and zooming in / increasing
the number of levels
@param tileGrid
current tile grid
@param zoomLevels
number of zoom levels to increase by
@return tile grid at new zoom level
@since 2.0.1
"""
long minX = tileGridMinZoomIncrease(tileGrid.getMinX(), zoomLevels);
long maxX = tileGridMaxZoomIncrease(tileGrid.getMaxX(), zoomLevels);
long minY = tileGridMinZoomIncrease(tileGrid.getMinY(), zoomLevels);
long maxY = tileGridMaxZoomIncrease(tileGrid.getMaxY(), zoomLevels);
TileGrid newTileGrid = new TileGrid(minX, minY, maxX, maxY);
return newTileGrid;
} | java | public static TileGrid tileGridZoomIncrease(TileGrid tileGrid,
int zoomLevels) {
long minX = tileGridMinZoomIncrease(tileGrid.getMinX(), zoomLevels);
long maxX = tileGridMaxZoomIncrease(tileGrid.getMaxX(), zoomLevels);
long minY = tileGridMinZoomIncrease(tileGrid.getMinY(), zoomLevels);
long maxY = tileGridMaxZoomIncrease(tileGrid.getMaxY(), zoomLevels);
TileGrid newTileGrid = new TileGrid(minX, minY, maxX, maxY);
return newTileGrid;
} | [
"public",
"static",
"TileGrid",
"tileGridZoomIncrease",
"(",
"TileGrid",
"tileGrid",
",",
"int",
"zoomLevels",
")",
"{",
"long",
"minX",
"=",
"tileGridMinZoomIncrease",
"(",
"tileGrid",
".",
"getMinX",
"(",
")",
",",
"zoomLevels",
")",
";",
"long",
"maxX",
"=",
"tileGridMaxZoomIncrease",
"(",
"tileGrid",
".",
"getMaxX",
"(",
")",
",",
"zoomLevels",
")",
";",
"long",
"minY",
"=",
"tileGridMinZoomIncrease",
"(",
"tileGrid",
".",
"getMinY",
"(",
")",
",",
"zoomLevels",
")",
";",
"long",
"maxY",
"=",
"tileGridMaxZoomIncrease",
"(",
"tileGrid",
".",
"getMaxY",
"(",
")",
",",
"zoomLevels",
")",
";",
"TileGrid",
"newTileGrid",
"=",
"new",
"TileGrid",
"(",
"minX",
",",
"minY",
",",
"maxX",
",",
"maxY",
")",
";",
"return",
"newTileGrid",
";",
"}"
] | Get the tile grid starting from the tile grid and zooming in / increasing
the number of levels
@param tileGrid
current tile grid
@param zoomLevels
number of zoom levels to increase by
@return tile grid at new zoom level
@since 2.0.1 | [
"Get",
"the",
"tile",
"grid",
"starting",
"from",
"the",
"tile",
"grid",
"and",
"zooming",
"in",
"/",
"increasing",
"the",
"number",
"of",
"levels"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L1295-L1303 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getExchangeInfo | public void getExchangeInfo(Exchange.Type currency, long quantity, Callback<Exchange> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on exchange coins API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/exchange/coins">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param currency exchange currency type
@param quantity The amount to exchange
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid value
@throws NullPointerException if given {@link Callback} is empty
@see Exchange Exchange info
"""
isValueValid(quantity);
gw2API.getExchangeInfo(currency.name(), Long.toString(quantity)).enqueue(callback);
} | java | public void getExchangeInfo(Exchange.Type currency, long quantity, Callback<Exchange> callback) throws GuildWars2Exception, NullPointerException {
isValueValid(quantity);
gw2API.getExchangeInfo(currency.name(), Long.toString(quantity)).enqueue(callback);
} | [
"public",
"void",
"getExchangeInfo",
"(",
"Exchange",
".",
"Type",
"currency",
",",
"long",
"quantity",
",",
"Callback",
"<",
"Exchange",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isValueValid",
"(",
"quantity",
")",
";",
"gw2API",
".",
"getExchangeInfo",
"(",
"currency",
".",
"name",
"(",
")",
",",
"Long",
".",
"toString",
"(",
"quantity",
")",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
] | For more info on exchange coins API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/exchange/coins">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param currency exchange currency type
@param quantity The amount to exchange
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid value
@throws NullPointerException if given {@link Callback} is empty
@see Exchange Exchange info | [
"For",
"more",
"info",
"on",
"exchange",
"coins",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"commerce",
"/",
"exchange",
"/",
"coins",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"the",
"access",
"to",
"{",
"@link",
"Callback#onResponse",
"(",
"Call",
"Response",
")",
"}",
"and",
"{",
"@link",
"Callback#onFailure",
"(",
"Call",
"Throwable",
")",
"}",
"methods",
"for",
"custom",
"interactions"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L933-L936 |
infinispan/infinispan | core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java | ClusterExpirationManager.handleLifespanExpireEntry | CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) {
"""
holds the lock until this CompletableFuture completes. Without lock skipping this would deadlock.
"""
// The most used case will be a miss so no extra read before
if (expiring.putIfAbsent(key, key) == null) {
if (trace) {
log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan);
}
AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache;
CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan);
return future.whenComplete((v, t) -> expiring.remove(key, key));
}
return CompletableFutures.completedNull();
} | java | CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) {
// The most used case will be a miss so no extra read before
if (expiring.putIfAbsent(key, key) == null) {
if (trace) {
log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan);
}
AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache;
CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan);
return future.whenComplete((v, t) -> expiring.remove(key, key));
}
return CompletableFutures.completedNull();
} | [
"CompletableFuture",
"<",
"Void",
">",
"handleLifespanExpireEntry",
"(",
"K",
"key",
",",
"V",
"value",
",",
"long",
"lifespan",
",",
"boolean",
"skipLocking",
")",
"{",
"// The most used case will be a miss so no extra read before",
"if",
"(",
"expiring",
".",
"putIfAbsent",
"(",
"key",
",",
"key",
")",
"==",
"null",
")",
"{",
"if",
"(",
"trace",
")",
"{",
"log",
".",
"tracef",
"(",
"\"Submitting expiration removal for key %s which had lifespan of %s\"",
",",
"toStr",
"(",
"key",
")",
",",
"lifespan",
")",
";",
"}",
"AdvancedCache",
"<",
"K",
",",
"V",
">",
"cacheToUse",
"=",
"skipLocking",
"?",
"cache",
".",
"withFlags",
"(",
"Flag",
".",
"SKIP_LOCKING",
")",
":",
"cache",
";",
"CompletableFuture",
"<",
"Void",
">",
"future",
"=",
"cacheToUse",
".",
"removeLifespanExpired",
"(",
"key",
",",
"value",
",",
"lifespan",
")",
";",
"return",
"future",
".",
"whenComplete",
"(",
"(",
"v",
",",
"t",
")",
"->",
"expiring",
".",
"remove",
"(",
"key",
",",
"key",
")",
")",
";",
"}",
"return",
"CompletableFutures",
".",
"completedNull",
"(",
")",
";",
"}"
] | holds the lock until this CompletableFuture completes. Without lock skipping this would deadlock. | [
"holds",
"the",
"lock",
"until",
"this",
"CompletableFuture",
"completes",
".",
"Without",
"lock",
"skipping",
"this",
"would",
"deadlock",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java#L137-L148 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.bezierCurveTo | public void bezierCurveTo(double xc1, double yc1, double xc2, double yc2, double x1, double y1) {
"""
Adds segments to the current path to make a cubic Bezier curve.
The coordinates are transformed by the current transform as they are
added to the path and unaffected by subsequent changes to the transform.
The current path is a path attribute
used for any of the path methods as specified in the
Rendering Attributes Table of {@link GraphicsContext}
and <b>is not affected</b> by the {@link #save()} and
{@link #restore()} operations.
@param xc1 the X coordinate of first Bezier control point.
@param yc1 the Y coordinate of the first Bezier control point.
@param xc2 the X coordinate of the second Bezier control point.
@param yc2 the Y coordinate of the second Bezier control point.
@param x1 the X coordinate of the end point.
@param y1 the Y coordinate of the end point.
"""
this.gc.bezierCurveTo(
doc2fxX(xc1), doc2fxY(yc1),
doc2fxX(xc2), doc2fxY(yc2),
doc2fxX(x1), doc2fxY(y1));
} | java | public void bezierCurveTo(double xc1, double yc1, double xc2, double yc2, double x1, double y1) {
this.gc.bezierCurveTo(
doc2fxX(xc1), doc2fxY(yc1),
doc2fxX(xc2), doc2fxY(yc2),
doc2fxX(x1), doc2fxY(y1));
} | [
"public",
"void",
"bezierCurveTo",
"(",
"double",
"xc1",
",",
"double",
"yc1",
",",
"double",
"xc2",
",",
"double",
"yc2",
",",
"double",
"x1",
",",
"double",
"y1",
")",
"{",
"this",
".",
"gc",
".",
"bezierCurveTo",
"(",
"doc2fxX",
"(",
"xc1",
")",
",",
"doc2fxY",
"(",
"yc1",
")",
",",
"doc2fxX",
"(",
"xc2",
")",
",",
"doc2fxY",
"(",
"yc2",
")",
",",
"doc2fxX",
"(",
"x1",
")",
",",
"doc2fxY",
"(",
"y1",
")",
")",
";",
"}"
] | Adds segments to the current path to make a cubic Bezier curve.
The coordinates are transformed by the current transform as they are
added to the path and unaffected by subsequent changes to the transform.
The current path is a path attribute
used for any of the path methods as specified in the
Rendering Attributes Table of {@link GraphicsContext}
and <b>is not affected</b> by the {@link #save()} and
{@link #restore()} operations.
@param xc1 the X coordinate of first Bezier control point.
@param yc1 the Y coordinate of the first Bezier control point.
@param xc2 the X coordinate of the second Bezier control point.
@param yc2 the Y coordinate of the second Bezier control point.
@param x1 the X coordinate of the end point.
@param y1 the Y coordinate of the end point. | [
"Adds",
"segments",
"to",
"the",
"current",
"path",
"to",
"make",
"a",
"cubic",
"Bezier",
"curve",
".",
"The",
"coordinates",
"are",
"transformed",
"by",
"the",
"current",
"transform",
"as",
"they",
"are",
"added",
"to",
"the",
"path",
"and",
"unaffected",
"by",
"subsequent",
"changes",
"to",
"the",
"transform",
".",
"The",
"current",
"path",
"is",
"a",
"path",
"attribute",
"used",
"for",
"any",
"of",
"the",
"path",
"methods",
"as",
"specified",
"in",
"the",
"Rendering",
"Attributes",
"Table",
"of",
"{",
"@link",
"GraphicsContext",
"}",
"and",
"<b",
">",
"is",
"not",
"affected<",
"/",
"b",
">",
"by",
"the",
"{",
"@link",
"#save",
"()",
"}",
"and",
"{",
"@link",
"#restore",
"()",
"}",
"operations",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1271-L1276 |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java | RichTextUtil.addParsedText | public static void addParsedText(@NotNull Element parent, @NotNull String text) throws JDOMException {
"""
Parses XHTML text string, and adds to parsed content to the given parent element.
@param parent Parent element to add parsed content to
@param text XHTML text string (root element not needed)
@throws JDOMException Is thrown if the text could not be parsed as XHTML
"""
addParsedText(parent, text, false);
} | java | public static void addParsedText(@NotNull Element parent, @NotNull String text) throws JDOMException {
addParsedText(parent, text, false);
} | [
"public",
"static",
"void",
"addParsedText",
"(",
"@",
"NotNull",
"Element",
"parent",
",",
"@",
"NotNull",
"String",
"text",
")",
"throws",
"JDOMException",
"{",
"addParsedText",
"(",
"parent",
",",
"text",
",",
"false",
")",
";",
"}"
] | Parses XHTML text string, and adds to parsed content to the given parent element.
@param parent Parent element to add parsed content to
@param text XHTML text string (root element not needed)
@throws JDOMException Is thrown if the text could not be parsed as XHTML | [
"Parses",
"XHTML",
"text",
"string",
"and",
"adds",
"to",
"parsed",
"content",
"to",
"the",
"given",
"parent",
"element",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java#L108-L110 |
docker-java/docker-java | src/main/java/com/github/dockerjava/core/util/FilePathUtil.java | FilePathUtil.relativize | public static String relativize(File baseDir, File file) {
"""
Return the relative path. Path elements are separated with / char.
@param baseDir
a parent directory of {@code file}
@param file
the file to get the relative path
@return the relative path
"""
try {
baseDir = baseDir.getCanonicalFile();
file = file.getCanonicalFile();
return baseDir.toURI().relativize(file.toURI()).getPath();
} catch (IOException e) {
throw new DockerClientException(e.getMessage(), e);
}
} | java | public static String relativize(File baseDir, File file) {
try {
baseDir = baseDir.getCanonicalFile();
file = file.getCanonicalFile();
return baseDir.toURI().relativize(file.toURI()).getPath();
} catch (IOException e) {
throw new DockerClientException(e.getMessage(), e);
}
} | [
"public",
"static",
"String",
"relativize",
"(",
"File",
"baseDir",
",",
"File",
"file",
")",
"{",
"try",
"{",
"baseDir",
"=",
"baseDir",
".",
"getCanonicalFile",
"(",
")",
";",
"file",
"=",
"file",
".",
"getCanonicalFile",
"(",
")",
";",
"return",
"baseDir",
".",
"toURI",
"(",
")",
".",
"relativize",
"(",
"file",
".",
"toURI",
"(",
")",
")",
".",
"getPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"DockerClientException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Return the relative path. Path elements are separated with / char.
@param baseDir
a parent directory of {@code file}
@param file
the file to get the relative path
@return the relative path | [
"Return",
"the",
"relative",
"path",
".",
"Path",
"elements",
"are",
"separated",
"with",
"/",
"char",
"."
] | train | https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/util/FilePathUtil.java#L23-L32 |
sebastiangraf/jSCSI | bundles/target/src/main/java/org/jscsi/target/settings/NumericalValueRange.java | NumericalValueRange.create | public static final NumericalValueRange create (final int min, final int max) {
"""
The build method for creating {@link NumericalValueRange} objects. The specified <i>min</i> and <i>max</i>
parameters are going to be used for initializing the {@link #min} and {@link #max} variables of the new
{@link NumericalValueRange}. Since this only makes sense if <i>min</i> ≤ <i>max</i>, <code>null</code> will be
returned if this requirement is violated.
@param min the lower bound
@param max the upper bound
@return a {@link NumericalValueRange} representing the specified interval or <code>null</code>
"""
if (min > max) return null;
return new NumericalValueRange(min, max);
} | java | public static final NumericalValueRange create (final int min, final int max) {
if (min > max) return null;
return new NumericalValueRange(min, max);
} | [
"public",
"static",
"final",
"NumericalValueRange",
"create",
"(",
"final",
"int",
"min",
",",
"final",
"int",
"max",
")",
"{",
"if",
"(",
"min",
">",
"max",
")",
"return",
"null",
";",
"return",
"new",
"NumericalValueRange",
"(",
"min",
",",
"max",
")",
";",
"}"
] | The build method for creating {@link NumericalValueRange} objects. The specified <i>min</i> and <i>max</i>
parameters are going to be used for initializing the {@link #min} and {@link #max} variables of the new
{@link NumericalValueRange}. Since this only makes sense if <i>min</i> ≤ <i>max</i>, <code>null</code> will be
returned if this requirement is violated.
@param min the lower bound
@param max the upper bound
@return a {@link NumericalValueRange} representing the specified interval or <code>null</code> | [
"The",
"build",
"method",
"for",
"creating",
"{",
"@link",
"NumericalValueRange",
"}",
"objects",
".",
"The",
"specified",
"<i",
">",
"min<",
"/",
"i",
">",
"and",
"<i",
">",
"max<",
"/",
"i",
">",
"parameters",
"are",
"going",
"to",
"be",
"used",
"for",
"initializing",
"the",
"{",
"@link",
"#min",
"}",
"and",
"{",
"@link",
"#max",
"}",
"variables",
"of",
"the",
"new",
"{",
"@link",
"NumericalValueRange",
"}",
".",
"Since",
"this",
"only",
"makes",
"sense",
"if",
"<i",
">",
"min<",
"/",
"i",
">",
"&le",
";",
"<i",
">",
"max<",
"/",
"i",
">",
"<code",
">",
"null<",
"/",
"code",
">",
"will",
"be",
"returned",
"if",
"this",
"requirement",
"is",
"violated",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/settings/NumericalValueRange.java#L35-L38 |
h2oai/h2o-3 | h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParser.java | OrcParser.check_Min_Value | private void check_Min_Value(long l, int cIdx, int rowNumber, ParseWriter dout) {
"""
This method is written to check and make sure any value written to a column of type long
is more than Long.MIN_VALUE. If this is not true, a warning will be passed to the user.
@param l
@param cIdx
@param rowNumber
@param dout
"""
if (l <= Long.MIN_VALUE) {
String warning = "Orc Parser: Long.MIN_VALUE: " + l + " is found in column "+cIdx+" row "+rowNumber +
" of stripe "+_cidx +". This value is used for sentinel and will not be parsed correctly.";
dout.addError(new ParseWriter.ParseErr(warning, _cidx, rowNumber, -2L));
}
} | java | private void check_Min_Value(long l, int cIdx, int rowNumber, ParseWriter dout) {
if (l <= Long.MIN_VALUE) {
String warning = "Orc Parser: Long.MIN_VALUE: " + l + " is found in column "+cIdx+" row "+rowNumber +
" of stripe "+_cidx +". This value is used for sentinel and will not be parsed correctly.";
dout.addError(new ParseWriter.ParseErr(warning, _cidx, rowNumber, -2L));
}
} | [
"private",
"void",
"check_Min_Value",
"(",
"long",
"l",
",",
"int",
"cIdx",
",",
"int",
"rowNumber",
",",
"ParseWriter",
"dout",
")",
"{",
"if",
"(",
"l",
"<=",
"Long",
".",
"MIN_VALUE",
")",
"{",
"String",
"warning",
"=",
"\"Orc Parser: Long.MIN_VALUE: \"",
"+",
"l",
"+",
"\" is found in column \"",
"+",
"cIdx",
"+",
"\" row \"",
"+",
"rowNumber",
"+",
"\" of stripe \"",
"+",
"_cidx",
"+",
"\". This value is used for sentinel and will not be parsed correctly.\"",
";",
"dout",
".",
"addError",
"(",
"new",
"ParseWriter",
".",
"ParseErr",
"(",
"warning",
",",
"_cidx",
",",
"rowNumber",
",",
"-",
"2L",
")",
")",
";",
"}",
"}"
] | This method is written to check and make sure any value written to a column of type long
is more than Long.MIN_VALUE. If this is not true, a warning will be passed to the user.
@param l
@param cIdx
@param rowNumber
@param dout | [
"This",
"method",
"is",
"written",
"to",
"check",
"and",
"make",
"sure",
"any",
"value",
"written",
"to",
"a",
"column",
"of",
"type",
"long",
"is",
"more",
"than",
"Long",
".",
"MIN_VALUE",
".",
"If",
"this",
"is",
"not",
"true",
"a",
"warning",
"will",
"be",
"passed",
"to",
"the",
"user",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParser.java#L467-L473 |
pressgang-ccms/PressGangCCMSZanataInterface | src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java | ZanataInterface.runCopyTrans | public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
"""
Run copy trans against a Source Document in zanata and then wait for it to complete
@param zanataId The id of the document to run copytrans for.
@param waitForFinish Wait for copytrans to finish running.
@return True if copytrans was run successfully, otherwise false.
"""
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
} | java | public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
} | [
"public",
"boolean",
"runCopyTrans",
"(",
"final",
"String",
"zanataId",
",",
"boolean",
"waitForFinish",
")",
"{",
"log",
".",
"debug",
"(",
"\"Running Zanata CopyTrans for \"",
"+",
"zanataId",
")",
";",
"try",
"{",
"final",
"CopyTransResource",
"copyTransResource",
"=",
"proxyFactory",
".",
"getCopyTransResource",
"(",
")",
";",
"copyTransResource",
".",
"startCopyTrans",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
",",
"zanataId",
")",
";",
"performZanataRESTCallWaiting",
"(",
")",
";",
"if",
"(",
"waitForFinish",
")",
"{",
"while",
"(",
"!",
"isCopyTransCompleteForSourceDocument",
"(",
"copyTransResource",
",",
"zanataId",
")",
")",
"{",
"// Sleep for 3/4 of a second",
"Thread",
".",
"sleep",
"(",
"750",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to run copyTrans for \"",
"+",
"zanataId",
",",
"e",
")",
";",
"}",
"finally",
"{",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Run copy trans against a Source Document in zanata and then wait for it to complete
@param zanataId The id of the document to run copytrans for.
@param waitForFinish Wait for copytrans to finish running.
@return True if copytrans was run successfully, otherwise false. | [
"Run",
"copy",
"trans",
"against",
"a",
"Source",
"Document",
"in",
"zanata",
"and",
"then",
"wait",
"for",
"it",
"to",
"complete"
] | train | https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L512-L535 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/api/Table.java | Table.sampleX | public Table sampleX(double proportion) {
"""
Returns a table consisting of randomly selected records from this table. The sample size is based on the
given proportion
@param proportion The proportion to go in the sample
"""
Preconditions.checkArgument(proportion <= 1 && proportion >= 0,
"The sample proportion must be between 0 and 1");
int tableSize = (int) Math.round(rowCount() * proportion);
return where(selectNRowsAtRandom(tableSize, rowCount()));
} | java | public Table sampleX(double proportion) {
Preconditions.checkArgument(proportion <= 1 && proportion >= 0,
"The sample proportion must be between 0 and 1");
int tableSize = (int) Math.round(rowCount() * proportion);
return where(selectNRowsAtRandom(tableSize, rowCount()));
} | [
"public",
"Table",
"sampleX",
"(",
"double",
"proportion",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"proportion",
"<=",
"1",
"&&",
"proportion",
">=",
"0",
",",
"\"The sample proportion must be between 0 and 1\"",
")",
";",
"int",
"tableSize",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"rowCount",
"(",
")",
"*",
"proportion",
")",
";",
"return",
"where",
"(",
"selectNRowsAtRandom",
"(",
"tableSize",
",",
"rowCount",
"(",
")",
")",
")",
";",
"}"
] | Returns a table consisting of randomly selected records from this table. The sample size is based on the
given proportion
@param proportion The proportion to go in the sample | [
"Returns",
"a",
"table",
"consisting",
"of",
"randomly",
"selected",
"records",
"from",
"this",
"table",
".",
"The",
"sample",
"size",
"is",
"based",
"on",
"the",
"given",
"proportion"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L464-L470 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java | EkstaziCFT.createCoverageClassVisitor | private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) {
"""
Creates class visitor to instrument for coverage based on configuration
options.
"""
// We cannot change classfiles if class is being redefined.
return new CoverageClassVisitor(className, cv);
} | java | private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) {
// We cannot change classfiles if class is being redefined.
return new CoverageClassVisitor(className, cv);
} | [
"private",
"CoverageClassVisitor",
"createCoverageClassVisitor",
"(",
"String",
"className",
",",
"ClassWriter",
"cv",
",",
"boolean",
"isRedefined",
")",
"{",
"// We cannot change classfiles if class is being redefined.",
"return",
"new",
"CoverageClassVisitor",
"(",
"className",
",",
"cv",
")",
";",
"}"
] | Creates class visitor to instrument for coverage based on configuration
options. | [
"Creates",
"class",
"visitor",
"to",
"instrument",
"for",
"coverage",
"based",
"on",
"configuration",
"options",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L219-L222 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/Record.java | Record.handleLocalCriteria | public boolean handleLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) {
"""
Check to see if this record should be skipped.
Generally, you use a remote criteria.
@param strFilter The current SQL WHERE string.
@param bIncludeFileName Include the Filename.fieldName in the string.
@param vParamList The list of params.
@return true if the criteria passes.
@return false if the criteria fails, and returns without checking further.
"""
BaseListener nextListener = this.getNextEnabledListener();
boolean bDontSkip = true;
if (nextListener != null)
bDontSkip = ((FileListener)nextListener).doLocalCriteria(strFilter, bIncludeFileName, vParamList);
else
bDontSkip = this.doLocalCriteria(strFilter, bIncludeFileName, vParamList);
if (bDontSkip == false)
return bDontSkip; // skip it
return this.getTable().doLocalCriteria(strFilter, bIncludeFileName, vParamList); // Give the table a shot at it
} | java | public boolean handleLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList)
{
BaseListener nextListener = this.getNextEnabledListener();
boolean bDontSkip = true;
if (nextListener != null)
bDontSkip = ((FileListener)nextListener).doLocalCriteria(strFilter, bIncludeFileName, vParamList);
else
bDontSkip = this.doLocalCriteria(strFilter, bIncludeFileName, vParamList);
if (bDontSkip == false)
return bDontSkip; // skip it
return this.getTable().doLocalCriteria(strFilter, bIncludeFileName, vParamList); // Give the table a shot at it
} | [
"public",
"boolean",
"handleLocalCriteria",
"(",
"StringBuffer",
"strFilter",
",",
"boolean",
"bIncludeFileName",
",",
"Vector",
"<",
"BaseField",
">",
"vParamList",
")",
"{",
"BaseListener",
"nextListener",
"=",
"this",
".",
"getNextEnabledListener",
"(",
")",
";",
"boolean",
"bDontSkip",
"=",
"true",
";",
"if",
"(",
"nextListener",
"!=",
"null",
")",
"bDontSkip",
"=",
"(",
"(",
"FileListener",
")",
"nextListener",
")",
".",
"doLocalCriteria",
"(",
"strFilter",
",",
"bIncludeFileName",
",",
"vParamList",
")",
";",
"else",
"bDontSkip",
"=",
"this",
".",
"doLocalCriteria",
"(",
"strFilter",
",",
"bIncludeFileName",
",",
"vParamList",
")",
";",
"if",
"(",
"bDontSkip",
"==",
"false",
")",
"return",
"bDontSkip",
";",
"// skip it",
"return",
"this",
".",
"getTable",
"(",
")",
".",
"doLocalCriteria",
"(",
"strFilter",
",",
"bIncludeFileName",
",",
"vParamList",
")",
";",
"// Give the table a shot at it",
"}"
] | Check to see if this record should be skipped.
Generally, you use a remote criteria.
@param strFilter The current SQL WHERE string.
@param bIncludeFileName Include the Filename.fieldName in the string.
@param vParamList The list of params.
@return true if the criteria passes.
@return false if the criteria fails, and returns without checking further. | [
"Check",
"to",
"see",
"if",
"this",
"record",
"should",
"be",
"skipped",
".",
"Generally",
"you",
"use",
"a",
"remote",
"criteria",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1647-L1658 |
maochen/NLP | CoreNLP-NLP/src/main/java/org/maochen/nlp/ml/classifier/perceptron/PerceptronClassifier.java | PerceptronClassifier.onlineTrain | public void onlineTrain(final double[] x, final int labelIndex) {
"""
public use for doing one training sample.
@param x Feature Vector
@param labelIndex label's index, from PerceptronModel.LabelIndexer
"""
Map<Integer, Double> result = predict(x);
Map.Entry<Integer, Double> maxResult = result.entrySet().stream().max((e1, e2) -> e1.getValue().compareTo(e2.getValue())).orElse(null);
if (maxResult.getKey() != labelIndex) {
double e_correction_d = 1;
model.weights[labelIndex] = reweight(x, model.weights[labelIndex], e_correction_d);
model.bias[labelIndex] = e_correction_d;
double w_correction_d = -1;
model.weights[maxResult.getKey()] = reweight(x, model.weights[maxResult.getKey()], w_correction_d);
model.bias[maxResult.getKey()] = w_correction_d;
}
if (LOG.isDebugEnabled()) {
LOG.debug("New bias: " + Arrays.toString(model.bias));
LOG.debug("New weight: " + Arrays.stream(model.weights).map(Arrays::toString).reduce((wi, wii) -> wi + ", " + wii).get());
}
} | java | public void onlineTrain(final double[] x, final int labelIndex) {
Map<Integer, Double> result = predict(x);
Map.Entry<Integer, Double> maxResult = result.entrySet().stream().max((e1, e2) -> e1.getValue().compareTo(e2.getValue())).orElse(null);
if (maxResult.getKey() != labelIndex) {
double e_correction_d = 1;
model.weights[labelIndex] = reweight(x, model.weights[labelIndex], e_correction_d);
model.bias[labelIndex] = e_correction_d;
double w_correction_d = -1;
model.weights[maxResult.getKey()] = reweight(x, model.weights[maxResult.getKey()], w_correction_d);
model.bias[maxResult.getKey()] = w_correction_d;
}
if (LOG.isDebugEnabled()) {
LOG.debug("New bias: " + Arrays.toString(model.bias));
LOG.debug("New weight: " + Arrays.stream(model.weights).map(Arrays::toString).reduce((wi, wii) -> wi + ", " + wii).get());
}
} | [
"public",
"void",
"onlineTrain",
"(",
"final",
"double",
"[",
"]",
"x",
",",
"final",
"int",
"labelIndex",
")",
"{",
"Map",
"<",
"Integer",
",",
"Double",
">",
"result",
"=",
"predict",
"(",
"x",
")",
";",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Double",
">",
"maxResult",
"=",
"result",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"max",
"(",
"(",
"e1",
",",
"e2",
")",
"->",
"e1",
".",
"getValue",
"(",
")",
".",
"compareTo",
"(",
"e2",
".",
"getValue",
"(",
")",
")",
")",
".",
"orElse",
"(",
"null",
")",
";",
"if",
"(",
"maxResult",
".",
"getKey",
"(",
")",
"!=",
"labelIndex",
")",
"{",
"double",
"e_correction_d",
"=",
"1",
";",
"model",
".",
"weights",
"[",
"labelIndex",
"]",
"=",
"reweight",
"(",
"x",
",",
"model",
".",
"weights",
"[",
"labelIndex",
"]",
",",
"e_correction_d",
")",
";",
"model",
".",
"bias",
"[",
"labelIndex",
"]",
"=",
"e_correction_d",
";",
"double",
"w_correction_d",
"=",
"-",
"1",
";",
"model",
".",
"weights",
"[",
"maxResult",
".",
"getKey",
"(",
")",
"]",
"=",
"reweight",
"(",
"x",
",",
"model",
".",
"weights",
"[",
"maxResult",
".",
"getKey",
"(",
")",
"]",
",",
"w_correction_d",
")",
";",
"model",
".",
"bias",
"[",
"maxResult",
".",
"getKey",
"(",
")",
"]",
"=",
"w_correction_d",
";",
"}",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"New bias: \"",
"+",
"Arrays",
".",
"toString",
"(",
"model",
".",
"bias",
")",
")",
";",
"LOG",
".",
"debug",
"(",
"\"New weight: \"",
"+",
"Arrays",
".",
"stream",
"(",
"model",
".",
"weights",
")",
".",
"map",
"(",
"Arrays",
"::",
"toString",
")",
".",
"reduce",
"(",
"(",
"wi",
",",
"wii",
")",
"->",
"wi",
"+",
"\", \"",
"+",
"wii",
")",
".",
"get",
"(",
")",
")",
";",
"}",
"}"
] | public use for doing one training sample.
@param x Feature Vector
@param labelIndex label's index, from PerceptronModel.LabelIndexer | [
"public",
"use",
"for",
"doing",
"one",
"training",
"sample",
"."
] | train | https://github.com/maochen/NLP/blob/38ae7b384d5295334d9efa9dc4cd901b19d9c27e/CoreNLP-NLP/src/main/java/org/maochen/nlp/ml/classifier/perceptron/PerceptronClassifier.java#L65-L83 |
VoltDB/voltdb | src/frontend/org/voltdb/LightweightNTClientResponseAdapter.java | LightweightNTClientResponseAdapter.callProcedure | public void callProcedure(AuthUser user,
boolean isAdmin,
int timeout,
ProcedureCallback cb,
String procName,
Object[] args) {
"""
Used to call a procedure from NTPRocedureRunner
Calls createTransaction with the proper params
"""
// since we know the caller, this is safe
assert(cb != null);
StoredProcedureInvocation task = new StoredProcedureInvocation();
task.setProcName(procName);
task.setParams(args);
if (timeout != BatchTimeoutOverrideType.NO_TIMEOUT) {
task.setBatchTimeout(timeout);
}
InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes(
DEFAULT_INTERNAL_ADAPTER_NAME, isAdmin, connectionId());
assert(m_dispatcher != null);
// JHH: I have no idea why we need to do this, but CL crashes if we don't. Sigh.
try {
task = MiscUtils.roundTripForCL(task);
} catch (Exception e) {
String msg = String.format("Cannot invoke procedure %s. failed to create task: %s",
procName, e.getMessage());
m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, msg);
ClientResponseImpl cri = new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], msg);
try {
cb.clientCallback(cri);
} catch (Exception e1) {
throw new IllegalStateException(e1);
}
}
createTransaction(kattrs, cb, task, user);
} | java | public void callProcedure(AuthUser user,
boolean isAdmin,
int timeout,
ProcedureCallback cb,
String procName,
Object[] args)
{
// since we know the caller, this is safe
assert(cb != null);
StoredProcedureInvocation task = new StoredProcedureInvocation();
task.setProcName(procName);
task.setParams(args);
if (timeout != BatchTimeoutOverrideType.NO_TIMEOUT) {
task.setBatchTimeout(timeout);
}
InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes(
DEFAULT_INTERNAL_ADAPTER_NAME, isAdmin, connectionId());
assert(m_dispatcher != null);
// JHH: I have no idea why we need to do this, but CL crashes if we don't. Sigh.
try {
task = MiscUtils.roundTripForCL(task);
} catch (Exception e) {
String msg = String.format("Cannot invoke procedure %s. failed to create task: %s",
procName, e.getMessage());
m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, msg);
ClientResponseImpl cri = new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], msg);
try {
cb.clientCallback(cri);
} catch (Exception e1) {
throw new IllegalStateException(e1);
}
}
createTransaction(kattrs, cb, task, user);
} | [
"public",
"void",
"callProcedure",
"(",
"AuthUser",
"user",
",",
"boolean",
"isAdmin",
",",
"int",
"timeout",
",",
"ProcedureCallback",
"cb",
",",
"String",
"procName",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"// since we know the caller, this is safe",
"assert",
"(",
"cb",
"!=",
"null",
")",
";",
"StoredProcedureInvocation",
"task",
"=",
"new",
"StoredProcedureInvocation",
"(",
")",
";",
"task",
".",
"setProcName",
"(",
"procName",
")",
";",
"task",
".",
"setParams",
"(",
"args",
")",
";",
"if",
"(",
"timeout",
"!=",
"BatchTimeoutOverrideType",
".",
"NO_TIMEOUT",
")",
"{",
"task",
".",
"setBatchTimeout",
"(",
"timeout",
")",
";",
"}",
"InternalAdapterTaskAttributes",
"kattrs",
"=",
"new",
"InternalAdapterTaskAttributes",
"(",
"DEFAULT_INTERNAL_ADAPTER_NAME",
",",
"isAdmin",
",",
"connectionId",
"(",
")",
")",
";",
"assert",
"(",
"m_dispatcher",
"!=",
"null",
")",
";",
"// JHH: I have no idea why we need to do this, but CL crashes if we don't. Sigh.",
"try",
"{",
"task",
"=",
"MiscUtils",
".",
"roundTripForCL",
"(",
"task",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
"\"Cannot invoke procedure %s. failed to create task: %s\"",
",",
"procName",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"m_logger",
".",
"rateLimitedLog",
"(",
"SUPPRESS_INTERVAL",
",",
"Level",
".",
"ERROR",
",",
"null",
",",
"msg",
")",
";",
"ClientResponseImpl",
"cri",
"=",
"new",
"ClientResponseImpl",
"(",
"ClientResponse",
".",
"UNEXPECTED_FAILURE",
",",
"new",
"VoltTable",
"[",
"0",
"]",
",",
"msg",
")",
";",
"try",
"{",
"cb",
".",
"clientCallback",
"(",
"cri",
")",
";",
"}",
"catch",
"(",
"Exception",
"e1",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e1",
")",
";",
"}",
"}",
"createTransaction",
"(",
"kattrs",
",",
"cb",
",",
"task",
",",
"user",
")",
";",
"}"
] | Used to call a procedure from NTPRocedureRunner
Calls createTransaction with the proper params | [
"Used",
"to",
"call",
"a",
"procedure",
"from",
"NTPRocedureRunner",
"Calls",
"createTransaction",
"with",
"the",
"proper",
"params"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/LightweightNTClientResponseAdapter.java#L277-L315 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryBlockByNumber | public BlockInfo queryBlockByNumber(Peer peer, long blockNumber) throws InvalidArgumentException, ProposalException {
"""
Query a peer in this channel for a Block by the blockNumber
<STRONG>This method may not be thread safe if client context is changed!</STRONG>
@param peer the peer to send the request to
@param blockNumber index of the Block in the chain
@return the {@link BlockInfo} with the given blockNumber
@throws InvalidArgumentException
@throws ProposalException
"""
return queryBlockByNumber(Collections.singleton(peer), blockNumber);
} | java | public BlockInfo queryBlockByNumber(Peer peer, long blockNumber) throws InvalidArgumentException, ProposalException {
return queryBlockByNumber(Collections.singleton(peer), blockNumber);
} | [
"public",
"BlockInfo",
"queryBlockByNumber",
"(",
"Peer",
"peer",
",",
"long",
"blockNumber",
")",
"throws",
"InvalidArgumentException",
",",
"ProposalException",
"{",
"return",
"queryBlockByNumber",
"(",
"Collections",
".",
"singleton",
"(",
"peer",
")",
",",
"blockNumber",
")",
";",
"}"
] | Query a peer in this channel for a Block by the blockNumber
<STRONG>This method may not be thread safe if client context is changed!</STRONG>
@param peer the peer to send the request to
@param blockNumber index of the Block in the chain
@return the {@link BlockInfo} with the given blockNumber
@throws InvalidArgumentException
@throws ProposalException | [
"Query",
"a",
"peer",
"in",
"this",
"channel",
"for",
"a",
"Block",
"by",
"the",
"blockNumber"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2879-L2883 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java | TreeRenderer.renderContent | protected void renderContent(AbstractRenderAppender writer, TreeElement node) {
"""
Render the Content for this node (if any).
@param writer the appender where the tree markup is appended
@param node the node to render
"""
String ctnt = node.getContent();
if (ctnt != null) {
renderContentPrefix(writer, node);
if (_trs.escapeContent) {
HtmlUtils.filter(ctnt, writer);
}
else {
writer.append(ctnt);
}
renderContentSuffix(writer, node);
}
} | java | protected void renderContent(AbstractRenderAppender writer, TreeElement node)
{
String ctnt = node.getContent();
if (ctnt != null) {
renderContentPrefix(writer, node);
if (_trs.escapeContent) {
HtmlUtils.filter(ctnt, writer);
}
else {
writer.append(ctnt);
}
renderContentSuffix(writer, node);
}
} | [
"protected",
"void",
"renderContent",
"(",
"AbstractRenderAppender",
"writer",
",",
"TreeElement",
"node",
")",
"{",
"String",
"ctnt",
"=",
"node",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"ctnt",
"!=",
"null",
")",
"{",
"renderContentPrefix",
"(",
"writer",
",",
"node",
")",
";",
"if",
"(",
"_trs",
".",
"escapeContent",
")",
"{",
"HtmlUtils",
".",
"filter",
"(",
"ctnt",
",",
"writer",
")",
";",
"}",
"else",
"{",
"writer",
".",
"append",
"(",
"ctnt",
")",
";",
"}",
"renderContentSuffix",
"(",
"writer",
",",
"node",
")",
";",
"}",
"}"
] | Render the Content for this node (if any).
@param writer the appender where the tree markup is appended
@param node the node to render | [
"Render",
"the",
"Content",
"for",
"this",
"node",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L759-L772 |
OpenTSDB/opentsdb | src/stats/Histogram.java | Histogram.printAsciiBucket | final void printAsciiBucket(final StringBuilder out, final int i) {
"""
Prints a bucket of this histogram in a human readable ASCII format.
@param out The buffer to which to write the output.
@see #printAscii
"""
out.append('[')
.append(bucketLowInterval(i))
.append('-')
.append(i == buckets.length - 1 ? "Inf" : bucketHighInterval(i))
.append("): ")
.append(buckets[i])
.append('\n');
} | java | final void printAsciiBucket(final StringBuilder out, final int i) {
out.append('[')
.append(bucketLowInterval(i))
.append('-')
.append(i == buckets.length - 1 ? "Inf" : bucketHighInterval(i))
.append("): ")
.append(buckets[i])
.append('\n');
} | [
"final",
"void",
"printAsciiBucket",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"int",
"i",
")",
"{",
"out",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"bucketLowInterval",
"(",
"i",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"i",
"==",
"buckets",
".",
"length",
"-",
"1",
"?",
"\"Inf\"",
":",
"bucketHighInterval",
"(",
"i",
")",
")",
".",
"append",
"(",
"\"): \"",
")",
".",
"append",
"(",
"buckets",
"[",
"i",
"]",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}"
] | Prints a bucket of this histogram in a human readable ASCII format.
@param out The buffer to which to write the output.
@see #printAscii | [
"Prints",
"a",
"bucket",
"of",
"this",
"histogram",
"in",
"a",
"human",
"readable",
"ASCII",
"format",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/stats/Histogram.java#L216-L224 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/NodeSequence.java | NodeSequence.withNodeKeys | public static NodeSequence withNodeKeys( final Iterator<NodeKey> keys,
final long keyCount,
final float score,
final String workspaceName,
final RepositoryCache repository ) {
"""
Create a sequence of nodes that iterates over the supplied node keys. Note that the supplied iterator is accessed lazily as
the resulting sequence's {@link #nextBatch() first batch} is {@link Batch#nextRow() used}.
@param keys the iterator over the keys of the node keys to be returned; if null, an {@link #emptySequence empty instance}
is returned
@param keyCount the number of node keys in the iterator; must be -1 if not known, 0 if known to be empty, or a positive
number if the number of node keys is known
@param score the score to return for all of the nodes
@param workspaceName the name of the workspace in which all of the nodes exist
@param repository the repository cache used to access the workspaces and cached nodes; may be null only if the key sequence
is null or empty
@return the sequence of nodes; never null
"""
assert keyCount >= -1;
if (keys == null) return emptySequence(1);
return withBatch(batchOfKeys(keys, keyCount, score, workspaceName, repository));
} | java | public static NodeSequence withNodeKeys( final Iterator<NodeKey> keys,
final long keyCount,
final float score,
final String workspaceName,
final RepositoryCache repository ) {
assert keyCount >= -1;
if (keys == null) return emptySequence(1);
return withBatch(batchOfKeys(keys, keyCount, score, workspaceName, repository));
} | [
"public",
"static",
"NodeSequence",
"withNodeKeys",
"(",
"final",
"Iterator",
"<",
"NodeKey",
">",
"keys",
",",
"final",
"long",
"keyCount",
",",
"final",
"float",
"score",
",",
"final",
"String",
"workspaceName",
",",
"final",
"RepositoryCache",
"repository",
")",
"{",
"assert",
"keyCount",
">=",
"-",
"1",
";",
"if",
"(",
"keys",
"==",
"null",
")",
"return",
"emptySequence",
"(",
"1",
")",
";",
"return",
"withBatch",
"(",
"batchOfKeys",
"(",
"keys",
",",
"keyCount",
",",
"score",
",",
"workspaceName",
",",
"repository",
")",
")",
";",
"}"
] | Create a sequence of nodes that iterates over the supplied node keys. Note that the supplied iterator is accessed lazily as
the resulting sequence's {@link #nextBatch() first batch} is {@link Batch#nextRow() used}.
@param keys the iterator over the keys of the node keys to be returned; if null, an {@link #emptySequence empty instance}
is returned
@param keyCount the number of node keys in the iterator; must be -1 if not known, 0 if known to be empty, or a positive
number if the number of node keys is known
@param score the score to return for all of the nodes
@param workspaceName the name of the workspace in which all of the nodes exist
@param repository the repository cache used to access the workspaces and cached nodes; may be null only if the key sequence
is null or empty
@return the sequence of nodes; never null | [
"Create",
"a",
"sequence",
"of",
"nodes",
"that",
"iterates",
"over",
"the",
"supplied",
"node",
"keys",
".",
"Note",
"that",
"the",
"supplied",
"iterator",
"is",
"accessed",
"lazily",
"as",
"the",
"resulting",
"sequence",
"s",
"{",
"@link",
"#nextBatch",
"()",
"first",
"batch",
"}",
"is",
"{",
"@link",
"Batch#nextRow",
"()",
"used",
"}",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/NodeSequence.java#L578-L586 |
sagiegurari/fax4j | src/main/java/org/fax4j/common/ServiceFactory.java | ServiceFactory.createService | public static Service createService(Enum<?> classNameKey,String defaultClassName,ConfigurationHolder configurationHolder,String propertyPart) {
"""
This function creates, initializes and returns new service objects.
@param classNameKey
The configuration key holding the service object class name
@param defaultClassName
The default service object class name if the value was not found in the configuration
@param configurationHolder
The configuration holder used to provide the configuration to the service
@param propertyPart
The service property part
@return The initialized service object
"""
//validate input
if(classNameKey==null)
{
throw new FaxException("Service class name key not provided.");
}
//convert to string
String classNameKeyString=classNameKey.toString();
//create service
Service service=ServiceFactory.createService(classNameKeyString,defaultClassName,configurationHolder,propertyPart);
return service;
} | java | public static Service createService(Enum<?> classNameKey,String defaultClassName,ConfigurationHolder configurationHolder,String propertyPart)
{
//validate input
if(classNameKey==null)
{
throw new FaxException("Service class name key not provided.");
}
//convert to string
String classNameKeyString=classNameKey.toString();
//create service
Service service=ServiceFactory.createService(classNameKeyString,defaultClassName,configurationHolder,propertyPart);
return service;
} | [
"public",
"static",
"Service",
"createService",
"(",
"Enum",
"<",
"?",
">",
"classNameKey",
",",
"String",
"defaultClassName",
",",
"ConfigurationHolder",
"configurationHolder",
",",
"String",
"propertyPart",
")",
"{",
"//validate input",
"if",
"(",
"classNameKey",
"==",
"null",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Service class name key not provided.\"",
")",
";",
"}",
"//convert to string",
"String",
"classNameKeyString",
"=",
"classNameKey",
".",
"toString",
"(",
")",
";",
"//create service",
"Service",
"service",
"=",
"ServiceFactory",
".",
"createService",
"(",
"classNameKeyString",
",",
"defaultClassName",
",",
"configurationHolder",
",",
"propertyPart",
")",
";",
"return",
"service",
";",
"}"
] | This function creates, initializes and returns new service objects.
@param classNameKey
The configuration key holding the service object class name
@param defaultClassName
The default service object class name if the value was not found in the configuration
@param configurationHolder
The configuration holder used to provide the configuration to the service
@param propertyPart
The service property part
@return The initialized service object | [
"This",
"function",
"creates",
"initializes",
"and",
"returns",
"new",
"service",
"objects",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/ServiceFactory.java#L37-L52 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.estimateTranslation | void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T ) {
"""
Estimate's the translation given the previously found rotation
@param R Rotation matrix
@param T (Output) estimated translation
"""
final int N = points.size();
W.reshape(N*2,3);
y.reshape(N*2,1);
Wty.reshape(3,1);
DMatrix3x3 Rtmp = new DMatrix3x3();
ConvertDMatrixStruct.convert(R,Rtmp);
int indexY = 0,indexW = 0;
for (int i = 0; i < N; i++) {
AssociatedPair p = points.get(i);
// rotate into camera frame
double u1 = Rtmp.a11*p.p1.x + Rtmp.a12*p.p1.y;
double u2 = Rtmp.a21*p.p1.x + Rtmp.a22*p.p1.y;
double u3 = Rtmp.a31*p.p1.x + Rtmp.a32*p.p1.y;
W.data[indexW++] = 1;
W.data[indexW++] = 0;
W.data[indexW++] = -p.p2.x;
W.data[indexW++] = 0;
W.data[indexW++] = 1;
W.data[indexW++] = -p.p2.y;
y.data[indexY++] = p.p2.x*u3 - u1;
y.data[indexY++] = p.p2.y*u3 - u2;
}
//======= Compute Pseudo Inverse
// WW = inv(W^T*W)
CommonOps_DDRM.multTransA(W,W,WW);
CommonOps_DDRM.invert(WW);
// W^T*y
CommonOps_DDRM.multTransA(W,y,Wty);
// translation = inv(W^T*W)*W^T*y
W.reshape(3,1);
CommonOps_DDRM.mult(WW,Wty,W);
T.x = W.data[0];
T.y = W.data[1];
T.z = W.data[2];
} | java | void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T )
{
final int N = points.size();
W.reshape(N*2,3);
y.reshape(N*2,1);
Wty.reshape(3,1);
DMatrix3x3 Rtmp = new DMatrix3x3();
ConvertDMatrixStruct.convert(R,Rtmp);
int indexY = 0,indexW = 0;
for (int i = 0; i < N; i++) {
AssociatedPair p = points.get(i);
// rotate into camera frame
double u1 = Rtmp.a11*p.p1.x + Rtmp.a12*p.p1.y;
double u2 = Rtmp.a21*p.p1.x + Rtmp.a22*p.p1.y;
double u3 = Rtmp.a31*p.p1.x + Rtmp.a32*p.p1.y;
W.data[indexW++] = 1;
W.data[indexW++] = 0;
W.data[indexW++] = -p.p2.x;
W.data[indexW++] = 0;
W.data[indexW++] = 1;
W.data[indexW++] = -p.p2.y;
y.data[indexY++] = p.p2.x*u3 - u1;
y.data[indexY++] = p.p2.y*u3 - u2;
}
//======= Compute Pseudo Inverse
// WW = inv(W^T*W)
CommonOps_DDRM.multTransA(W,W,WW);
CommonOps_DDRM.invert(WW);
// W^T*y
CommonOps_DDRM.multTransA(W,y,Wty);
// translation = inv(W^T*W)*W^T*y
W.reshape(3,1);
CommonOps_DDRM.mult(WW,Wty,W);
T.x = W.data[0];
T.y = W.data[1];
T.z = W.data[2];
} | [
"void",
"estimateTranslation",
"(",
"DMatrixRMaj",
"R",
",",
"List",
"<",
"AssociatedPair",
">",
"points",
",",
"Vector3D_F64",
"T",
")",
"{",
"final",
"int",
"N",
"=",
"points",
".",
"size",
"(",
")",
";",
"W",
".",
"reshape",
"(",
"N",
"*",
"2",
",",
"3",
")",
";",
"y",
".",
"reshape",
"(",
"N",
"*",
"2",
",",
"1",
")",
";",
"Wty",
".",
"reshape",
"(",
"3",
",",
"1",
")",
";",
"DMatrix3x3",
"Rtmp",
"=",
"new",
"DMatrix3x3",
"(",
")",
";",
"ConvertDMatrixStruct",
".",
"convert",
"(",
"R",
",",
"Rtmp",
")",
";",
"int",
"indexY",
"=",
"0",
",",
"indexW",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"AssociatedPair",
"p",
"=",
"points",
".",
"get",
"(",
"i",
")",
";",
"// rotate into camera frame",
"double",
"u1",
"=",
"Rtmp",
".",
"a11",
"*",
"p",
".",
"p1",
".",
"x",
"+",
"Rtmp",
".",
"a12",
"*",
"p",
".",
"p1",
".",
"y",
";",
"double",
"u2",
"=",
"Rtmp",
".",
"a21",
"*",
"p",
".",
"p1",
".",
"x",
"+",
"Rtmp",
".",
"a22",
"*",
"p",
".",
"p1",
".",
"y",
";",
"double",
"u3",
"=",
"Rtmp",
".",
"a31",
"*",
"p",
".",
"p1",
".",
"x",
"+",
"Rtmp",
".",
"a32",
"*",
"p",
".",
"p1",
".",
"y",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"1",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"0",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"-",
"p",
".",
"p2",
".",
"x",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"0",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"1",
";",
"W",
".",
"data",
"[",
"indexW",
"++",
"]",
"=",
"-",
"p",
".",
"p2",
".",
"y",
";",
"y",
".",
"data",
"[",
"indexY",
"++",
"]",
"=",
"p",
".",
"p2",
".",
"x",
"*",
"u3",
"-",
"u1",
";",
"y",
".",
"data",
"[",
"indexY",
"++",
"]",
"=",
"p",
".",
"p2",
".",
"y",
"*",
"u3",
"-",
"u2",
";",
"}",
"//======= Compute Pseudo Inverse",
"// WW = inv(W^T*W)",
"CommonOps_DDRM",
".",
"multTransA",
"(",
"W",
",",
"W",
",",
"WW",
")",
";",
"CommonOps_DDRM",
".",
"invert",
"(",
"WW",
")",
";",
"// W^T*y",
"CommonOps_DDRM",
".",
"multTransA",
"(",
"W",
",",
"y",
",",
"Wty",
")",
";",
"// translation = inv(W^T*W)*W^T*y",
"W",
".",
"reshape",
"(",
"3",
",",
"1",
")",
";",
"CommonOps_DDRM",
".",
"mult",
"(",
"WW",
",",
"Wty",
",",
"W",
")",
";",
"T",
".",
"x",
"=",
"W",
".",
"data",
"[",
"0",
"]",
";",
"T",
".",
"y",
"=",
"W",
".",
"data",
"[",
"1",
"]",
";",
"T",
".",
"z",
"=",
"W",
".",
"data",
"[",
"2",
"]",
";",
"}"
] | Estimate's the translation given the previously found rotation
@param R Rotation matrix
@param T (Output) estimated translation | [
"Estimate",
"s",
"the",
"translation",
"given",
"the",
"previously",
"found",
"rotation"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L213-L258 |
nguillaumin/slick2d-maven | slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java | FontFileReader.writeTTFUShort | public final void writeTTFUShort(int pos, int val) throws IOException {
"""
Write a USHort at a given position.
@param pos The absolute position to write to
@param val The value to write
@throws IOException If EOF is reached
"""
if ((pos + 2) > fsize) {
throw new java.io.EOFException("Reached EOF");
}
final byte b1 = (byte)((val >> 8) & 0xff);
final byte b2 = (byte)(val & 0xff);
file[pos] = b1;
file[pos + 1] = b2;
} | java | public final void writeTTFUShort(int pos, int val) throws IOException {
if ((pos + 2) > fsize) {
throw new java.io.EOFException("Reached EOF");
}
final byte b1 = (byte)((val >> 8) & 0xff);
final byte b2 = (byte)(val & 0xff);
file[pos] = b1;
file[pos + 1] = b2;
} | [
"public",
"final",
"void",
"writeTTFUShort",
"(",
"int",
"pos",
",",
"int",
"val",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"pos",
"+",
"2",
")",
">",
"fsize",
")",
"{",
"throw",
"new",
"java",
".",
"io",
".",
"EOFException",
"(",
"\"Reached EOF\"",
")",
";",
"}",
"final",
"byte",
"b1",
"=",
"(",
"byte",
")",
"(",
"(",
"val",
">>",
"8",
")",
"&",
"0xff",
")",
";",
"final",
"byte",
"b2",
"=",
"(",
"byte",
")",
"(",
"val",
"&",
"0xff",
")",
";",
"file",
"[",
"pos",
"]",
"=",
"b1",
";",
"file",
"[",
"pos",
"+",
"1",
"]",
"=",
"b2",
";",
"}"
] | Write a USHort at a given position.
@param pos The absolute position to write to
@param val The value to write
@throws IOException If EOF is reached | [
"Write",
"a",
"USHort",
"at",
"a",
"given",
"position",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java#L226-L234 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/base/helper/UiHelper.java | UiHelper.addMousePressedHandlers | public static void addMousePressedHandlers(final Widget widget, final String cssStyleName) {
"""
Adds a mouse pressed handler to a widget. Adds a CSS style to the widget
as long as the mouse is pressed (or the user touches the widget on mobile browser).
@param widget The widget to which the style must be applied for mouse/touch event
@param cssStyleName CSS style name to be applied
"""
widget.sinkEvents(Event.ONMOUSEDOWN);
widget.sinkEvents(Event.ONMOUSEUP);
widget.sinkEvents(Event.ONMOUSEOUT);
widget.sinkEvents(Event.TOUCHEVENTS);
handlerRegistry = new DefaultHandlerRegistry(widget);
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), MouseDownEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseUpEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseOutEvent.getType()));
// Touch Events
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), TouchStartEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchEndEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchCancelEvent.getType()));
} | java | public static void addMousePressedHandlers(final Widget widget, final String cssStyleName) {
widget.sinkEvents(Event.ONMOUSEDOWN);
widget.sinkEvents(Event.ONMOUSEUP);
widget.sinkEvents(Event.ONMOUSEOUT);
widget.sinkEvents(Event.TOUCHEVENTS);
handlerRegistry = new DefaultHandlerRegistry(widget);
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), MouseDownEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseUpEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseOutEvent.getType()));
// Touch Events
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), TouchStartEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchEndEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchCancelEvent.getType()));
} | [
"public",
"static",
"void",
"addMousePressedHandlers",
"(",
"final",
"Widget",
"widget",
",",
"final",
"String",
"cssStyleName",
")",
"{",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
"ONMOUSEDOWN",
")",
";",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
"ONMOUSEUP",
")",
";",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
"ONMOUSEOUT",
")",
";",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
"TOUCHEVENTS",
")",
";",
"handlerRegistry",
"=",
"new",
"DefaultHandlerRegistry",
"(",
"widget",
")",
";",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"addStyleName",
"(",
"cssStyleName",
")",
",",
"MouseDownEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"removeStyleName",
"(",
"cssStyleName",
")",
",",
"MouseUpEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"removeStyleName",
"(",
"cssStyleName",
")",
",",
"MouseOutEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"// Touch Events",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"addStyleName",
"(",
"cssStyleName",
")",
",",
"TouchStartEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"removeStyleName",
"(",
"cssStyleName",
")",
",",
"TouchEndEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"handlerRegistry",
".",
"registerHandler",
"(",
"widget",
".",
"addHandler",
"(",
"event",
"->",
"widget",
".",
"removeStyleName",
"(",
"cssStyleName",
")",
",",
"TouchCancelEvent",
".",
"getType",
"(",
")",
")",
")",
";",
"}"
] | Adds a mouse pressed handler to a widget. Adds a CSS style to the widget
as long as the mouse is pressed (or the user touches the widget on mobile browser).
@param widget The widget to which the style must be applied for mouse/touch event
@param cssStyleName CSS style name to be applied | [
"Adds",
"a",
"mouse",
"pressed",
"handler",
"to",
"a",
"widget",
".",
"Adds",
"a",
"CSS",
"style",
"to",
"the",
"widget",
"as",
"long",
"as",
"the",
"mouse",
"is",
"pressed",
"(",
"or",
"the",
"user",
"touches",
"the",
"widget",
"on",
"mobile",
"browser",
")",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/helper/UiHelper.java#L57-L72 |
HotelsDotCom/corc | corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java | OrcFile.sinkPrepare | @Override
public void sinkPrepare(FlowProcess<? extends Configuration> flowProcess, SinkCall<Corc, OutputCollector> sinkCall)
throws IOException {
"""
Creates an {@link Corc} instance and stores it in the context to be reused for all rows.
"""
sinkCall.setContext(new Corc(typeInfo, converterFactory));
} | java | @Override
public void sinkPrepare(FlowProcess<? extends Configuration> flowProcess, SinkCall<Corc, OutputCollector> sinkCall)
throws IOException {
sinkCall.setContext(new Corc(typeInfo, converterFactory));
} | [
"@",
"Override",
"public",
"void",
"sinkPrepare",
"(",
"FlowProcess",
"<",
"?",
"extends",
"Configuration",
">",
"flowProcess",
",",
"SinkCall",
"<",
"Corc",
",",
"OutputCollector",
">",
"sinkCall",
")",
"throws",
"IOException",
"{",
"sinkCall",
".",
"setContext",
"(",
"new",
"Corc",
"(",
"typeInfo",
",",
"converterFactory",
")",
")",
";",
"}"
] | Creates an {@link Corc} instance and stores it in the context to be reused for all rows. | [
"Creates",
"an",
"{"
] | train | https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java#L206-L210 |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/lang/AnnotationExtensions.java | AnnotationExtensions.getAllClasses | public static Set<Class<?>> getAllClasses(final String packagePath,
final Set<Class<? extends Annotation>> annotationClasses)
throws ClassNotFoundException, IOException, URISyntaxException {
"""
Gets all the classes from the class loader that belongs to the given package path.
@param packagePath
the package path
@param annotationClasses
the annotation classes
@return the all classes
@throws ClassNotFoundException
occurs if a given class cannot be located by the specified class loader
@throws IOException
Signals that an I/O exception has occurred.
@throws URISyntaxException
is thrown if a string could not be parsed as a URI reference.
"""
return getAllAnnotatedClassesFromSet(packagePath, annotationClasses);
} | java | public static Set<Class<?>> getAllClasses(final String packagePath,
final Set<Class<? extends Annotation>> annotationClasses)
throws ClassNotFoundException, IOException, URISyntaxException
{
return getAllAnnotatedClassesFromSet(packagePath, annotationClasses);
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"getAllClasses",
"(",
"final",
"String",
"packagePath",
",",
"final",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"annotationClasses",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
",",
"URISyntaxException",
"{",
"return",
"getAllAnnotatedClassesFromSet",
"(",
"packagePath",
",",
"annotationClasses",
")",
";",
"}"
] | Gets all the classes from the class loader that belongs to the given package path.
@param packagePath
the package path
@param annotationClasses
the annotation classes
@return the all classes
@throws ClassNotFoundException
occurs if a given class cannot be located by the specified class loader
@throws IOException
Signals that an I/O exception has occurred.
@throws URISyntaxException
is thrown if a string could not be parsed as a URI reference. | [
"Gets",
"all",
"the",
"classes",
"from",
"the",
"class",
"loader",
"that",
"belongs",
"to",
"the",
"given",
"package",
"path",
"."
] | train | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/AnnotationExtensions.java#L156-L161 |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.subSequence | public AsciiString subSequence(int start, int end, boolean copy) {
"""
Either copy or share a subset of underlying sub-sequence of bytes.
@param start the offset of the first character (inclusive).
@param end The index to stop at (exclusive).
@param copy If {@code true} then a copy of the underlying storage will be made.
If {@code false} then the underlying storage will be shared.
@return a new string containing the characters from start to the end of the string.
@throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}.
"""
if (isOutOfBounds(start, end - start, length())) {
throw new IndexOutOfBoundsException("expected: 0 <= start(" + start + ") <= end (" + end + ") <= length("
+ length() + ')');
}
if (start == 0 && end == length()) {
return this;
}
if (end == start) {
return EMPTY_STRING;
}
return new AsciiString(value, start + offset, end - start, copy);
} | java | public AsciiString subSequence(int start, int end, boolean copy) {
if (isOutOfBounds(start, end - start, length())) {
throw new IndexOutOfBoundsException("expected: 0 <= start(" + start + ") <= end (" + end + ") <= length("
+ length() + ')');
}
if (start == 0 && end == length()) {
return this;
}
if (end == start) {
return EMPTY_STRING;
}
return new AsciiString(value, start + offset, end - start, copy);
} | [
"public",
"AsciiString",
"subSequence",
"(",
"int",
"start",
",",
"int",
"end",
",",
"boolean",
"copy",
")",
"{",
"if",
"(",
"isOutOfBounds",
"(",
"start",
",",
"end",
"-",
"start",
",",
"length",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"expected: 0 <= start(\"",
"+",
"start",
"+",
"\") <= end (\"",
"+",
"end",
"+",
"\") <= length(\"",
"+",
"length",
"(",
")",
"+",
"'",
"'",
")",
";",
"}",
"if",
"(",
"start",
"==",
"0",
"&&",
"end",
"==",
"length",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"end",
"==",
"start",
")",
"{",
"return",
"EMPTY_STRING",
";",
"}",
"return",
"new",
"AsciiString",
"(",
"value",
",",
"start",
"+",
"offset",
",",
"end",
"-",
"start",
",",
"copy",
")",
";",
"}"
] | Either copy or share a subset of underlying sub-sequence of bytes.
@param start the offset of the first character (inclusive).
@param end The index to stop at (exclusive).
@param copy If {@code true} then a copy of the underlying storage will be made.
If {@code false} then the underlying storage will be shared.
@return a new string containing the characters from start to the end of the string.
@throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. | [
"Either",
"copy",
"or",
"share",
"a",
"subset",
"of",
"underlying",
"sub",
"-",
"sequence",
"of",
"bytes",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L634-L649 |
mkobayas/minimum-marshaller | src/main/java/org/mk300/marshal/minimum/io/NaturalNumberIoHelper.java | NaturalNumberIoHelper.writeNaturalNumber | public static final void writeNaturalNumber(OOutput dos, int naturalNumber) throws IOException {
"""
DataOutputStreamに対して、可変バイト数で自然数の書込みを実施する。<br>
扱う自然数と対応するバイト数は以下のとおり。<br>
<li>0 - 127 -> 1byte</li>
<li>128 - 16383 -> 2byte</li>
<li>16384 - 2097151 -> 3byte</li>
<li>2097152 - 268435455 -> 4byte</li>
<li>268435456 - Integer.MAX_VALUE -> 5byte</li>
@param dos
@param naturalNumber
@throws IOException
"""
if(naturalNumber < 0) {
throw new IOException(naturalNumber + " is not natural number");
}
if( naturalNumber < dv1 ) { // 7bit
int b1 = naturalNumber;
dos.writeByte(b1);
} else if ( naturalNumber < dv2) { // 14bit
int b1 = (naturalNumber / dv1) * -1;
int b2 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
} else if( naturalNumber < dv3) { // 21bit
int b1 = (naturalNumber / dv2) * -1;
int b2 = ((b1*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b3 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
} else if( naturalNumber < dv4) { // 28bit
int b1 = (naturalNumber / dv3) * -1;
int b2 = ((b1*dv3 + naturalNumber) / dv2 + 1) * -1;
int b3 = ((b1*dv3 + (b2 + 1)*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b4 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
dos.writeByte(b4);
} else {
int b1 = (naturalNumber / dv4) * -1;
int b2 = ( (b1*dv4 + naturalNumber) / dv3 + 1) * -1;
int b3 = ( (b1*dv4 + (b2+1)*dv3 + naturalNumber) / dv2 + 1) * -1;
int b4 = ( (b1*dv4 + (b2+1)*dv3 + (b3+1)*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b5 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
dos.writeByte(b4);
dos.writeByte(b5);
}
} | java | public static final void writeNaturalNumber(OOutput dos, int naturalNumber) throws IOException {
if(naturalNumber < 0) {
throw new IOException(naturalNumber + " is not natural number");
}
if( naturalNumber < dv1 ) { // 7bit
int b1 = naturalNumber;
dos.writeByte(b1);
} else if ( naturalNumber < dv2) { // 14bit
int b1 = (naturalNumber / dv1) * -1;
int b2 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
} else if( naturalNumber < dv3) { // 21bit
int b1 = (naturalNumber / dv2) * -1;
int b2 = ((b1*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b3 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
} else if( naturalNumber < dv4) { // 28bit
int b1 = (naturalNumber / dv3) * -1;
int b2 = ((b1*dv3 + naturalNumber) / dv2 + 1) * -1;
int b3 = ((b1*dv3 + (b2 + 1)*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b4 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
dos.writeByte(b4);
} else {
int b1 = (naturalNumber / dv4) * -1;
int b2 = ( (b1*dv4 + naturalNumber) / dv3 + 1) * -1;
int b3 = ( (b1*dv4 + (b2+1)*dv3 + naturalNumber) / dv2 + 1) * -1;
int b4 = ( (b1*dv4 + (b2+1)*dv3 + (b3+1)*dv2 + naturalNumber) / dv1 + 1) * -1 ;
int b5 = (naturalNumber % dv1);
dos.writeByte(b1);
dos.writeByte(b2);
dos.writeByte(b3);
dos.writeByte(b4);
dos.writeByte(b5);
}
} | [
"public",
"static",
"final",
"void",
"writeNaturalNumber",
"(",
"OOutput",
"dos",
",",
"int",
"naturalNumber",
")",
"throws",
"IOException",
"{",
"if",
"(",
"naturalNumber",
"<",
"0",
")",
"{",
"throw",
"new",
"IOException",
"(",
"naturalNumber",
"+",
"\" is not natural number\"",
")",
";",
"}",
"if",
"(",
"naturalNumber",
"<",
"dv1",
")",
"{",
"// 7bit\r",
"int",
"b1",
"=",
"naturalNumber",
";",
"dos",
".",
"writeByte",
"(",
"b1",
")",
";",
"}",
"else",
"if",
"(",
"naturalNumber",
"<",
"dv2",
")",
"{",
"// 14bit\r",
"int",
"b1",
"=",
"(",
"naturalNumber",
"/",
"dv1",
")",
"*",
"-",
"1",
";",
"int",
"b2",
"=",
"(",
"naturalNumber",
"%",
"dv1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b2",
")",
";",
"}",
"else",
"if",
"(",
"naturalNumber",
"<",
"dv3",
")",
"{",
"// 21bit\r",
"int",
"b1",
"=",
"(",
"naturalNumber",
"/",
"dv2",
")",
"*",
"-",
"1",
";",
"int",
"b2",
"=",
"(",
"(",
"b1",
"*",
"dv2",
"+",
"naturalNumber",
")",
"/",
"dv1",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b3",
"=",
"(",
"naturalNumber",
"%",
"dv1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b2",
")",
";",
"dos",
".",
"writeByte",
"(",
"b3",
")",
";",
"}",
"else",
"if",
"(",
"naturalNumber",
"<",
"dv4",
")",
"{",
"// 28bit\r",
"int",
"b1",
"=",
"(",
"naturalNumber",
"/",
"dv3",
")",
"*",
"-",
"1",
";",
"int",
"b2",
"=",
"(",
"(",
"b1",
"*",
"dv3",
"+",
"naturalNumber",
")",
"/",
"dv2",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b3",
"=",
"(",
"(",
"b1",
"*",
"dv3",
"+",
"(",
"b2",
"+",
"1",
")",
"*",
"dv2",
"+",
"naturalNumber",
")",
"/",
"dv1",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b4",
"=",
"(",
"naturalNumber",
"%",
"dv1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b2",
")",
";",
"dos",
".",
"writeByte",
"(",
"b3",
")",
";",
"dos",
".",
"writeByte",
"(",
"b4",
")",
";",
"}",
"else",
"{",
"int",
"b1",
"=",
"(",
"naturalNumber",
"/",
"dv4",
")",
"*",
"-",
"1",
";",
"int",
"b2",
"=",
"(",
"(",
"b1",
"*",
"dv4",
"+",
"naturalNumber",
")",
"/",
"dv3",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b3",
"=",
"(",
"(",
"b1",
"*",
"dv4",
"+",
"(",
"b2",
"+",
"1",
")",
"*",
"dv3",
"+",
"naturalNumber",
")",
"/",
"dv2",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b4",
"=",
"(",
"(",
"b1",
"*",
"dv4",
"+",
"(",
"b2",
"+",
"1",
")",
"*",
"dv3",
"+",
"(",
"b3",
"+",
"1",
")",
"*",
"dv2",
"+",
"naturalNumber",
")",
"/",
"dv1",
"+",
"1",
")",
"*",
"-",
"1",
";",
"int",
"b5",
"=",
"(",
"naturalNumber",
"%",
"dv1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b1",
")",
";",
"dos",
".",
"writeByte",
"(",
"b2",
")",
";",
"dos",
".",
"writeByte",
"(",
"b3",
")",
";",
"dos",
".",
"writeByte",
"(",
"b4",
")",
";",
"dos",
".",
"writeByte",
"(",
"b5",
")",
";",
"}",
"}"
] | DataOutputStreamに対して、可変バイト数で自然数の書込みを実施する。<br>
扱う自然数と対応するバイト数は以下のとおり。<br>
<li>0 - 127 -> 1byte</li>
<li>128 - 16383 -> 2byte</li>
<li>16384 - 2097151 -> 3byte</li>
<li>2097152 - 268435455 -> 4byte</li>
<li>268435456 - Integer.MAX_VALUE -> 5byte</li>
@param dos
@param naturalNumber
@throws IOException | [
"DataOutputStreamに対して、可変バイト数で自然数の書込みを実施する。<br",
">",
"扱う自然数と対応するバイト数は以下のとおり。<br",
">",
"<li",
">",
"0",
"-",
"127",
"-",
">",
"1byte<",
"/",
"li",
">",
"<li",
">",
"128",
"-",
"16383",
"-",
">",
"2byte<",
"/",
"li",
">",
"<li",
">",
"16384",
"-",
"2097151",
"-",
">",
"3byte<",
"/",
"li",
">",
"<li",
">",
"2097152",
"-",
"268435455",
"-",
">",
"4byte<",
"/",
"li",
">",
"<li",
">",
"268435456",
"-",
"Integer",
".",
"MAX_VALUE",
"-",
">",
"5byte<",
"/",
"li",
">"
] | train | https://github.com/mkobayas/minimum-marshaller/blob/3a8d86decd7c02ef756522336f4483e6f53574d1/src/main/java/org/mk300/marshal/minimum/io/NaturalNumberIoHelper.java#L52-L97 |
groovy/groovy-core | src/main/groovy/lang/MetaBeanProperty.java | MetaBeanProperty.setProperty | public void setProperty(Object object, Object newValue) {
"""
Set the property on the given object to the new value.
@param object on which to set the property
@param newValue the new value of the property
@throws RuntimeException if the property could not be set
"""
MetaMethod setter = getSetter();
if (setter == null) {
if (field != null && !Modifier.isFinal(field.getModifiers())) {
field.setProperty(object, newValue);
return;
}
throw new GroovyRuntimeException("Cannot set read-only property: " + name);
}
newValue = DefaultTypeTransformation.castToType(newValue, getType());
setter.invoke(object, new Object[]{newValue});
} | java | public void setProperty(Object object, Object newValue) {
MetaMethod setter = getSetter();
if (setter == null) {
if (field != null && !Modifier.isFinal(field.getModifiers())) {
field.setProperty(object, newValue);
return;
}
throw new GroovyRuntimeException("Cannot set read-only property: " + name);
}
newValue = DefaultTypeTransformation.castToType(newValue, getType());
setter.invoke(object, new Object[]{newValue});
} | [
"public",
"void",
"setProperty",
"(",
"Object",
"object",
",",
"Object",
"newValue",
")",
"{",
"MetaMethod",
"setter",
"=",
"getSetter",
"(",
")",
";",
"if",
"(",
"setter",
"==",
"null",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
"&&",
"!",
"Modifier",
".",
"isFinal",
"(",
"field",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"field",
".",
"setProperty",
"(",
"object",
",",
"newValue",
")",
";",
"return",
";",
"}",
"throw",
"new",
"GroovyRuntimeException",
"(",
"\"Cannot set read-only property: \"",
"+",
"name",
")",
";",
"}",
"newValue",
"=",
"DefaultTypeTransformation",
".",
"castToType",
"(",
"newValue",
",",
"getType",
"(",
")",
")",
";",
"setter",
".",
"invoke",
"(",
"object",
",",
"new",
"Object",
"[",
"]",
"{",
"newValue",
"}",
")",
";",
"}"
] | Set the property on the given object to the new value.
@param object on which to set the property
@param newValue the new value of the property
@throws RuntimeException if the property could not be set | [
"Set",
"the",
"property",
"on",
"the",
"given",
"object",
"to",
"the",
"new",
"value",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaBeanProperty.java#L73-L84 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/StringUtility.java | StringUtility.compareToDDMMYYYY | public static int compareToDDMMYYYY(String date1, String date2) {
"""
Compare one date to another, must be in the DDMMYYYY format.
@return <0 if the first date is before the second<br>
0 if the dates are the same or the format is invalid<br>
>0 if the first date is after the second
"""
if(date1.length()!=8 || date2.length()!=8) return 0;
return compareToDDMMYYYY0(date1)-compareToDDMMYYYY0(date2);
} | java | public static int compareToDDMMYYYY(String date1, String date2) {
if(date1.length()!=8 || date2.length()!=8) return 0;
return compareToDDMMYYYY0(date1)-compareToDDMMYYYY0(date2);
} | [
"public",
"static",
"int",
"compareToDDMMYYYY",
"(",
"String",
"date1",
",",
"String",
"date2",
")",
"{",
"if",
"(",
"date1",
".",
"length",
"(",
")",
"!=",
"8",
"||",
"date2",
".",
"length",
"(",
")",
"!=",
"8",
")",
"return",
"0",
";",
"return",
"compareToDDMMYYYY0",
"(",
"date1",
")",
"-",
"compareToDDMMYYYY0",
"(",
"date2",
")",
";",
"}"
] | Compare one date to another, must be in the DDMMYYYY format.
@return <0 if the first date is before the second<br>
0 if the dates are the same or the format is invalid<br>
>0 if the first date is after the second | [
"Compare",
"one",
"date",
"to",
"another",
"must",
"be",
"in",
"the",
"DDMMYYYY",
"format",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L230-L233 |
haifengl/smile | graph/src/main/java/smile/graph/AdjacencyList.java | AdjacencyList.dfs | private void dfs(int v, int[] cc, int id) {
"""
Depth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id.
"""
cc[v] = id;
for (Edge edge : graph[v]) {
int t = edge.v2;
if (!digraph && t == v) {
t = edge.v1;
}
if (cc[t] == -1) {
dfs(t, cc, id);
}
}
} | java | private void dfs(int v, int[] cc, int id) {
cc[v] = id;
for (Edge edge : graph[v]) {
int t = edge.v2;
if (!digraph && t == v) {
t = edge.v1;
}
if (cc[t] == -1) {
dfs(t, cc, id);
}
}
} | [
"private",
"void",
"dfs",
"(",
"int",
"v",
",",
"int",
"[",
"]",
"cc",
",",
"int",
"id",
")",
"{",
"cc",
"[",
"v",
"]",
"=",
"id",
";",
"for",
"(",
"Edge",
"edge",
":",
"graph",
"[",
"v",
"]",
")",
"{",
"int",
"t",
"=",
"edge",
".",
"v2",
";",
"if",
"(",
"!",
"digraph",
"&&",
"t",
"==",
"v",
")",
"{",
"t",
"=",
"edge",
".",
"v1",
";",
"}",
"if",
"(",
"cc",
"[",
"t",
"]",
"==",
"-",
"1",
")",
"{",
"dfs",
"(",
"t",
",",
"cc",
",",
"id",
")",
";",
"}",
"}",
"}"
] | Depth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id. | [
"Depth",
"-",
"first",
"search",
"connected",
"components",
"of",
"graph",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyList.java#L353-L365 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryApi.java | RepositoryApi.getRepositoryArchive | public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, String format) throws GitLabApiException {
"""
Get an archive of the complete repository by SHA (optional).
<pre><code>GitLab Endpoint: GET /projects/:id/repository/archive</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha the SHA of the archive to get
@param format The archive format, defaults to "tar.gz" if null
@return an input stream that can be used to save as a file or to read the content of the archive
@throws GitLabApiException if format is not a valid archive format or any exception occurs
"""
ArchiveFormat archiveFormat = ArchiveFormat.forValue(format);
return (getRepositoryArchive(projectIdOrPath, sha, archiveFormat));
} | java | public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, String format) throws GitLabApiException {
ArchiveFormat archiveFormat = ArchiveFormat.forValue(format);
return (getRepositoryArchive(projectIdOrPath, sha, archiveFormat));
} | [
"public",
"InputStream",
"getRepositoryArchive",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"sha",
",",
"String",
"format",
")",
"throws",
"GitLabApiException",
"{",
"ArchiveFormat",
"archiveFormat",
"=",
"ArchiveFormat",
".",
"forValue",
"(",
"format",
")",
";",
"return",
"(",
"getRepositoryArchive",
"(",
"projectIdOrPath",
",",
"sha",
",",
"archiveFormat",
")",
")",
";",
"}"
] | Get an archive of the complete repository by SHA (optional).
<pre><code>GitLab Endpoint: GET /projects/:id/repository/archive</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha the SHA of the archive to get
@param format The archive format, defaults to "tar.gz" if null
@return an input stream that can be used to save as a file or to read the content of the archive
@throws GitLabApiException if format is not a valid archive format or any exception occurs | [
"Get",
"an",
"archive",
"of",
"the",
"complete",
"repository",
"by",
"SHA",
"(",
"optional",
")",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L537-L540 |
bushidowallet/bushido-java-service | bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java | HexUtils.toHex | public static String toHex(byte[] bytes, int offset, int length, String separator) {
"""
Encodes an array of bytes as hex symbols.
@param bytes
the array of bytes to encode
@param offset
the start offset in the array of bytes
@param length
the number of bytes to encode
@param separator
the separator to use between two bytes, can be null
@return the resulting hex string
"""
StringBuffer result = new StringBuffer();
for (int i = 0; i < length; i++) {
int unsignedByte = bytes[i + offset] & 0xff;
if (unsignedByte < 16) {
result.append("0");
}
result.append(Integer.toHexString(unsignedByte));
if (separator != null && i + 1 < length) {
result.append(separator);
}
}
return result.toString();
} | java | public static String toHex(byte[] bytes, int offset, int length, String separator) {
StringBuffer result = new StringBuffer();
for (int i = 0; i < length; i++) {
int unsignedByte = bytes[i + offset] & 0xff;
if (unsignedByte < 16) {
result.append("0");
}
result.append(Integer.toHexString(unsignedByte));
if (separator != null && i + 1 < length) {
result.append(separator);
}
}
return result.toString();
} | [
"public",
"static",
"String",
"toHex",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"length",
",",
"String",
"separator",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"int",
"unsignedByte",
"=",
"bytes",
"[",
"i",
"+",
"offset",
"]",
"&",
"0xff",
";",
"if",
"(",
"unsignedByte",
"<",
"16",
")",
"{",
"result",
".",
"append",
"(",
"\"0\"",
")",
";",
"}",
"result",
".",
"append",
"(",
"Integer",
".",
"toHexString",
"(",
"unsignedByte",
")",
")",
";",
"if",
"(",
"separator",
"!=",
"null",
"&&",
"i",
"+",
"1",
"<",
"length",
")",
"{",
"result",
".",
"append",
"(",
"separator",
")",
";",
"}",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Encodes an array of bytes as hex symbols.
@param bytes
the array of bytes to encode
@param offset
the start offset in the array of bytes
@param length
the number of bytes to encode
@param separator
the separator to use between two bytes, can be null
@return the resulting hex string | [
"Encodes",
"an",
"array",
"of",
"bytes",
"as",
"hex",
"symbols",
"."
] | train | https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java#L88-L103 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java | CacheMapUtil.batchRemove | @SuppressWarnings("unused")
public static Completable batchRemove(Map<String, List<String>> batchRemoves) {
"""
batch remove the elements in the cached map
@param batchRemoves Map(key, fields) the sub map you want to remvoe
"""
return batchRemove(CacheService.CACHE_CONFIG_BEAN, batchRemoves);
} | java | @SuppressWarnings("unused")
public static Completable batchRemove(Map<String, List<String>> batchRemoves) {
return batchRemove(CacheService.CACHE_CONFIG_BEAN, batchRemoves);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"Completable",
"batchRemove",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"batchRemoves",
")",
"{",
"return",
"batchRemove",
"(",
"CacheService",
".",
"CACHE_CONFIG_BEAN",
",",
"batchRemoves",
")",
";",
"}"
] | batch remove the elements in the cached map
@param batchRemoves Map(key, fields) the sub map you want to remvoe | [
"batch",
"remove",
"the",
"elements",
"in",
"the",
"cached",
"map"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java#L242-L245 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java | SQLMergeClause.addFlag | public SQLMergeClause addFlag(Position position, Expression<?> flag) {
"""
Add the given Expression at the given position as a query flag
@param position position
@param flag query flag
@return the current object
"""
metadata.addFlag(new QueryFlag(position, flag));
return this;
} | java | public SQLMergeClause addFlag(Position position, Expression<?> flag) {
metadata.addFlag(new QueryFlag(position, flag));
return this;
} | [
"public",
"SQLMergeClause",
"addFlag",
"(",
"Position",
"position",
",",
"Expression",
"<",
"?",
">",
"flag",
")",
"{",
"metadata",
".",
"addFlag",
"(",
"new",
"QueryFlag",
"(",
"position",
",",
"flag",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the given Expression at the given position as a query flag
@param position position
@param flag query flag
@return the current object | [
"Add",
"the",
"given",
"Expression",
"at",
"the",
"given",
"position",
"as",
"a",
"query",
"flag"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java#L100-L103 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBAssert.java | DBAssert.stateAssertion | static void stateAssertion(CallInfo callInfo, DataSet expected) {
"""
Perform a database state assertion.
@param callInfo Call info.
@param expected Expected data.
@throws DBAssertionError If the assertion fails.
@throws InvalidOperationException If the arguments are invalid.
"""
DataSource source = expected.getSource();
source.setDirtyStatus(true);
dataSetAssertion(callInfo,
expected,
source.executeQuery(callInfo, false));
} | java | static void stateAssertion(CallInfo callInfo, DataSet expected) {
DataSource source = expected.getSource();
source.setDirtyStatus(true);
dataSetAssertion(callInfo,
expected,
source.executeQuery(callInfo, false));
} | [
"static",
"void",
"stateAssertion",
"(",
"CallInfo",
"callInfo",
",",
"DataSet",
"expected",
")",
"{",
"DataSource",
"source",
"=",
"expected",
".",
"getSource",
"(",
")",
";",
"source",
".",
"setDirtyStatus",
"(",
"true",
")",
";",
"dataSetAssertion",
"(",
"callInfo",
",",
"expected",
",",
"source",
".",
"executeQuery",
"(",
"callInfo",
",",
"false",
")",
")",
";",
"}"
] | Perform a database state assertion.
@param callInfo Call info.
@param expected Expected data.
@throws DBAssertionError If the assertion fails.
@throws InvalidOperationException If the arguments are invalid. | [
"Perform",
"a",
"database",
"state",
"assertion",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBAssert.java#L96-L102 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/UrlEncodedContent.java | UrlEncodedContent.getContent | public static UrlEncodedContent getContent(HttpRequest request) {
"""
Returns the URL-encoded content of the given HTTP request, or if none return and set as content
a new instance of {@link UrlEncodedContent} (whose {@link #getData()} is an implementation of
{@link Map}).
@param request HTTP request
@return URL-encoded content
@throws ClassCastException if the HTTP request has a content defined that is not {@link
UrlEncodedContent}
@since 1.7
"""
HttpContent content = request.getContent();
if (content != null) {
return (UrlEncodedContent) content;
}
UrlEncodedContent result = new UrlEncodedContent(new HashMap<String, Object>());
request.setContent(result);
return result;
} | java | public static UrlEncodedContent getContent(HttpRequest request) {
HttpContent content = request.getContent();
if (content != null) {
return (UrlEncodedContent) content;
}
UrlEncodedContent result = new UrlEncodedContent(new HashMap<String, Object>());
request.setContent(result);
return result;
} | [
"public",
"static",
"UrlEncodedContent",
"getContent",
"(",
"HttpRequest",
"request",
")",
"{",
"HttpContent",
"content",
"=",
"request",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"content",
"!=",
"null",
")",
"{",
"return",
"(",
"UrlEncodedContent",
")",
"content",
";",
"}",
"UrlEncodedContent",
"result",
"=",
"new",
"UrlEncodedContent",
"(",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
")",
";",
"request",
".",
"setContent",
"(",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Returns the URL-encoded content of the given HTTP request, or if none return and set as content
a new instance of {@link UrlEncodedContent} (whose {@link #getData()} is an implementation of
{@link Map}).
@param request HTTP request
@return URL-encoded content
@throws ClassCastException if the HTTP request has a content defined that is not {@link
UrlEncodedContent}
@since 1.7 | [
"Returns",
"the",
"URL",
"-",
"encoded",
"content",
"of",
"the",
"given",
"HTTP",
"request",
"or",
"if",
"none",
"return",
"and",
"set",
"as",
"content",
"a",
"new",
"instance",
"of",
"{",
"@link",
"UrlEncodedContent",
"}",
"(",
"whose",
"{",
"@link",
"#getData",
"()",
"}",
"is",
"an",
"implementation",
"of",
"{",
"@link",
"Map",
"}",
")",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/UrlEncodedContent.java#L118-L126 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/TenantServiceClient.java | TenantServiceClient.createTenant | public final Tenant createTenant(String parent, Tenant tenant) {
"""
Creates a new tenant entity.
<p>Sample code:
<pre><code>
try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Tenant tenant = Tenant.newBuilder().build();
Tenant response = tenantServiceClient.createTenant(parent.toString(), tenant);
}
</code></pre>
@param parent Required.
<p>Resource name of the project under which the tenant is created.
<p>The format is "projects/{project_id}", for example, "projects/api-test-project".
@param tenant Required.
<p>The tenant to be created.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
CreateTenantRequest request =
CreateTenantRequest.newBuilder().setParent(parent).setTenant(tenant).build();
return createTenant(request);
} | java | public final Tenant createTenant(String parent, Tenant tenant) {
CreateTenantRequest request =
CreateTenantRequest.newBuilder().setParent(parent).setTenant(tenant).build();
return createTenant(request);
} | [
"public",
"final",
"Tenant",
"createTenant",
"(",
"String",
"parent",
",",
"Tenant",
"tenant",
")",
"{",
"CreateTenantRequest",
"request",
"=",
"CreateTenantRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setTenant",
"(",
"tenant",
")",
".",
"build",
"(",
")",
";",
"return",
"createTenant",
"(",
"request",
")",
";",
"}"
] | Creates a new tenant entity.
<p>Sample code:
<pre><code>
try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Tenant tenant = Tenant.newBuilder().build();
Tenant response = tenantServiceClient.createTenant(parent.toString(), tenant);
}
</code></pre>
@param parent Required.
<p>Resource name of the project under which the tenant is created.
<p>The format is "projects/{project_id}", for example, "projects/api-test-project".
@param tenant Required.
<p>The tenant to be created.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"new",
"tenant",
"entity",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/TenantServiceClient.java#L210-L215 |
tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java | WaitStateUtilities.waitForState | public static void waitForState(final DeviceProxy proxy, final DevState waitState, final long timeout)
throws DevFailed, TimeoutException {
"""
Wait for waitState
@param proxy
the proxy on which to monitor the state
@param waitState
the state to wait
@param timeout
a timeout in ms
@throws DevFailed
@throws TimeoutException
"""
waitForState(proxy, waitState, timeout, 300);
} | java | public static void waitForState(final DeviceProxy proxy, final DevState waitState, final long timeout)
throws DevFailed, TimeoutException {
waitForState(proxy, waitState, timeout, 300);
} | [
"public",
"static",
"void",
"waitForState",
"(",
"final",
"DeviceProxy",
"proxy",
",",
"final",
"DevState",
"waitState",
",",
"final",
"long",
"timeout",
")",
"throws",
"DevFailed",
",",
"TimeoutException",
"{",
"waitForState",
"(",
"proxy",
",",
"waitState",
",",
"timeout",
",",
"300",
")",
";",
"}"
] | Wait for waitState
@param proxy
the proxy on which to monitor the state
@param waitState
the state to wait
@param timeout
a timeout in ms
@throws DevFailed
@throws TimeoutException | [
"Wait",
"for",
"waitState"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java#L81-L84 |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java | CitrusBackend.getObjectFactory | private ObjectFactory getObjectFactory() throws IllegalAccessException {
"""
Gets the object factory instance that is configured in environment.
@return
"""
if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusObjectFactory.class.getName())) {
return CitrusObjectFactory.instance();
} else if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusSpringObjectFactory.class.getName())) {
return CitrusSpringObjectFactory.instance();
}
return ObjectFactoryLoader.loadObjectFactory(new ResourceLoaderClassFinder(resourceLoader, Thread.currentThread().getContextClassLoader()),
Env.INSTANCE.get(ObjectFactory.class.getName()));
} | java | private ObjectFactory getObjectFactory() throws IllegalAccessException {
if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusObjectFactory.class.getName())) {
return CitrusObjectFactory.instance();
} else if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusSpringObjectFactory.class.getName())) {
return CitrusSpringObjectFactory.instance();
}
return ObjectFactoryLoader.loadObjectFactory(new ResourceLoaderClassFinder(resourceLoader, Thread.currentThread().getContextClassLoader()),
Env.INSTANCE.get(ObjectFactory.class.getName()));
} | [
"private",
"ObjectFactory",
"getObjectFactory",
"(",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"Env",
".",
"INSTANCE",
".",
"get",
"(",
"ObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"equals",
"(",
"CitrusObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"CitrusObjectFactory",
".",
"instance",
"(",
")",
";",
"}",
"else",
"if",
"(",
"Env",
".",
"INSTANCE",
".",
"get",
"(",
"ObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"equals",
"(",
"CitrusSpringObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"CitrusSpringObjectFactory",
".",
"instance",
"(",
")",
";",
"}",
"return",
"ObjectFactoryLoader",
".",
"loadObjectFactory",
"(",
"new",
"ResourceLoaderClassFinder",
"(",
"resourceLoader",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
")",
",",
"Env",
".",
"INSTANCE",
".",
"get",
"(",
"ObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
";",
"}"
] | Gets the object factory instance that is configured in environment.
@return | [
"Gets",
"the",
"object",
"factory",
"instance",
"that",
"is",
"configured",
"in",
"environment",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java#L111-L120 |
threerings/nenya | core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java | FadableImageSprite.moveAndFadeInAndOut | public void moveAndFadeInAndOut (Path path, long pathDuration, float fadePortion) {
"""
Puts this sprite on the specified path, fading it in over the specified duration at the
beginning and fading it out at the end.
@param path the path to move along
@param pathDuration the duration of the path
@param fadePortion the portion of time to spend fading in/out, from 0.0f (no time) to 1.0f
(the entire time)
"""
move(path);
setAlpha(0.0f);
_pathDuration = pathDuration;
_fadeInDuration = _fadeOutDuration = (long)(pathDuration * fadePortion);
} | java | public void moveAndFadeInAndOut (Path path, long pathDuration, float fadePortion)
{
move(path);
setAlpha(0.0f);
_pathDuration = pathDuration;
_fadeInDuration = _fadeOutDuration = (long)(pathDuration * fadePortion);
} | [
"public",
"void",
"moveAndFadeInAndOut",
"(",
"Path",
"path",
",",
"long",
"pathDuration",
",",
"float",
"fadePortion",
")",
"{",
"move",
"(",
"path",
")",
";",
"setAlpha",
"(",
"0.0f",
")",
";",
"_pathDuration",
"=",
"pathDuration",
";",
"_fadeInDuration",
"=",
"_fadeOutDuration",
"=",
"(",
"long",
")",
"(",
"pathDuration",
"*",
"fadePortion",
")",
";",
"}"
] | Puts this sprite on the specified path, fading it in over the specified duration at the
beginning and fading it out at the end.
@param path the path to move along
@param pathDuration the duration of the path
@param fadePortion the portion of time to spend fading in/out, from 0.0f (no time) to 1.0f
(the entire time) | [
"Puts",
"this",
"sprite",
"on",
"the",
"specified",
"path",
"fading",
"it",
"in",
"over",
"the",
"specified",
"duration",
"at",
"the",
"beginning",
"and",
"fading",
"it",
"out",
"at",
"the",
"end",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java#L127-L135 |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java | ConsumerContainer.addConsumer | public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) {
"""
Adds a consumer to the container and configures it according to the consumer
configuration. Does NOT enable the consumer to consume from the message broker until the container is started.
<p>Registers the same consumer N times at the queue according to the number of specified instances.
Use this for scaling your consumers locally. Be aware that the consumer implementation must
be stateless or thread safe.</p>
@param consumer The consumer
@param configuration The consumer configuration
@param instances the amount of consumer instances
"""
for (int i=0; i < instances; i++) {
this.consumerHolders.add(new ConsumerHolder(consumer, configuration));
}
} | java | public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) {
for (int i=0; i < instances; i++) {
this.consumerHolders.add(new ConsumerHolder(consumer, configuration));
}
} | [
"public",
"synchronized",
"void",
"addConsumer",
"(",
"Consumer",
"consumer",
",",
"ConsumerConfiguration",
"configuration",
",",
"int",
"instances",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"instances",
";",
"i",
"++",
")",
"{",
"this",
".",
"consumerHolders",
".",
"add",
"(",
"new",
"ConsumerHolder",
"(",
"consumer",
",",
"configuration",
")",
")",
";",
"}",
"}"
] | Adds a consumer to the container and configures it according to the consumer
configuration. Does NOT enable the consumer to consume from the message broker until the container is started.
<p>Registers the same consumer N times at the queue according to the number of specified instances.
Use this for scaling your consumers locally. Be aware that the consumer implementation must
be stateless or thread safe.</p>
@param consumer The consumer
@param configuration The consumer configuration
@param instances the amount of consumer instances | [
"Adds",
"a",
"consumer",
"to",
"the",
"container",
"and",
"configures",
"it",
"according",
"to",
"the",
"consumer",
"configuration",
".",
"Does",
"NOT",
"enable",
"the",
"consumer",
"to",
"consume",
"from",
"the",
"message",
"broker",
"until",
"the",
"container",
"is",
"started",
"."
] | train | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java#L155-L159 |
apache/incubator-gobblin | gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java | HivePurgerSource.getWatermarkFromPreviousWorkUnits | protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) {
"""
Fetches the value of a watermark given its key from the previous run.
"""
if (state.getPreviousWorkUnitStates().isEmpty()) {
return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK;
}
return state.getPreviousWorkUnitStates().get(0)
.getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK);
} | java | protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) {
if (state.getPreviousWorkUnitStates().isEmpty()) {
return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK;
}
return state.getPreviousWorkUnitStates().get(0)
.getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK);
} | [
"protected",
"static",
"String",
"getWatermarkFromPreviousWorkUnits",
"(",
"SourceState",
"state",
",",
"String",
"watermark",
")",
"{",
"if",
"(",
"state",
".",
"getPreviousWorkUnitStates",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"ComplianceConfigurationKeys",
".",
"NO_PREVIOUS_WATERMARK",
";",
"}",
"return",
"state",
".",
"getPreviousWorkUnitStates",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getProp",
"(",
"watermark",
",",
"ComplianceConfigurationKeys",
".",
"NO_PREVIOUS_WATERMARK",
")",
";",
"}"
] | Fetches the value of a watermark given its key from the previous run. | [
"Fetches",
"the",
"value",
"of",
"a",
"watermark",
"given",
"its",
"key",
"from",
"the",
"previous",
"run",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java#L335-L341 |
spotbugs/spotbugs | eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateRemainderOddnessCheckResolution.java | CreateRemainderOddnessCheckResolution.createCorrectOddnessCheck | @Override
protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
"""
Creates the new <CODE>InfixExpression</CODE> <CODE>x % 2 != 0</CODE>
"""
Assert.isNotNull(rewrite);
Assert.isNotNull(numberExpression);
final AST ast = rewrite.getAST();
InfixExpression correctOddnessCheck = ast.newInfixExpression();
InfixExpression remainderExp = ast.newInfixExpression();
correctOddnessCheck.setLeftOperand(remainderExp);
correctOddnessCheck.setOperator(NOT_EQUALS);
correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));
remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
remainderExp.setOperator(REMAINDER);
remainderExp.setRightOperand(ast.newNumberLiteral("2"));
return correctOddnessCheck;
} | java | @Override
protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
Assert.isNotNull(rewrite);
Assert.isNotNull(numberExpression);
final AST ast = rewrite.getAST();
InfixExpression correctOddnessCheck = ast.newInfixExpression();
InfixExpression remainderExp = ast.newInfixExpression();
correctOddnessCheck.setLeftOperand(remainderExp);
correctOddnessCheck.setOperator(NOT_EQUALS);
correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));
remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
remainderExp.setOperator(REMAINDER);
remainderExp.setRightOperand(ast.newNumberLiteral("2"));
return correctOddnessCheck;
} | [
"@",
"Override",
"protected",
"InfixExpression",
"createCorrectOddnessCheck",
"(",
"ASTRewrite",
"rewrite",
",",
"Expression",
"numberExpression",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"rewrite",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"numberExpression",
")",
";",
"final",
"AST",
"ast",
"=",
"rewrite",
".",
"getAST",
"(",
")",
";",
"InfixExpression",
"correctOddnessCheck",
"=",
"ast",
".",
"newInfixExpression",
"(",
")",
";",
"InfixExpression",
"remainderExp",
"=",
"ast",
".",
"newInfixExpression",
"(",
")",
";",
"correctOddnessCheck",
".",
"setLeftOperand",
"(",
"remainderExp",
")",
";",
"correctOddnessCheck",
".",
"setOperator",
"(",
"NOT_EQUALS",
")",
";",
"correctOddnessCheck",
".",
"setRightOperand",
"(",
"ast",
".",
"newNumberLiteral",
"(",
"\"0\"",
")",
")",
";",
"remainderExp",
".",
"setLeftOperand",
"(",
"(",
"Expression",
")",
"rewrite",
".",
"createMoveTarget",
"(",
"numberExpression",
")",
")",
";",
"remainderExp",
".",
"setOperator",
"(",
"REMAINDER",
")",
";",
"remainderExp",
".",
"setRightOperand",
"(",
"ast",
".",
"newNumberLiteral",
"(",
"\"2\"",
")",
")",
";",
"return",
"correctOddnessCheck",
";",
"}"
] | Creates the new <CODE>InfixExpression</CODE> <CODE>x % 2 != 0</CODE> | [
"Creates",
"the",
"new",
"<CODE",
">",
"InfixExpression<",
"/",
"CODE",
">",
"<CODE",
">",
"x",
"%",
"2",
"!",
"=",
"0<",
"/",
"CODE",
">"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateRemainderOddnessCheckResolution.java#L49-L67 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationHeaderHelper.java | AuthorizationHeaderHelper.isAuthorizationRequired | private static boolean isAuthorizationRequired(int statusCode, List<String> wwwAuthenticateHeaders) {
"""
Check if the params came from response that requires authorization
@param statusCode status code of the responce
@param wwwAuthenticateHeaders list of WWW-Authenticate headers
@return true if status is 401 or 403 and The value of the header starts with 'Bearer' and that it contains ""imfAuthentication""
"""
if (statusCode == 401 || statusCode == 403) {
//It is possible that there will be more then one header for this header-name. This is why we need the loop here.
for (String header : wwwAuthenticateHeaders) {
if (header.toLowerCase().startsWith(BEARER.toLowerCase()) && header.toLowerCase().contains(AUTH_REALM.toLowerCase())) {
return true;
}
}
}
return false;
} | java | private static boolean isAuthorizationRequired(int statusCode, List<String> wwwAuthenticateHeaders) {
if (statusCode == 401 || statusCode == 403) {
//It is possible that there will be more then one header for this header-name. This is why we need the loop here.
for (String header : wwwAuthenticateHeaders) {
if (header.toLowerCase().startsWith(BEARER.toLowerCase()) && header.toLowerCase().contains(AUTH_REALM.toLowerCase())) {
return true;
}
}
}
return false;
} | [
"private",
"static",
"boolean",
"isAuthorizationRequired",
"(",
"int",
"statusCode",
",",
"List",
"<",
"String",
">",
"wwwAuthenticateHeaders",
")",
"{",
"if",
"(",
"statusCode",
"==",
"401",
"||",
"statusCode",
"==",
"403",
")",
"{",
"//It is possible that there will be more then one header for this header-name. This is why we need the loop here.",
"for",
"(",
"String",
"header",
":",
"wwwAuthenticateHeaders",
")",
"{",
"if",
"(",
"header",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"BEARER",
".",
"toLowerCase",
"(",
")",
")",
"&&",
"header",
".",
"toLowerCase",
"(",
")",
".",
"contains",
"(",
"AUTH_REALM",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Check if the params came from response that requires authorization
@param statusCode status code of the responce
@param wwwAuthenticateHeaders list of WWW-Authenticate headers
@return true if status is 401 or 403 and The value of the header starts with 'Bearer' and that it contains ""imfAuthentication"" | [
"Check",
"if",
"the",
"params",
"came",
"from",
"response",
"that",
"requires",
"authorization"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationHeaderHelper.java#L72-L85 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java | AbstractServerDetector.getAttributeValue | protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,String pMBean,String pAttribute) {
"""
Get the string representation of an attribute
@param pMBeanServerExecutor set of MBeanServers to query. The first one wins.
@param pMBean object name of MBean to lookup
@param pAttribute attribute to lookup
@return string value of attribute or <code>null</code> if the attribute could not be fetched
"""
try {
ObjectName oName = new ObjectName(pMBean);
return getAttributeValue(pMBeanServerExecutor,oName,pAttribute);
} catch (MalformedObjectNameException e) {
return null;
}
} | java | protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,String pMBean,String pAttribute) {
try {
ObjectName oName = new ObjectName(pMBean);
return getAttributeValue(pMBeanServerExecutor,oName,pAttribute);
} catch (MalformedObjectNameException e) {
return null;
}
} | [
"protected",
"String",
"getAttributeValue",
"(",
"MBeanServerExecutor",
"pMBeanServerExecutor",
",",
"String",
"pMBean",
",",
"String",
"pAttribute",
")",
"{",
"try",
"{",
"ObjectName",
"oName",
"=",
"new",
"ObjectName",
"(",
"pMBean",
")",
";",
"return",
"getAttributeValue",
"(",
"pMBeanServerExecutor",
",",
"oName",
",",
"pAttribute",
")",
";",
"}",
"catch",
"(",
"MalformedObjectNameException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Get the string representation of an attribute
@param pMBeanServerExecutor set of MBeanServers to query. The first one wins.
@param pMBean object name of MBean to lookup
@param pAttribute attribute to lookup
@return string value of attribute or <code>null</code> if the attribute could not be fetched | [
"Get",
"the",
"string",
"representation",
"of",
"an",
"attribute"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L74-L81 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java | PutCommand.updateContent | private void updateContent(Node node, InputStream inputStream, List<String> mixins) throws RepositoryException {
"""
Updates jcr:content node.
@param node parent node
@param inputStream inputStream input stream that contains the content of
file
@param mixins list of mixins
@throws RepositoryException {@link RepositoryException}
"""
Node content = node.getNode("jcr:content");
if (mimeTypeRecognizer.isMimeTypeRecognized() || !content.hasProperty("jcr:mimeType"))
{
content.setProperty("jcr:mimeType", mimeTypeRecognizer.getMimeType());
}
if (mimeTypeRecognizer.isEncodingSet())
{
content.setProperty("jcr:encoding", mimeTypeRecognizer.getEncoding());
}
content.setProperty("jcr:lastModified", Calendar.getInstance());
content.setProperty("jcr:data", inputStream);
for (String mixinName : mixins)
{
if (content.canAddMixin(mixinName))
{
content.addMixin(mixinName);
}
}
} | java | private void updateContent(Node node, InputStream inputStream, List<String> mixins) throws RepositoryException
{
Node content = node.getNode("jcr:content");
if (mimeTypeRecognizer.isMimeTypeRecognized() || !content.hasProperty("jcr:mimeType"))
{
content.setProperty("jcr:mimeType", mimeTypeRecognizer.getMimeType());
}
if (mimeTypeRecognizer.isEncodingSet())
{
content.setProperty("jcr:encoding", mimeTypeRecognizer.getEncoding());
}
content.setProperty("jcr:lastModified", Calendar.getInstance());
content.setProperty("jcr:data", inputStream);
for (String mixinName : mixins)
{
if (content.canAddMixin(mixinName))
{
content.addMixin(mixinName);
}
}
} | [
"private",
"void",
"updateContent",
"(",
"Node",
"node",
",",
"InputStream",
"inputStream",
",",
"List",
"<",
"String",
">",
"mixins",
")",
"throws",
"RepositoryException",
"{",
"Node",
"content",
"=",
"node",
".",
"getNode",
"(",
"\"jcr:content\"",
")",
";",
"if",
"(",
"mimeTypeRecognizer",
".",
"isMimeTypeRecognized",
"(",
")",
"||",
"!",
"content",
".",
"hasProperty",
"(",
"\"jcr:mimeType\"",
")",
")",
"{",
"content",
".",
"setProperty",
"(",
"\"jcr:mimeType\"",
",",
"mimeTypeRecognizer",
".",
"getMimeType",
"(",
")",
")",
";",
"}",
"if",
"(",
"mimeTypeRecognizer",
".",
"isEncodingSet",
"(",
")",
")",
"{",
"content",
".",
"setProperty",
"(",
"\"jcr:encoding\"",
",",
"mimeTypeRecognizer",
".",
"getEncoding",
"(",
")",
")",
";",
"}",
"content",
".",
"setProperty",
"(",
"\"jcr:lastModified\"",
",",
"Calendar",
".",
"getInstance",
"(",
")",
")",
";",
"content",
".",
"setProperty",
"(",
"\"jcr:data\"",
",",
"inputStream",
")",
";",
"for",
"(",
"String",
"mixinName",
":",
"mixins",
")",
"{",
"if",
"(",
"content",
".",
"canAddMixin",
"(",
"mixinName",
")",
")",
"{",
"content",
".",
"addMixin",
"(",
"mixinName",
")",
";",
"}",
"}",
"}"
] | Updates jcr:content node.
@param node parent node
@param inputStream inputStream input stream that contains the content of
file
@param mixins list of mixins
@throws RepositoryException {@link RepositoryException} | [
"Updates",
"jcr",
":",
"content",
"node",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java#L384-L408 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/blockdata/BlockDataMessage.java | BlockDataMessage.sendBlockData | public static void sendBlockData(Chunk chunk, String identifer, ByteBuf data) {
"""
Sends the data to all the players currently watching the specified {@link Chunk}.
@param chunk the chunk
@param identifer the identifer
@param data the data
"""
MalisisCore.network.sendToPlayersWatchingChunk(new Packet(chunk, identifer, data), chunk);
} | java | public static void sendBlockData(Chunk chunk, String identifer, ByteBuf data)
{
MalisisCore.network.sendToPlayersWatchingChunk(new Packet(chunk, identifer, data), chunk);
} | [
"public",
"static",
"void",
"sendBlockData",
"(",
"Chunk",
"chunk",
",",
"String",
"identifer",
",",
"ByteBuf",
"data",
")",
"{",
"MalisisCore",
".",
"network",
".",
"sendToPlayersWatchingChunk",
"(",
"new",
"Packet",
"(",
"chunk",
",",
"identifer",
",",
"data",
")",
",",
"chunk",
")",
";",
"}"
] | Sends the data to all the players currently watching the specified {@link Chunk}.
@param chunk the chunk
@param identifer the identifer
@param data the data | [
"Sends",
"the",
"data",
"to",
"all",
"the",
"players",
"currently",
"watching",
"the",
"specified",
"{",
"@link",
"Chunk",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataMessage.java#L77-L80 |
landawn/AbacusUtil | src/com/landawn/abacus/util/LongList.java | LongList.allMatch | public <E extends Exception> boolean allMatch(Try.LongPredicate<E> filter) throws E {
"""
Returns whether all elements of this List match the provided predicate.
@param filter
@return
"""
return allMatch(0, size(), filter);
} | java | public <E extends Exception> boolean allMatch(Try.LongPredicate<E> filter) throws E {
return allMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"allMatch",
"(",
"Try",
".",
"LongPredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"allMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether all elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"all",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongList.java#L920-L922 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java | QueryDataUtils.writeCsv | private static byte[] writeCsv(String[] columnHeaders, String[][] rows) throws IOException {
"""
Writes a CSV file
@param columnHeaders headers
@param rows rows
@return CSV file
@throws IOException throws IOException when CSV writing fails
"""
try (ByteArrayOutputStream csvStream = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(csvStream, Charset.forName("UTF-8"))) {
CSVWriter csvWriter = new CSVWriter(streamWriter, ',');
csvWriter.writeNext(columnHeaders);
for (String[] row : rows) {
csvWriter.writeNext(row);
}
csvWriter.close();
return csvStream.toByteArray();
}
} | java | private static byte[] writeCsv(String[] columnHeaders, String[][] rows) throws IOException {
try (ByteArrayOutputStream csvStream = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(csvStream, Charset.forName("UTF-8"))) {
CSVWriter csvWriter = new CSVWriter(streamWriter, ',');
csvWriter.writeNext(columnHeaders);
for (String[] row : rows) {
csvWriter.writeNext(row);
}
csvWriter.close();
return csvStream.toByteArray();
}
} | [
"private",
"static",
"byte",
"[",
"]",
"writeCsv",
"(",
"String",
"[",
"]",
"columnHeaders",
",",
"String",
"[",
"]",
"[",
"]",
"rows",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ByteArrayOutputStream",
"csvStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"streamWriter",
"=",
"new",
"OutputStreamWriter",
"(",
"csvStream",
",",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")",
")",
")",
"{",
"CSVWriter",
"csvWriter",
"=",
"new",
"CSVWriter",
"(",
"streamWriter",
",",
"'",
"'",
")",
";",
"csvWriter",
".",
"writeNext",
"(",
"columnHeaders",
")",
";",
"for",
"(",
"String",
"[",
"]",
"row",
":",
"rows",
")",
"{",
"csvWriter",
".",
"writeNext",
"(",
"row",
")",
";",
"}",
"csvWriter",
".",
"close",
"(",
")",
";",
"return",
"csvStream",
".",
"toByteArray",
"(",
")",
";",
"}",
"}"
] | Writes a CSV file
@param columnHeaders headers
@param rows rows
@return CSV file
@throws IOException throws IOException when CSV writing fails | [
"Writes",
"a",
"CSV",
"file"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java#L256-L270 |
samskivert/pythagoras | src/main/java/pythagoras/d/Plane.java | Plane.fromPoints | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
"""
Sets this plane based on the three points provided.
@return a reference to the plane (for chaining).
"""
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
constant = -_normal.dot(p1);
return this;
} | java | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
constant = -_normal.dot(p1);
return this;
} | [
"public",
"Plane",
"fromPoints",
"(",
"IVector3",
"p1",
",",
"IVector3",
"p2",
",",
"IVector3",
"p3",
")",
"{",
"// compute the normal by taking the cross product of the two vectors formed",
"p2",
".",
"subtract",
"(",
"p1",
",",
"_v1",
")",
";",
"p3",
".",
"subtract",
"(",
"p1",
",",
"_v2",
")",
";",
"_v1",
".",
"cross",
"(",
"_v2",
",",
"_normal",
")",
".",
"normalizeLocal",
"(",
")",
";",
"// use the first point to determine the constant",
"constant",
"=",
"-",
"_normal",
".",
"dot",
"(",
"p1",
")",
";",
"return",
"this",
";",
"}"
] | Sets this plane based on the three points provided.
@return a reference to the plane (for chaining). | [
"Sets",
"this",
"plane",
"based",
"on",
"the",
"three",
"points",
"provided",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Plane.java#L109-L118 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/JavaTypeAnalyzer.java | JavaTypeAnalyzer.isRelevant | private static boolean isRelevant(final Method method, final XmlAccessType accessType) {
"""
Checks if the method is public and non-static and that the method is a Getter.
Does not allow methods with ignored names.
Does also not take methods annotated with {@link XmlTransient}.
@param method The method
@return {@code true} if the method should be analyzed further
"""
if (method.isSynthetic() || !isGetter(method))
return false;
final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName()));
if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) {
return false;
}
if (isAnnotationPresent(method, XmlElement.class))
return true;
if (accessType == XmlAccessType.PROPERTY)
return !isAnnotationPresent(method, XmlTransient.class);
else if (accessType == XmlAccessType.PUBLIC_MEMBER)
return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class);
return false;
} | java | private static boolean isRelevant(final Method method, final XmlAccessType accessType) {
if (method.isSynthetic() || !isGetter(method))
return false;
final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName()));
if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) {
return false;
}
if (isAnnotationPresent(method, XmlElement.class))
return true;
if (accessType == XmlAccessType.PROPERTY)
return !isAnnotationPresent(method, XmlTransient.class);
else if (accessType == XmlAccessType.PUBLIC_MEMBER)
return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class);
return false;
} | [
"private",
"static",
"boolean",
"isRelevant",
"(",
"final",
"Method",
"method",
",",
"final",
"XmlAccessType",
"accessType",
")",
"{",
"if",
"(",
"method",
".",
"isSynthetic",
"(",
")",
"||",
"!",
"isGetter",
"(",
"method",
")",
")",
"return",
"false",
";",
"final",
"boolean",
"propertyIgnored",
"=",
"ignoredFieldNames",
".",
"contains",
"(",
"extractPropertyName",
"(",
"method",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"propertyIgnored",
"||",
"hasIgnoreAnnotation",
"(",
"method",
")",
"||",
"isTypeIgnored",
"(",
"method",
".",
"getReturnType",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isAnnotationPresent",
"(",
"method",
",",
"XmlElement",
".",
"class",
")",
")",
"return",
"true",
";",
"if",
"(",
"accessType",
"==",
"XmlAccessType",
".",
"PROPERTY",
")",
"return",
"!",
"isAnnotationPresent",
"(",
"method",
",",
"XmlTransient",
".",
"class",
")",
";",
"else",
"if",
"(",
"accessType",
"==",
"XmlAccessType",
".",
"PUBLIC_MEMBER",
")",
"return",
"Modifier",
".",
"isPublic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
"&&",
"!",
"isAnnotationPresent",
"(",
"method",
",",
"XmlTransient",
".",
"class",
")",
";",
"return",
"false",
";",
"}"
] | Checks if the method is public and non-static and that the method is a Getter.
Does not allow methods with ignored names.
Does also not take methods annotated with {@link XmlTransient}.
@param method The method
@return {@code true} if the method should be analyzed further | [
"Checks",
"if",
"the",
"method",
"is",
"public",
"and",
"non",
"-",
"static",
"and",
"that",
"the",
"method",
"is",
"a",
"Getter",
".",
"Does",
"not",
"allow",
"methods",
"with",
"ignored",
"names",
".",
"Does",
"also",
"not",
"take",
"methods",
"annotated",
"with",
"{",
"@link",
"XmlTransient",
"}",
"."
] | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/JavaTypeAnalyzer.java#L175-L193 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java | StreamSet.createPersistentSubset | private ReliabilitySubset createPersistentSubset(Reliability reliability,
TransactionCommon tran) throws SIResourceException {
"""
Create a new ReliabilitySubset for the given reliability. If it is not express,
store it in the message store and record the message store ID.
@param reliability
@throws SIResourceException
@throws SIStoreException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createPersistentSubset", new Object[] { reliability });
ReliabilitySubset subset = new ReliabilitySubset(reliability, initialData);
subsets[getIndex(reliability)] = subset;
if(reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0)
{
try
{
Transaction msTran = txManager.resolveAndEnlistMsgStoreTransaction(tran);
itemStream.addItem(subset, msTran);
subsetIDs[getIndex(reliability)] = subset.getID();
}
catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.gd.StreamSet.createPersistentSubset",
"1:398:1.67",
this);
//not sure if this default is needed but better safe than sorry
subsetIDs[getIndex(reliability)] = NO_ID;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createPersistentSubset", e);
}
}
}
else
{
subsetIDs[getIndex(reliability)] = NO_ID;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createPersistentSubset", subset);
return subset;
} | java | private ReliabilitySubset createPersistentSubset(Reliability reliability,
TransactionCommon tran) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createPersistentSubset", new Object[] { reliability });
ReliabilitySubset subset = new ReliabilitySubset(reliability, initialData);
subsets[getIndex(reliability)] = subset;
if(reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0)
{
try
{
Transaction msTran = txManager.resolveAndEnlistMsgStoreTransaction(tran);
itemStream.addItem(subset, msTran);
subsetIDs[getIndex(reliability)] = subset.getID();
}
catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.gd.StreamSet.createPersistentSubset",
"1:398:1.67",
this);
//not sure if this default is needed but better safe than sorry
subsetIDs[getIndex(reliability)] = NO_ID;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createPersistentSubset", e);
}
}
}
else
{
subsetIDs[getIndex(reliability)] = NO_ID;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createPersistentSubset", subset);
return subset;
} | [
"private",
"ReliabilitySubset",
"createPersistentSubset",
"(",
"Reliability",
"reliability",
",",
"TransactionCommon",
"tran",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createPersistentSubset\"",
",",
"new",
"Object",
"[",
"]",
"{",
"reliability",
"}",
")",
";",
"ReliabilitySubset",
"subset",
"=",
"new",
"ReliabilitySubset",
"(",
"reliability",
",",
"initialData",
")",
";",
"subsets",
"[",
"getIndex",
"(",
"reliability",
")",
"]",
"=",
"subset",
";",
"if",
"(",
"reliability",
".",
"compareTo",
"(",
"Reliability",
".",
"BEST_EFFORT_NONPERSISTENT",
")",
">",
"0",
")",
"{",
"try",
"{",
"Transaction",
"msTran",
"=",
"txManager",
".",
"resolveAndEnlistMsgStoreTransaction",
"(",
"tran",
")",
";",
"itemStream",
".",
"addItem",
"(",
"subset",
",",
"msTran",
")",
";",
"subsetIDs",
"[",
"getIndex",
"(",
"reliability",
")",
"]",
"=",
"subset",
".",
"getID",
"(",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.gd.StreamSet.createPersistentSubset\"",
",",
"\"1:398:1.67\"",
",",
"this",
")",
";",
"//not sure if this default is needed but better safe than sorry",
"subsetIDs",
"[",
"getIndex",
"(",
"reliability",
")",
"]",
"=",
"NO_ID",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createPersistentSubset\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"else",
"{",
"subsetIDs",
"[",
"getIndex",
"(",
"reliability",
")",
"]",
"=",
"NO_ID",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createPersistentSubset\"",
",",
"subset",
")",
";",
"return",
"subset",
";",
"}"
] | Create a new ReliabilitySubset for the given reliability. If it is not express,
store it in the message store and record the message store ID.
@param reliability
@throws SIResourceException
@throws SIStoreException | [
"Create",
"a",
"new",
"ReliabilitySubset",
"for",
"the",
"given",
"reliability",
".",
"If",
"it",
"is",
"not",
"express",
"store",
"it",
"in",
"the",
"message",
"store",
"and",
"record",
"the",
"message",
"store",
"ID",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java#L373-L415 |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.isEpsilonZero | @Pure
@Inline(value = "Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))", imported = Math.class)
public static boolean isEpsilonZero(double value, double epsilon) {
"""
Replies if the given value is near zero.
@param value is the value to test.
@param epsilon the approximation epsilon. If {@link Double#NaN}, the function {@link Math#ulp(double)} is
used for evaluating the epsilon.
@return <code>true</code> if the given {@code value}
is near zero, otherwise <code>false</code>.
"""
final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon;
return Math.abs(value) <= eps;
} | java | @Pure
@Inline(value = "Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))", imported = Math.class)
public static boolean isEpsilonZero(double value, double epsilon) {
final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon;
return Math.abs(value) <= eps;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))\"",
",",
"imported",
"=",
"Math",
".",
"class",
")",
"public",
"static",
"boolean",
"isEpsilonZero",
"(",
"double",
"value",
",",
"double",
"epsilon",
")",
"{",
"final",
"double",
"eps",
"=",
"Double",
".",
"isNaN",
"(",
"epsilon",
")",
"?",
"Math",
".",
"ulp",
"(",
"value",
")",
":",
"epsilon",
";",
"return",
"Math",
".",
"abs",
"(",
"value",
")",
"<=",
"eps",
";",
"}"
] | Replies if the given value is near zero.
@param value is the value to test.
@param epsilon the approximation epsilon. If {@link Double#NaN}, the function {@link Math#ulp(double)} is
used for evaluating the epsilon.
@return <code>true</code> if the given {@code value}
is near zero, otherwise <code>false</code>. | [
"Replies",
"if",
"the",
"given",
"value",
"is",
"near",
"zero",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L136-L141 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java | ScanRequest.withExclusiveStartKey | public ScanRequest withExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
"""
The primary hash and range keys of the first item that this operation will evaluate. Use the value that was
returned for <i>LastEvaluatedKey</i> in the previous operation.
<p>
The data type for <i>ExclusiveStartKey</i> must be String, Number or Binary. No set data types are allowed.
<p>
Returns a reference to this object so that method calls can be chained together.
@param hashKey
a map entry including the name and value of the primary hash key.
@param rangeKey
a map entry including the name and value of the primary range key, or null if it is a hash-only table.
"""
setExclusiveStartKey(hashKey, rangeKey);
return this;
} | java | public ScanRequest withExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
setExclusiveStartKey(hashKey, rangeKey);
return this;
} | [
"public",
"ScanRequest",
"withExclusiveStartKey",
"(",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"hashKey",
",",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"rangeKey",
")",
"throws",
"IllegalArgumentException",
"{",
"setExclusiveStartKey",
"(",
"hashKey",
",",
"rangeKey",
")",
";",
"return",
"this",
";",
"}"
] | The primary hash and range keys of the first item that this operation will evaluate. Use the value that was
returned for <i>LastEvaluatedKey</i> in the previous operation.
<p>
The data type for <i>ExclusiveStartKey</i> must be String, Number or Binary. No set data types are allowed.
<p>
Returns a reference to this object so that method calls can be chained together.
@param hashKey
a map entry including the name and value of the primary hash key.
@param rangeKey
a map entry including the name and value of the primary range key, or null if it is a hash-only table. | [
"The",
"primary",
"hash",
"and",
"range",
"keys",
"of",
"the",
"first",
"item",
"that",
"this",
"operation",
"will",
"evaluate",
".",
"Use",
"the",
"value",
"that",
"was",
"returned",
"for",
"<i",
">",
"LastEvaluatedKey<",
"/",
"i",
">",
"in",
"the",
"previous",
"operation",
".",
"<p",
">",
"The",
"data",
"type",
"for",
"<i",
">",
"ExclusiveStartKey<",
"/",
"i",
">",
"must",
"be",
"String",
"Number",
"or",
"Binary",
".",
"No",
"set",
"data",
"types",
"are",
"allowed",
".",
"<p",
">",
"Returns",
"a",
"reference",
"to",
"this",
"object",
"so",
"that",
"method",
"calls",
"can",
"be",
"chained",
"together",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java#L2952-L2956 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDiscouragedAnnotationUse | @Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION)
public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) {
"""
Quick fix for the discouraged annotation uses.
@param issue the issue.
@param acceptor the quick fix acceptor.
"""
AnnotationRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION)
public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) {
AnnotationRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"USED_RESERVED_SARL_ANNOTATION",
")",
"public",
"void",
"fixDiscouragedAnnotationUse",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"AnnotationRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"acceptor",
")",
";",
"}"
] | Quick fix for the discouraged annotation uses.
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"the",
"discouraged",
"annotation",
"uses",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L974-L977 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsDocumentNotFound | public FessMessages addErrorsDocumentNotFound(String property, String arg0) {
"""
Add the created action message for the key 'errors.document_not_found' with parameters.
<pre>
message: Not found URL of Doc ID:{0}
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull)
"""
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_document_not_found, arg0));
return this;
} | java | public FessMessages addErrorsDocumentNotFound(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_document_not_found, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsDocumentNotFound",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_document_not_found",
",",
"arg0",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the created action message for the key 'errors.document_not_found' with parameters.
<pre>
message: Not found URL of Doc ID:{0}
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"document_not_found",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Not",
"found",
"URL",
"of",
"Doc",
"ID",
":",
"{",
"0",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1492-L1496 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forField | public static ResolvableType forField(Field field, Class<?> implementationClass) {
"""
Return a {@link ResolvableType} for the specified {@link Field} with a given
implementation.
<p>Use this variant when the class that declares the field includes generic
parameter variables that are satisfied by the implementation class.
@param field the source field
@param implementationClass the implementation class
@return a {@link ResolvableType} for the specified field
@see #forField(Field)
"""
Assert.notNull(field, "Field must not be null");
ResolvableType owner = forType(implementationClass).as(field.getDeclaringClass());
return forType(null, new FieldTypeProvider(field), owner.asVariableResolver());
} | java | public static ResolvableType forField(Field field, Class<?> implementationClass) {
Assert.notNull(field, "Field must not be null");
ResolvableType owner = forType(implementationClass).as(field.getDeclaringClass());
return forType(null, new FieldTypeProvider(field), owner.asVariableResolver());
} | [
"public",
"static",
"ResolvableType",
"forField",
"(",
"Field",
"field",
",",
"Class",
"<",
"?",
">",
"implementationClass",
")",
"{",
"Assert",
".",
"notNull",
"(",
"field",
",",
"\"Field must not be null\"",
")",
";",
"ResolvableType",
"owner",
"=",
"forType",
"(",
"implementationClass",
")",
".",
"as",
"(",
"field",
".",
"getDeclaringClass",
"(",
")",
")",
";",
"return",
"forType",
"(",
"null",
",",
"new",
"FieldTypeProvider",
"(",
"field",
")",
",",
"owner",
".",
"asVariableResolver",
"(",
")",
")",
";",
"}"
] | Return a {@link ResolvableType} for the specified {@link Field} with a given
implementation.
<p>Use this variant when the class that declares the field includes generic
parameter variables that are satisfied by the implementation class.
@param field the source field
@param implementationClass the implementation class
@return a {@link ResolvableType} for the specified field
@see #forField(Field) | [
"Return",
"a",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L937-L941 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringGrabber.java | StringGrabber.getStringEnclosedInFirst | public StringGrabber getStringEnclosedInFirst(String startToken, String endToken) {
"""
returns the first one that enclosed in specific tokens found in the
source string.
@param startToken
@param endToken
@return
"""
return new StringGrabber(getCropper().getStringEnclosedInFirst(sb.toString(), startToken, endToken));
} | java | public StringGrabber getStringEnclosedInFirst(String startToken, String endToken) {
return new StringGrabber(getCropper().getStringEnclosedInFirst(sb.toString(), startToken, endToken));
} | [
"public",
"StringGrabber",
"getStringEnclosedInFirst",
"(",
"String",
"startToken",
",",
"String",
"endToken",
")",
"{",
"return",
"new",
"StringGrabber",
"(",
"getCropper",
"(",
")",
".",
"getStringEnclosedInFirst",
"(",
"sb",
".",
"toString",
"(",
")",
",",
"startToken",
",",
"endToken",
")",
")",
";",
"}"
] | returns the first one that enclosed in specific tokens found in the
source string.
@param startToken
@param endToken
@return | [
"returns",
"the",
"first",
"one",
"that",
"enclosed",
"in",
"specific",
"tokens",
"found",
"in",
"the",
"source",
"string",
"."
] | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L646-L648 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.