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 listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jfoenixadmin/JFoenix | jfoenix/src/main/java/com/jfoenix/effects/JFXDepthManager.java | JFXDepthManager.createMaterialNode | public static Node createMaterialNode(Node control, int level) {
"""
this method will generate a new container node that prevent
control transformation to be applied to the shadow effect
(which makes it looks as a real shadow)
"""
Node container = new Pane(control){
@Override
protected double computeMaxWidth(double height) {
return computePrefWidth(height);
}
@Override
protected double computeMaxHeight(double width) {
return computePrefHeight(width);
}
@Override
protected double computePrefWidth(double height) {
return control.prefWidth(height);
}
@Override
protected double computePrefHeight(double width) {
return control.prefHeight(width);
}
};
container.getStyleClass().add("depth-container");
container.setPickOnBounds(false);
level = level < 0 ? 0 : level;
level = level > 5 ? 5 : level;
container.setEffect(new DropShadow(BlurType.GAUSSIAN,
depth[level].getColor(),
depth[level].getRadius(),
depth[level].getSpread(),
depth[level].getOffsetX(),
depth[level].getOffsetY()));
return container;
} | java | public static Node createMaterialNode(Node control, int level) {
Node container = new Pane(control){
@Override
protected double computeMaxWidth(double height) {
return computePrefWidth(height);
}
@Override
protected double computeMaxHeight(double width) {
return computePrefHeight(width);
}
@Override
protected double computePrefWidth(double height) {
return control.prefWidth(height);
}
@Override
protected double computePrefHeight(double width) {
return control.prefHeight(width);
}
};
container.getStyleClass().add("depth-container");
container.setPickOnBounds(false);
level = level < 0 ? 0 : level;
level = level > 5 ? 5 : level;
container.setEffect(new DropShadow(BlurType.GAUSSIAN,
depth[level].getColor(),
depth[level].getRadius(),
depth[level].getSpread(),
depth[level].getOffsetX(),
depth[level].getOffsetY()));
return container;
} | [
"public",
"static",
"Node",
"createMaterialNode",
"(",
"Node",
"control",
",",
"int",
"level",
")",
"{",
"Node",
"container",
"=",
"new",
"Pane",
"(",
"control",
")",
"{",
"@",
"Override",
"protected",
"double",
"computeMaxWidth",
"(",
"double",
"height",
")... | this method will generate a new container node that prevent
control transformation to be applied to the shadow effect
(which makes it looks as a real shadow) | [
"this",
"method",
"will",
"generate",
"a",
"new",
"container",
"node",
"that",
"prevent",
"control",
"transformation",
"to",
"be",
"applied",
"to",
"the",
"shadow",
"effect",
"(",
"which",
"makes",
"it",
"looks",
"as",
"a",
"real",
"shadow",
")"
] | train | https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/effects/JFXDepthManager.java#L76-L109 |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.constructLVal | private LValue constructLVal(Expr expr, CallStack frame) {
"""
This method constructs a "mutable" representation of the lval. This is a
bit strange, but is necessary because values in the frame are currently
immutable.
@param operand
@param frame
@param context
@return
"""
switch (expr.getOpcode()) {
case EXPR_arrayborrow:
case EXPR_arrayaccess: {
Expr.ArrayAccess e = (Expr.ArrayAccess) expr;
LValue src = constructLVal(e.getFirstOperand(), frame);
RValue.Int index = executeExpression(INT_T, e.getSecondOperand(), frame);
return new LValue.Array(src, index);
}
case EXPR_dereference: {
Expr.Dereference e = (Expr.Dereference) expr;
LValue src = constructLVal(e.getOperand(), frame);
return new LValue.Dereference(src);
}
case EXPR_recordaccess:
case EXPR_recordborrow: {
Expr.RecordAccess e = (Expr.RecordAccess) expr;
LValue src = constructLVal(e.getOperand(), frame);
return new LValue.Record(src, e.getField());
}
case EXPR_variablemove:
case EXPR_variablecopy: {
Expr.VariableAccess e = (Expr.VariableAccess) expr;
Decl.Variable decl = e.getVariableDeclaration();
return new LValue.Variable(decl.getName());
}
}
deadCode(expr);
return null; // deadcode
} | java | private LValue constructLVal(Expr expr, CallStack frame) {
switch (expr.getOpcode()) {
case EXPR_arrayborrow:
case EXPR_arrayaccess: {
Expr.ArrayAccess e = (Expr.ArrayAccess) expr;
LValue src = constructLVal(e.getFirstOperand(), frame);
RValue.Int index = executeExpression(INT_T, e.getSecondOperand(), frame);
return new LValue.Array(src, index);
}
case EXPR_dereference: {
Expr.Dereference e = (Expr.Dereference) expr;
LValue src = constructLVal(e.getOperand(), frame);
return new LValue.Dereference(src);
}
case EXPR_recordaccess:
case EXPR_recordborrow: {
Expr.RecordAccess e = (Expr.RecordAccess) expr;
LValue src = constructLVal(e.getOperand(), frame);
return new LValue.Record(src, e.getField());
}
case EXPR_variablemove:
case EXPR_variablecopy: {
Expr.VariableAccess e = (Expr.VariableAccess) expr;
Decl.Variable decl = e.getVariableDeclaration();
return new LValue.Variable(decl.getName());
}
}
deadCode(expr);
return null; // deadcode
} | [
"private",
"LValue",
"constructLVal",
"(",
"Expr",
"expr",
",",
"CallStack",
"frame",
")",
"{",
"switch",
"(",
"expr",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"EXPR_arrayborrow",
":",
"case",
"EXPR_arrayaccess",
":",
"{",
"Expr",
".",
"ArrayAccess",
... | This method constructs a "mutable" representation of the lval. This is a
bit strange, but is necessary because values in the frame are currently
immutable.
@param operand
@param frame
@param context
@return | [
"This",
"method",
"constructs",
"a",
"mutable",
"representation",
"of",
"the",
"lval",
".",
"This",
"is",
"a",
"bit",
"strange",
"but",
"is",
"necessary",
"because",
"values",
"in",
"the",
"frame",
"are",
"currently",
"immutable",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L1201-L1230 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/graphdb/query/vertex/SimpleVertexQueryProcessor.java | SimpleVertexQueryProcessor.vertexIds | public VertexList vertexIds() {
"""
Returns the list of adjacent vertex ids for this query. By reading those ids
from the entries directly (without creating objects) we get much better performance.
@return
"""
LongArrayList list = new LongArrayList();
long previousId = 0;
for (Long id : Iterables.transform(this,new Function<Entry, Long>() {
@Nullable
@Override
public Long apply(@Nullable Entry entry) {
return edgeSerializer.readRelation(entry,true,tx).getOtherVertexId();
}
})) {
list.add(id);
if (id>=previousId && previousId>=0) previousId=id;
else previousId=-1;
}
return new VertexLongList(tx,list,previousId>=0);
} | java | public VertexList vertexIds() {
LongArrayList list = new LongArrayList();
long previousId = 0;
for (Long id : Iterables.transform(this,new Function<Entry, Long>() {
@Nullable
@Override
public Long apply(@Nullable Entry entry) {
return edgeSerializer.readRelation(entry,true,tx).getOtherVertexId();
}
})) {
list.add(id);
if (id>=previousId && previousId>=0) previousId=id;
else previousId=-1;
}
return new VertexLongList(tx,list,previousId>=0);
} | [
"public",
"VertexList",
"vertexIds",
"(",
")",
"{",
"LongArrayList",
"list",
"=",
"new",
"LongArrayList",
"(",
")",
";",
"long",
"previousId",
"=",
"0",
";",
"for",
"(",
"Long",
"id",
":",
"Iterables",
".",
"transform",
"(",
"this",
",",
"new",
"Function... | Returns the list of adjacent vertex ids for this query. By reading those ids
from the entries directly (without creating objects) we get much better performance.
@return | [
"Returns",
"the",
"list",
"of",
"adjacent",
"vertex",
"ids",
"for",
"this",
"query",
".",
"By",
"reading",
"those",
"ids",
"from",
"the",
"entries",
"directly",
"(",
"without",
"creating",
"objects",
")",
"we",
"get",
"much",
"better",
"performance",
"."
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/query/vertex/SimpleVertexQueryProcessor.java#L88-L103 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.createCustomPrebuiltEntityRole | public UUID createCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreateCustomPrebuiltEntityRoleOptionalParameter createCustomPrebuiltEntityRoleOptionalParameter) {
"""
Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createCustomPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful.
"""
return createCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public UUID createCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreateCustomPrebuiltEntityRoleOptionalParameter createCustomPrebuiltEntityRoleOptionalParameter) {
return createCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"createCustomPrebuiltEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"CreateCustomPrebuiltEntityRoleOptionalParameter",
"createCustomPrebuiltEntityRoleOptionalParameter",
")",
"{",
"return",
"createCustomPrebuiltEntit... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createCustomPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9712-L9714 |
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.newClass | public static Matcher newClass() {
"""
Returns a Matcher that matches constructing new objects. This will match
the NEW node of the JS Compiler AST.
"""
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | java | public static Matcher newClass() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | [
"public",
"static",
"Matcher",
"newClass",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"return",
"node",
".",
"isNew",
"(",
")"... | Returns a Matcher that matches constructing new objects. This will match
the NEW node of the JS Compiler AST. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"constructing",
"new",
"objects",
".",
"This",
"will",
"match",
"the",
"NEW",
"node",
"of",
"the",
"JS",
"Compiler",
"AST",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L129-L135 |
adyliu/jafka | src/main/java/io/jafka/log/LogManager.java | LogManager.cleanupSegmentsToMaintainSize | private int cleanupSegmentsToMaintainSize(final Log log) throws IOException {
"""
Runs through the log removing segments until the size of the log is at least
logRetentionSize bytes in size
@throws IOException
"""
if (logRetentionSize < 0 || log.size() < logRetentionSize) return 0;
List<LogSegment> toBeDeleted = log.markDeletedWhile(new LogSegmentFilter() {
long diff = log.size() - logRetentionSize;
public boolean filter(LogSegment segment) {
diff -= segment.size();
return diff >= 0;
}
});
return deleteSegments(log, toBeDeleted);
} | java | private int cleanupSegmentsToMaintainSize(final Log log) throws IOException {
if (logRetentionSize < 0 || log.size() < logRetentionSize) return 0;
List<LogSegment> toBeDeleted = log.markDeletedWhile(new LogSegmentFilter() {
long diff = log.size() - logRetentionSize;
public boolean filter(LogSegment segment) {
diff -= segment.size();
return diff >= 0;
}
});
return deleteSegments(log, toBeDeleted);
} | [
"private",
"int",
"cleanupSegmentsToMaintainSize",
"(",
"final",
"Log",
"log",
")",
"throws",
"IOException",
"{",
"if",
"(",
"logRetentionSize",
"<",
"0",
"||",
"log",
".",
"size",
"(",
")",
"<",
"logRetentionSize",
")",
"return",
"0",
";",
"List",
"<",
"L... | Runs through the log removing segments until the size of the log is at least
logRetentionSize bytes in size
@throws IOException | [
"Runs",
"through",
"the",
"log",
"removing",
"segments",
"until",
"the",
"size",
"of",
"the",
"log",
"is",
"at",
"least",
"logRetentionSize",
"bytes",
"in",
"size"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/log/LogManager.java#L274-L287 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java | DebugUtil.printTimeDifference | public static void printTimeDifference(final TimeDifference pTimeDifference, final PrintStream pPrintStream) {
"""
Prints out a {@code com.iml.oslo.eito.util.DebugUtil.TimeDifference} object.
<p>
@param pTimeDifference the {@code com.twelvemonkeys.util.DebugUtil.TimeDifference} to investigate.
@param pPrintStream the {@code java.io.PrintStream} for flushing the results.
"""
printTimeDifference(pTimeDifference.getStartCalendar(), pTimeDifference.getEndCalendar(), pPrintStream);
} | java | public static void printTimeDifference(final TimeDifference pTimeDifference, final PrintStream pPrintStream) {
printTimeDifference(pTimeDifference.getStartCalendar(), pTimeDifference.getEndCalendar(), pPrintStream);
} | [
"public",
"static",
"void",
"printTimeDifference",
"(",
"final",
"TimeDifference",
"pTimeDifference",
",",
"final",
"PrintStream",
"pPrintStream",
")",
"{",
"printTimeDifference",
"(",
"pTimeDifference",
".",
"getStartCalendar",
"(",
")",
",",
"pTimeDifference",
".",
... | Prints out a {@code com.iml.oslo.eito.util.DebugUtil.TimeDifference} object.
<p>
@param pTimeDifference the {@code com.twelvemonkeys.util.DebugUtil.TimeDifference} to investigate.
@param pPrintStream the {@code java.io.PrintStream} for flushing the results. | [
"Prints",
"out",
"a",
"{"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L1090-L1092 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.modInverseBP2 | static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
"""
Calculate the multiplicative inverse of 2^k mod mod, where mod is odd.
"""
// Copy the mod to protect original
return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
} | java | static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
// Copy the mod to protect original
return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
} | [
"static",
"MutableBigInteger",
"modInverseBP2",
"(",
"MutableBigInteger",
"mod",
",",
"int",
"k",
")",
"{",
"// Copy the mod to protect original",
"return",
"fixup",
"(",
"new",
"MutableBigInteger",
"(",
"1",
")",
",",
"new",
"MutableBigInteger",
"(",
"mod",
")",
... | Calculate the multiplicative inverse of 2^k mod mod, where mod is odd. | [
"Calculate",
"the",
"multiplicative",
"inverse",
"of",
"2^k",
"mod",
"mod",
"where",
"mod",
"is",
"odd",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L2069-L2072 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/transform/TransformNoOp.java | TransformNoOp.transformOut | @Override
public Integer transformOut(CassandraBoundStatementFactory cbsf, Integer attrOut) throws CpoException {
"""
Transforms the data from the class attribute to the object required by the datasource. The type of the attrOut
parameter and the type of the return value must change to match the types being converted. Reflection is used to
true everything up at runtime.
e.g public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attrOut) would be the signature for
converting a byte[] stored in the pojo into a Blob object for the datasource.
@param cbsf a reference to the JdbcPreparedStatementFactory. This is necessary as some DBMSs (ORACLE !#$%^&!) that
require access to the connection to deal with certain datatypes.
@param attrOut The attribute object that needs to get transformed into the db representation
@return The object to be stored in the datasource
@throws org.synchronoss.cpo.CpoException
"""
logger.debug("Inside TransformNoOp::transformOut(CassandraBoundStatementFactory, " + attrOut + ");");
return attrOut;
} | java | @Override
public Integer transformOut(CassandraBoundStatementFactory cbsf, Integer attrOut) throws CpoException {
logger.debug("Inside TransformNoOp::transformOut(CassandraBoundStatementFactory, " + attrOut + ");");
return attrOut;
} | [
"@",
"Override",
"public",
"Integer",
"transformOut",
"(",
"CassandraBoundStatementFactory",
"cbsf",
",",
"Integer",
"attrOut",
")",
"throws",
"CpoException",
"{",
"logger",
".",
"debug",
"(",
"\"Inside TransformNoOp::transformOut(CassandraBoundStatementFactory, \"",
"+",
"... | Transforms the data from the class attribute to the object required by the datasource. The type of the attrOut
parameter and the type of the return value must change to match the types being converted. Reflection is used to
true everything up at runtime.
e.g public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attrOut) would be the signature for
converting a byte[] stored in the pojo into a Blob object for the datasource.
@param cbsf a reference to the JdbcPreparedStatementFactory. This is necessary as some DBMSs (ORACLE !#$%^&!) that
require access to the connection to deal with certain datatypes.
@param attrOut The attribute object that needs to get transformed into the db representation
@return The object to be stored in the datasource
@throws org.synchronoss.cpo.CpoException | [
"Transforms",
"the",
"data",
"from",
"the",
"class",
"attribute",
"to",
"the",
"object",
"required",
"by",
"the",
"datasource",
".",
"The",
"type",
"of",
"the",
"attrOut",
"parameter",
"and",
"the",
"type",
"of",
"the",
"return",
"value",
"must",
"change",
... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/transform/TransformNoOp.java#L73-L77 |
Bedework/bw-util | bw-util-cli/src/main/java/org/bedework/util/cli/SfpTokenizer.java | SfpTokenizer.assertToken | public void assertToken(final String token, final boolean ignoreCase) throws ParseException {
"""
Asserts that the next token in the stream matches the specified token.
@param token expected token
@param ignoreCase
@throws ParseException
"""
// ensure next token is a word token..
assertWord();
if (ignoreCase) {
if (!token.equalsIgnoreCase(sval)) {
throw new ParseException("Expected [" + token + "], read [" +
sval + "] at " + lineno());
}
} else if (!token.equals(sval)) {
throw new ParseException( "Expected [" + token + "], read [" +
sval + "] at " + lineno());
}
if (debug()) {
debug("[" + token + "]");
}
} | java | public void assertToken(final String token, final boolean ignoreCase) throws ParseException {
// ensure next token is a word token..
assertWord();
if (ignoreCase) {
if (!token.equalsIgnoreCase(sval)) {
throw new ParseException("Expected [" + token + "], read [" +
sval + "] at " + lineno());
}
} else if (!token.equals(sval)) {
throw new ParseException( "Expected [" + token + "], read [" +
sval + "] at " + lineno());
}
if (debug()) {
debug("[" + token + "]");
}
} | [
"public",
"void",
"assertToken",
"(",
"final",
"String",
"token",
",",
"final",
"boolean",
"ignoreCase",
")",
"throws",
"ParseException",
"{",
"// ensure next token is a word token..",
"assertWord",
"(",
")",
";",
"if",
"(",
"ignoreCase",
")",
"{",
"if",
"(",
"!... | Asserts that the next token in the stream matches the specified token.
@param token expected token
@param ignoreCase
@throws ParseException | [
"Asserts",
"that",
"the",
"next",
"token",
"in",
"the",
"stream",
"matches",
"the",
"specified",
"token",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-cli/src/main/java/org/bedework/util/cli/SfpTokenizer.java#L164-L181 |
iipc/webarchive-commons | src/main/java/org/archive/util/zip/OpenJDK7GZIPInputStream.java | OpenJDK7GZIPInputStream.skipBytes | protected void skipBytes(InputStream in, int n) throws IOException {
"""
/*
Skips bytes of input data blocking until all bytes are skipped.
Does not assume that the input stream is capable of seeking.
""" // IA VISIBILITY CHANGE FOR SUBCLASS USE
while (n > 0) {
int len = in.read(tmpbuf, 0, n < tmpbuf.length ? n : tmpbuf.length);
if (len == -1) {
throw new EOFException();
}
n -= len;
}
} | java | protected void skipBytes(InputStream in, int n) throws IOException { // IA VISIBILITY CHANGE FOR SUBCLASS USE
while (n > 0) {
int len = in.read(tmpbuf, 0, n < tmpbuf.length ? n : tmpbuf.length);
if (len == -1) {
throw new EOFException();
}
n -= len;
}
} | [
"protected",
"void",
"skipBytes",
"(",
"InputStream",
"in",
",",
"int",
"n",
")",
"throws",
"IOException",
"{",
"// IA VISIBILITY CHANGE FOR SUBCLASS USE\r",
"while",
"(",
"n",
">",
"0",
")",
"{",
"int",
"len",
"=",
"in",
".",
"read",
"(",
"tmpbuf",
",",
"... | /*
Skips bytes of input data blocking until all bytes are skipped.
Does not assume that the input stream is capable of seeking. | [
"/",
"*",
"Skips",
"bytes",
"of",
"input",
"data",
"blocking",
"until",
"all",
"bytes",
"are",
"skipped",
".",
"Does",
"not",
"assume",
"that",
"the",
"input",
"stream",
"is",
"capable",
"of",
"seeking",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/OpenJDK7GZIPInputStream.java#L286-L294 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isTimesEqaualed | public static boolean isTimesEqaualed(Date time1, Date time2) {
"""
Checks if is times eqaualed.
@param time1 the time 1
@param time2 the time 2
@return true, if is times eqaualed
"""
return formatTime(time1).equals(formatTime(time2));
} | java | public static boolean isTimesEqaualed(Date time1, Date time2) {
return formatTime(time1).equals(formatTime(time2));
} | [
"public",
"static",
"boolean",
"isTimesEqaualed",
"(",
"Date",
"time1",
",",
"Date",
"time2",
")",
"{",
"return",
"formatTime",
"(",
"time1",
")",
".",
"equals",
"(",
"formatTime",
"(",
"time2",
")",
")",
";",
"}"
] | Checks if is times eqaualed.
@param time1 the time 1
@param time2 the time 2
@return true, if is times eqaualed | [
"Checks",
"if",
"is",
"times",
"eqaualed",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L164-L166 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.writeNewClass | private int writeNewClass(Class<?> object, boolean unshared) throws IOException {
"""
Write class {@code object} into the receiver. It is assumed the
class has not been dumped yet. Classes are not really dumped, but a class
descriptor ({@code ObjectStreamClass}) that corresponds to them.
Returns the handle for this object (class) which is dumped here.
@param object
The {@code java.lang.Class} object to dump
@return the handle assigned to the class being dumped
@throws IOException
If an IO exception happened when writing the class.
"""
output.writeByte(TC_CLASS);
// Instances of java.lang.Class are always Serializable, even if their
// instances aren't (e.g. java.lang.Object.class).
// We cannot call lookup because it returns null if the parameter
// represents instances that cannot be serialized, and that is not what
// we want.
ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object);
// The handle for the classDesc is NOT the handle for the class object
// being dumped. We must allocate a new handle and return it.
if (clDesc.isEnum()) {
writeEnumDesc(clDesc, unshared);
} else {
writeClassDesc(clDesc, unshared);
}
int handle = nextHandle();
if (!unshared) {
objectsWritten.put(object, handle);
}
return handle;
} | java | private int writeNewClass(Class<?> object, boolean unshared) throws IOException {
output.writeByte(TC_CLASS);
// Instances of java.lang.Class are always Serializable, even if their
// instances aren't (e.g. java.lang.Object.class).
// We cannot call lookup because it returns null if the parameter
// represents instances that cannot be serialized, and that is not what
// we want.
ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object);
// The handle for the classDesc is NOT the handle for the class object
// being dumped. We must allocate a new handle and return it.
if (clDesc.isEnum()) {
writeEnumDesc(clDesc, unshared);
} else {
writeClassDesc(clDesc, unshared);
}
int handle = nextHandle();
if (!unshared) {
objectsWritten.put(object, handle);
}
return handle;
} | [
"private",
"int",
"writeNewClass",
"(",
"Class",
"<",
"?",
">",
"object",
",",
"boolean",
"unshared",
")",
"throws",
"IOException",
"{",
"output",
".",
"writeByte",
"(",
"TC_CLASS",
")",
";",
"// Instances of java.lang.Class are always Serializable, even if their",
"/... | Write class {@code object} into the receiver. It is assumed the
class has not been dumped yet. Classes are not really dumped, but a class
descriptor ({@code ObjectStreamClass}) that corresponds to them.
Returns the handle for this object (class) which is dumped here.
@param object
The {@code java.lang.Class} object to dump
@return the handle assigned to the class being dumped
@throws IOException
If an IO exception happened when writing the class. | [
"Write",
"class",
"{",
"@code",
"object",
"}",
"into",
"the",
"receiver",
".",
"It",
"is",
"assumed",
"the",
"class",
"has",
"not",
"been",
"dumped",
"yet",
".",
"Classes",
"are",
"not",
"really",
"dumped",
"but",
"a",
"class",
"descriptor",
"(",
"{",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L1202-L1226 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.addGalleriesForType | @SuppressWarnings("deprecation")
private void addGalleriesForType(Map<String, CmsGalleryTypeInfo> galleryTypeInfos, String typeName)
throws CmsLoaderException {
"""
Adds galleries for a given type.<p>
@param galleryTypeInfos the gallery type infos
@param typeName the type name
@throws CmsLoaderException if something goes wrong
"""
I_CmsResourceType contentType = getResourceManager().getResourceType(typeName);
for (I_CmsResourceType galleryType : contentType.getGalleryTypes()) {
if (galleryTypeInfos.containsKey(galleryType.getTypeName())) {
CmsGalleryTypeInfo typeInfo = galleryTypeInfos.get(galleryType.getTypeName());
typeInfo.addContentType(contentType);
} else {
CmsGalleryTypeInfo typeInfo;
typeInfo = new CmsGalleryTypeInfo(
galleryType,
contentType,
getGalleriesByType(galleryType.getTypeId()));
galleryTypeInfos.put(galleryType.getTypeName(), typeInfo);
}
}
} | java | @SuppressWarnings("deprecation")
private void addGalleriesForType(Map<String, CmsGalleryTypeInfo> galleryTypeInfos, String typeName)
throws CmsLoaderException {
I_CmsResourceType contentType = getResourceManager().getResourceType(typeName);
for (I_CmsResourceType galleryType : contentType.getGalleryTypes()) {
if (galleryTypeInfos.containsKey(galleryType.getTypeName())) {
CmsGalleryTypeInfo typeInfo = galleryTypeInfos.get(galleryType.getTypeName());
typeInfo.addContentType(contentType);
} else {
CmsGalleryTypeInfo typeInfo;
typeInfo = new CmsGalleryTypeInfo(
galleryType,
contentType,
getGalleriesByType(galleryType.getTypeId()));
galleryTypeInfos.put(galleryType.getTypeName(), typeInfo);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"addGalleriesForType",
"(",
"Map",
"<",
"String",
",",
"CmsGalleryTypeInfo",
">",
"galleryTypeInfos",
",",
"String",
"typeName",
")",
"throws",
"CmsLoaderException",
"{",
"I_CmsResourceType",
"co... | Adds galleries for a given type.<p>
@param galleryTypeInfos the gallery type infos
@param typeName the type name
@throws CmsLoaderException if something goes wrong | [
"Adds",
"galleries",
"for",
"a",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1546-L1568 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java | ArtifactHandler.updateDownLoadUrl | public void updateDownLoadUrl(final String gavc, final String downLoadUrl) {
"""
Update artifact download url of an artifact
@param gavc String
@param downLoadUrl String
"""
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateDownloadUrl(artifact, downLoadUrl);
} | java | public void updateDownLoadUrl(final String gavc, final String downLoadUrl) {
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateDownloadUrl(artifact, downLoadUrl);
} | [
"public",
"void",
"updateDownLoadUrl",
"(",
"final",
"String",
"gavc",
",",
"final",
"String",
"downLoadUrl",
")",
"{",
"final",
"DbArtifact",
"artifact",
"=",
"getArtifact",
"(",
"gavc",
")",
";",
"repositoryHandler",
".",
"updateDownloadUrl",
"(",
"artifact",
... | Update artifact download url of an artifact
@param gavc String
@param downLoadUrl String | [
"Update",
"artifact",
"download",
"url",
"of",
"an",
"artifact"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java#L212-L215 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newSearchException | public static SearchException newSearchException(String message, Object... args) {
"""
Constructs and initializes a new {@link SearchException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link SearchException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link SearchException} with the given {@link String message}.
@see #newSearchException(Throwable, String, Object...)
@see org.cp.elements.util.search.SearchException
"""
return newSearchException(null, message, args);
} | java | public static SearchException newSearchException(String message, Object... args) {
return newSearchException(null, message, args);
} | [
"public",
"static",
"SearchException",
"newSearchException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newSearchException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link SearchException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link SearchException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link SearchException} with the given {@link String message}.
@see #newSearchException(Throwable, String, Object...)
@see org.cp.elements.util.search.SearchException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"SearchException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L873-L875 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAllAtOrBelow | public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) {
"""
Find all of the nodes with one of the specified types that are at or below this node.
@param typesToFind the types of node to find; may not be null
@return the collection of nodes that are at or below this node that all have one of the supplied types; never null but
possibly empty
"""
return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind);
} | java | public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) {
return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind);
} | [
"public",
"List",
"<",
"PlanNode",
">",
"findAllAtOrBelow",
"(",
"Set",
"<",
"Type",
">",
"typesToFind",
")",
"{",
"return",
"findAllAtOrBelow",
"(",
"Traversal",
".",
"PRE_ORDER",
",",
"typesToFind",
")",
";",
"}"
] | Find all of the nodes with one of the specified types that are at or below this node.
@param typesToFind the types of node to find; may not be null
@return the collection of nodes that are at or below this node that all have one of the supplied types; never null but
possibly empty | [
"Find",
"all",
"of",
"the",
"nodes",
"with",
"one",
"of",
"the",
"specified",
"types",
"that",
"are",
"at",
"or",
"below",
"this",
"node",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1373-L1375 |
casmi/casmi | src/main/java/casmi/util/FileUtil.java | FileUtil.moveFile | public static void moveFile(File src, File dest) throws IOException {
"""
Moves a file from src to dest.
This method is equals to "copy -> delete."
@param src
An existing file to move, must not be <code>null</code>.
@param dest
The destination file, must not be <code>null</code> and exist.
@throws IOException
If moving is failed.
"""
copyFile(src, dest);
if (!delete(src)) {
throw new IOException("Failed to delete the src file '" + src + "' after copying.");
}
} | java | public static void moveFile(File src, File dest) throws IOException {
copyFile(src, dest);
if (!delete(src)) {
throw new IOException("Failed to delete the src file '" + src + "' after copying.");
}
} | [
"public",
"static",
"void",
"moveFile",
"(",
"File",
"src",
",",
"File",
"dest",
")",
"throws",
"IOException",
"{",
"copyFile",
"(",
"src",
",",
"dest",
")",
";",
"if",
"(",
"!",
"delete",
"(",
"src",
")",
")",
"{",
"throw",
"new",
"IOException",
"("... | Moves a file from src to dest.
This method is equals to "copy -> delete."
@param src
An existing file to move, must not be <code>null</code>.
@param dest
The destination file, must not be <code>null</code> and exist.
@throws IOException
If moving is failed. | [
"Moves",
"a",
"file",
"from",
"src",
"to",
"dest",
".",
"This",
"method",
"is",
"equals",
"to",
"copy",
"-",
">",
"delete",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L72-L78 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java | OLAPService.objectQuery | public SearchResultList objectQuery(TableDefinition tableDef, OlapQuery olapQuery) {
"""
Perform an object query on the given table using the given query parameters.
@param tableDef {@link TableDefinition} of table to query.
@param olapQuery {@link OlapQuery} containing query parameters.
@return {@link SearchResultList} containing search results.
"""
checkServiceState();
return m_olap.search(tableDef.getAppDef(), tableDef.getTableName(), olapQuery);
} | java | public SearchResultList objectQuery(TableDefinition tableDef, OlapQuery olapQuery) {
checkServiceState();
return m_olap.search(tableDef.getAppDef(), tableDef.getTableName(), olapQuery);
} | [
"public",
"SearchResultList",
"objectQuery",
"(",
"TableDefinition",
"tableDef",
",",
"OlapQuery",
"olapQuery",
")",
"{",
"checkServiceState",
"(",
")",
";",
"return",
"m_olap",
".",
"search",
"(",
"tableDef",
".",
"getAppDef",
"(",
")",
",",
"tableDef",
".",
... | Perform an object query on the given table using the given query parameters.
@param tableDef {@link TableDefinition} of table to query.
@param olapQuery {@link OlapQuery} containing query parameters.
@return {@link SearchResultList} containing search results. | [
"Perform",
"an",
"object",
"query",
"on",
"the",
"given",
"table",
"using",
"the",
"given",
"query",
"parameters",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L169-L172 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java | TableModel.getIdGenerator | public IdGenerator getIdGenerator(GenerationType generationType, String name) {
"""
Search and return the IdGenerator in this TableModel by its generationType
and name
"""
return getIdGenerator(generationType, name, getIdGenerators());
} | java | public IdGenerator getIdGenerator(GenerationType generationType, String name) {
return getIdGenerator(generationType, name, getIdGenerators());
} | [
"public",
"IdGenerator",
"getIdGenerator",
"(",
"GenerationType",
"generationType",
",",
"String",
"name",
")",
"{",
"return",
"getIdGenerator",
"(",
"generationType",
",",
"name",
",",
"getIdGenerators",
"(",
")",
")",
";",
"}"
] | Search and return the IdGenerator in this TableModel by its generationType
and name | [
"Search",
"and",
"return",
"the",
"IdGenerator",
"in",
"this",
"TableModel",
"by",
"its",
"generationType",
"and",
"name"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java#L420-L422 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java | FileOutputFormat.setOutputPath | public static void setOutputPath(Job job, Path outputDir) {
"""
Set the {@link Path} of the output directory for the map-reduce job.
@param job The job to modify
@param outputDir the {@link Path} of the output directory for
the map-reduce job.
"""
job.getConfiguration().set("mapred.output.dir", outputDir.toString());
} | java | public static void setOutputPath(Job job, Path outputDir) {
job.getConfiguration().set("mapred.output.dir", outputDir.toString());
} | [
"public",
"static",
"void",
"setOutputPath",
"(",
"Job",
"job",
",",
"Path",
"outputDir",
")",
"{",
"job",
".",
"getConfiguration",
"(",
")",
".",
"set",
"(",
"\"mapred.output.dir\"",
",",
"outputDir",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Set the {@link Path} of the output directory for the map-reduce job.
@param job The job to modify
@param outputDir the {@link Path} of the output directory for
the map-reduce job. | [
"Set",
"the",
"{",
"@link",
"Path",
"}",
"of",
"the",
"output",
"directory",
"for",
"the",
"map",
"-",
"reduce",
"job",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java#L135-L137 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.rotateYXZ | public Matrix4x3d rotateYXZ(Vector3d angles) {
"""
Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this
"""
return rotateYXZ(angles.y, angles.x, angles.z);
} | java | public Matrix4x3d rotateYXZ(Vector3d angles) {
return rotateYXZ(angles.y, angles.x, angles.z);
} | [
"public",
"Matrix4x3d",
"rotateYXZ",
"(",
"Vector3d",
"angles",
")",
"{",
"return",
"rotateYXZ",
"(",
"angles",
".",
"y",
",",
"angles",
".",
"x",
",",
"angles",
".",
"z",
")",
";",
"}"
] | Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axi... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L4580-L4582 |
aws/aws-sdk-java | aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/AdminInitiateAuthResult.java | AdminInitiateAuthResult.withChallengeParameters | public AdminInitiateAuthResult withChallengeParameters(java.util.Map<String, String> challengeParameters) {
"""
<p>
The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you need to
pass another challenge. The responses in this parameter should be used to compute inputs to the next call (
<code>AdminRespondToAuthChallenge</code>).
</p>
<p>
All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).
</p>
<p>
The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias (such as
email address or phone number), even if you specified an alias in your call to <code>AdminInitiateAuth</code>.
This is because, in the <code>AdminRespondToAuthChallenge</code> API <code>ChallengeResponses</code>, the
<code>USERNAME</code> attribute cannot be an alias.
</p>
@param challengeParameters
The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you
need to pass another challenge. The responses in this parameter should be used to compute inputs to the
next call (<code>AdminRespondToAuthChallenge</code>).</p>
<p>
All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).
</p>
<p>
The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias
(such as email address or phone number), even if you specified an alias in your call to
<code>AdminInitiateAuth</code>. This is because, in the <code>AdminRespondToAuthChallenge</code> API
<code>ChallengeResponses</code>, the <code>USERNAME</code> attribute cannot be an alias.
@return Returns a reference to this object so that method calls can be chained together.
"""
setChallengeParameters(challengeParameters);
return this;
} | java | public AdminInitiateAuthResult withChallengeParameters(java.util.Map<String, String> challengeParameters) {
setChallengeParameters(challengeParameters);
return this;
} | [
"public",
"AdminInitiateAuthResult",
"withChallengeParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"challengeParameters",
")",
"{",
"setChallengeParameters",
"(",
"challengeParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you need to
pass another challenge. The responses in this parameter should be used to compute inputs to the next call (
<code>AdminRespondToAuthChallenge</code>).
</p>
<p>
All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).
</p>
<p>
The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias (such as
email address or phone number), even if you specified an alias in your call to <code>AdminInitiateAuth</code>.
This is because, in the <code>AdminRespondToAuthChallenge</code> API <code>ChallengeResponses</code>, the
<code>USERNAME</code> attribute cannot be an alias.
</p>
@param challengeParameters
The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you
need to pass another challenge. The responses in this parameter should be used to compute inputs to the
next call (<code>AdminRespondToAuthChallenge</code>).</p>
<p>
All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).
</p>
<p>
The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias
(such as email address or phone number), even if you specified an alias in your call to
<code>AdminInitiateAuth</code>. This is because, in the <code>AdminRespondToAuthChallenge</code> API
<code>ChallengeResponses</code>, the <code>USERNAME</code> attribute cannot be an alias.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"challenge",
"parameters",
".",
"These",
"are",
"returned",
"to",
"you",
"in",
"the",
"<code",
">",
"AdminInitiateAuth<",
"/",
"code",
">",
"response",
"if",
"you",
"need",
"to",
"pass",
"another",
"challenge",
".",
"The",
"responses",
"i... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/AdminInitiateAuthResult.java#L920-L923 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java | DefaultInstalledExtension.isDependency | public static boolean isDependency(Extension extension, String namespace) {
"""
Indicate if the extension as been installed as a dependency of another one.
@param extension the extension
@param namespace the namespace to look at, null indicate the root namespace
@return true if the the extension has been installed only because it was a dependency of another extension
@see InstalledExtension#isDependency(String)
@since 8.2RC1
"""
boolean isDependency = false;
if (namespace == null) {
isDependency = extension.getProperty(PKEY_DEPENDENCY, false);
} else {
Object namespacesObject = extension.getProperty(PKEY_NAMESPACES);
// RETRO-COMPATIBILITY: used to be a String collection with just the actual namespaces
if (namespacesObject instanceof Map) {
Map<String, Object> installedNamespace =
((Map<String, Map<String, Object>>) namespacesObject).get(namespace);
isDependency =
installedNamespace != null ? (installedNamespace.get(PKEY_NAMESPACES_DEPENDENCY) == Boolean.TRUE)
: isDependency(extension, null);
} else {
isDependency = isDependency(extension, null);
}
}
return isDependency;
} | java | public static boolean isDependency(Extension extension, String namespace)
{
boolean isDependency = false;
if (namespace == null) {
isDependency = extension.getProperty(PKEY_DEPENDENCY, false);
} else {
Object namespacesObject = extension.getProperty(PKEY_NAMESPACES);
// RETRO-COMPATIBILITY: used to be a String collection with just the actual namespaces
if (namespacesObject instanceof Map) {
Map<String, Object> installedNamespace =
((Map<String, Map<String, Object>>) namespacesObject).get(namespace);
isDependency =
installedNamespace != null ? (installedNamespace.get(PKEY_NAMESPACES_DEPENDENCY) == Boolean.TRUE)
: isDependency(extension, null);
} else {
isDependency = isDependency(extension, null);
}
}
return isDependency;
} | [
"public",
"static",
"boolean",
"isDependency",
"(",
"Extension",
"extension",
",",
"String",
"namespace",
")",
"{",
"boolean",
"isDependency",
"=",
"false",
";",
"if",
"(",
"namespace",
"==",
"null",
")",
"{",
"isDependency",
"=",
"extension",
".",
"getPropert... | Indicate if the extension as been installed as a dependency of another one.
@param extension the extension
@param namespace the namespace to look at, null indicate the root namespace
@return true if the the extension has been installed only because it was a dependency of another extension
@see InstalledExtension#isDependency(String)
@since 8.2RC1 | [
"Indicate",
"if",
"the",
"extension",
"as",
"been",
"installed",
"as",
"a",
"dependency",
"of",
"another",
"one",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java#L112-L135 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.encodeZeroPadding | public static String encodeZeroPadding(int number, int maxNumDigits) {
"""
Encodes positive integer value into a string by zero-padding number up to the specified
number of digits.
@param number
positive integer to be encoded
@param maxNumDigits
maximum number of digits in the largest value in the data set
@return string representation of the zero-padded integer
"""
String integerString = Integer.toString(number);
int numZeroes = maxNumDigits - integerString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(integerString);
return strBuffer.toString();
} | java | public static String encodeZeroPadding(int number, int maxNumDigits) {
String integerString = Integer.toString(number);
int numZeroes = maxNumDigits - integerString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(integerString);
return strBuffer.toString();
} | [
"public",
"static",
"String",
"encodeZeroPadding",
"(",
"int",
"number",
",",
"int",
"maxNumDigits",
")",
"{",
"String",
"integerString",
"=",
"Integer",
".",
"toString",
"(",
"number",
")",
";",
"int",
"numZeroes",
"=",
"maxNumDigits",
"-",
"integerString",
"... | Encodes positive integer value into a string by zero-padding number up to the specified
number of digits.
@param number
positive integer to be encoded
@param maxNumDigits
maximum number of digits in the largest value in the data set
@return string representation of the zero-padded integer | [
"Encodes",
"positive",
"integer",
"value",
"into",
"a",
"string",
"by",
"zero",
"-",
"padding",
"number",
"up",
"to",
"the",
"specified",
"number",
"of",
"digits",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L43-L52 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.numberTemplate | public static <T extends Number & Comparable<?>> NumberTemplate<T> numberTemplate(Class<? extends T> cl, String template, List<?> args) {
"""
Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression
"""
return numberTemplate(cl, createTemplate(template), args);
} | java | public static <T extends Number & Comparable<?>> NumberTemplate<T> numberTemplate(Class<? extends T> cl, String template, List<?> args) {
return numberTemplate(cl, createTemplate(template), args);
} | [
"public",
"static",
"<",
"T",
"extends",
"Number",
"&",
"Comparable",
"<",
"?",
">",
">",
"NumberTemplate",
"<",
"T",
">",
"numberTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"List",
"<",
"?",
">",
"ar... | Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L836-L838 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImagesFromDataWithServiceResponseAsync | public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) {
"""
Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart
multiple image files can be sent at once, with a maximum of 64 files.
@param projectId The project id
@param imageData the InputStream value
@param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object
"""
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (imageData == null) {
throw new IllegalArgumentException("Parameter imageData is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<String> tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null;
return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds);
} | java | public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (imageData == null) {
throw new IllegalArgumentException("Parameter imageData is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<String> tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null;
return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImageCreateSummary",
">",
">",
"createImagesFromDataWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"CreateImagesFromDataOptionalParameter",
"createImagesFromDataOptionalParamete... | Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart
multiple image files can be sent at once, with a maximum of 64 files.
@param projectId The project id
@param imageData the InputStream value
@param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object | [
"Add",
"the",
"provided",
"images",
"to",
"the",
"set",
"of",
"training",
"images",
".",
"This",
"API",
"accepts",
"body",
"content",
"as",
"multipart",
"/",
"form",
"-",
"data",
"and",
"application",
"/",
"octet",
"-",
"stream",
".",
"When",
"using",
"m... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4154-L4167 |
yangjm/winlet | dao/src/main/java/com/aggrepoint/service/ServiceClassLoader.java | ServiceClassLoader.implementsInterface | public static boolean implementsInterface(Class<?> c, Class<?> i) {
"""
Check whether c implements interface i
@param c
@param i
@return
"""
if (c == i)
return true;
for (Class<?> x : c.getInterfaces())
if (implementsInterface(x, i))
return true;
return false;
} | java | public static boolean implementsInterface(Class<?> c, Class<?> i) {
if (c == i)
return true;
for (Class<?> x : c.getInterfaces())
if (implementsInterface(x, i))
return true;
return false;
} | [
"public",
"static",
"boolean",
"implementsInterface",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"Class",
"<",
"?",
">",
"i",
")",
"{",
"if",
"(",
"c",
"==",
"i",
")",
"return",
"true",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"x",
":",
"c",
".",
... | Check whether c implements interface i
@param c
@param i
@return | [
"Check",
"whether",
"c",
"implements",
"interface",
"i"
] | train | https://github.com/yangjm/winlet/blob/2126236f56858e283fa6ad69fe9279ee30f47b67/dao/src/main/java/com/aggrepoint/service/ServiceClassLoader.java#L108-L117 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.backupKey | public BackupKeyResult backupKey(String vaultBaseUrl, String keyName) {
"""
Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the key/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupKeyResult object if successful.
"""
return backupKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body();
} | java | public BackupKeyResult backupKey(String vaultBaseUrl, String keyName) {
return backupKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body();
} | [
"public",
"BackupKeyResult",
"backupKey",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"backupKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body... | Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the key/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupKeyResult object if successful. | [
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"key",
"be",
"downloaded",
"to",
"the",
"client",
".",
"The",
"Key",
"Backup",
"operation",
"exports",
"a",
"key",
"from",
"Azure",
"Key",
"Vault",
"in",
"a",
"protected",
"form",
".",
"Note",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1965-L1967 |
VoltDB/voltdb | src/frontend/org/voltdb/StoredProcedureInvocation.java | StoredProcedureInvocation.getParameterAtIndex | Object getParameterAtIndex(int partitionIndex) {
"""
Read into an serialized parameter buffer to extract a single parameter
"""
try {
if (serializedParams != null) {
return ParameterSet.getParameterAtIndex(partitionIndex, serializedParams.duplicate());
} else {
return params.get().getParam(partitionIndex);
}
}
catch (Exception ex) {
throw new RuntimeException("Invalid partitionIndex: " + partitionIndex, ex);
}
} | java | Object getParameterAtIndex(int partitionIndex) {
try {
if (serializedParams != null) {
return ParameterSet.getParameterAtIndex(partitionIndex, serializedParams.duplicate());
} else {
return params.get().getParam(partitionIndex);
}
}
catch (Exception ex) {
throw new RuntimeException("Invalid partitionIndex: " + partitionIndex, ex);
}
} | [
"Object",
"getParameterAtIndex",
"(",
"int",
"partitionIndex",
")",
"{",
"try",
"{",
"if",
"(",
"serializedParams",
"!=",
"null",
")",
"{",
"return",
"ParameterSet",
".",
"getParameterAtIndex",
"(",
"partitionIndex",
",",
"serializedParams",
".",
"duplicate",
"(",... | Read into an serialized parameter buffer to extract a single parameter | [
"Read",
"into",
"an",
"serialized",
"parameter",
"buffer",
"to",
"extract",
"a",
"single",
"parameter"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StoredProcedureInvocation.java#L189-L200 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/version_recommendations.java | version_recommendations.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
version_recommendations_responses result = (version_recommendations_responses) service.get_payload_formatter().string_to_resource(version_recommendations_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.version_recommendations_response_array);
}
version_recommendations[] result_version_recommendations = new version_recommendations[result.version_recommendations_response_array.length];
for(int i = 0; i < result.version_recommendations_response_array.length; i++)
{
result_version_recommendations[i] = result.version_recommendations_response_array[i].version_recommendations[0];
}
return result_version_recommendations;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
version_recommendations_responses result = (version_recommendations_responses) service.get_payload_formatter().string_to_resource(version_recommendations_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.version_recommendations_response_array);
}
version_recommendations[] result_version_recommendations = new version_recommendations[result.version_recommendations_response_array.length];
for(int i = 0; i < result.version_recommendations_response_array.length; i++)
{
result_version_recommendations[i] = result.version_recommendations_response_array[i].version_recommendations[0];
}
return result_version_recommendations;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"version_recommendations_responses",
"result",
"=",
"(",
"version_recommendations_responses",
")",
"service",
".... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/version_recommendations.java#L329-L346 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java | RedmineJSONBuilder.toSimpleJSON | public static <T> String toSimpleJSON(String tag, T object,
JsonObjectWriter<T> writer) throws RedmineInternalError {
"""
Converts object to a "simple" json.
@param tag
object tag.
@param object
object to convert.
@param writer
object writer.
@return object String representation.
@throws RedmineInternalError
if conversion fails.
"""
final StringWriter swriter = new StringWriter();
final JSONWriter jsWriter = new JSONWriter(swriter);
try {
jsWriter.object();
jsWriter.key(tag);
jsWriter.object();
writer.write(jsWriter, object);
jsWriter.endObject();
jsWriter.endObject();
} catch (JSONException e) {
throw new RedmineInternalError("Unexpected JSONException", e);
}
return swriter.toString();
} | java | public static <T> String toSimpleJSON(String tag, T object,
JsonObjectWriter<T> writer) throws RedmineInternalError {
final StringWriter swriter = new StringWriter();
final JSONWriter jsWriter = new JSONWriter(swriter);
try {
jsWriter.object();
jsWriter.key(tag);
jsWriter.object();
writer.write(jsWriter, object);
jsWriter.endObject();
jsWriter.endObject();
} catch (JSONException e) {
throw new RedmineInternalError("Unexpected JSONException", e);
}
return swriter.toString();
} | [
"public",
"static",
"<",
"T",
">",
"String",
"toSimpleJSON",
"(",
"String",
"tag",
",",
"T",
"object",
",",
"JsonObjectWriter",
"<",
"T",
">",
"writer",
")",
"throws",
"RedmineInternalError",
"{",
"final",
"StringWriter",
"swriter",
"=",
"new",
"StringWriter",... | Converts object to a "simple" json.
@param tag
object tag.
@param object
object to convert.
@param writer
object writer.
@return object String representation.
@throws RedmineInternalError
if conversion fails. | [
"Converts",
"object",
"to",
"a",
"simple",
"json",
"."
] | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java#L118-L134 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java | MethodIdentifier.getIdentifier | public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) {
"""
Construct a new instance using string names for the return and parameter types.
@param returnType the return type name
@param name the method name
@param parameterTypes the method parameter type names
@return the identifier
"""
return new MethodIdentifier(returnType, name, parameterTypes);
} | java | public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) {
return new MethodIdentifier(returnType, name, parameterTypes);
} | [
"public",
"static",
"MethodIdentifier",
"getIdentifier",
"(",
"final",
"String",
"returnType",
",",
"final",
"String",
"name",
",",
"final",
"String",
"...",
"parameterTypes",
")",
"{",
"return",
"new",
"MethodIdentifier",
"(",
"returnType",
",",
"name",
",",
"p... | Construct a new instance using string names for the return and parameter types.
@param returnType the return type name
@param name the method name
@param parameterTypes the method parameter type names
@return the identifier | [
"Construct",
"a",
"new",
"instance",
"using",
"string",
"names",
"for",
"the",
"return",
"and",
"parameter",
"types",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L231-L233 |
juebanlin/util4j | util4j/src/main/java/net/jueb/util4j/filter/wordsFilter/sd/SensitiveWordFilter.java | SensitiveWordFilter.isContaintSensitiveWord | public boolean isContaintSensitiveWord(String txt,MatchType matchType) {
"""
判断文字是否包含敏感字符
@param txt 文字
@param matchType 匹配规则 1:最小匹配规则,2:最大匹配规则
@return 若包含返回true,否则返回false
@version 1.0
"""
boolean flag = false;
for(int i = 0 ; i < txt.length() ; i++){
int matchFlag = checkSensitiveWord(txt, i, matchType); //判断是否包含敏感字符
if(matchFlag > 0){ //大于0存在,返回true
flag = true;
}
}
return flag;
} | java | public boolean isContaintSensitiveWord(String txt,MatchType matchType){
boolean flag = false;
for(int i = 0 ; i < txt.length() ; i++){
int matchFlag = checkSensitiveWord(txt, i, matchType); //判断是否包含敏感字符
if(matchFlag > 0){ //大于0存在,返回true
flag = true;
}
}
return flag;
} | [
"public",
"boolean",
"isContaintSensitiveWord",
"(",
"String",
"txt",
",",
"MatchType",
"matchType",
")",
"{",
"boolean",
"flag",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"txt",
".",
"length",
"(",
")",
";",
"i",
"++",
")",... | 判断文字是否包含敏感字符
@param txt 文字
@param matchType 匹配规则 1:最小匹配规则,2:最大匹配规则
@return 若包含返回true,否则返回false
@version 1.0 | [
"判断文字是否包含敏感字符"
] | train | https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/filter/wordsFilter/sd/SensitiveWordFilter.java#L49-L58 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeHistogram | void computeHistogram(int c_x, int c_y, double sigma) {
"""
Constructs the histogram around the specified point.
@param c_x Center x-axis
@param c_y Center y-axis
@param sigma Scale of feature, adjusted for local octave
"""
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
// make sure it is contained in the image bounds
BoofMiscOps.boundRectangleInside(rawDX,bound);
// clear the histogram
Arrays.fill(histogramMag,0);
Arrays.fill(histogramX,0);
Arrays.fill(histogramY,0);
// construct the histogram
for( int y = bound.y0; y < bound.y1; y++ ) {
// iterate through the raw array for speed
int indexDX = rawDX.startIndex + y*rawDX.stride + bound.x0;
int indexDY = rawDY.startIndex + y*rawDY.stride + bound.x0;
for( int x = bound.x0; x < bound.x1; x++ ) {
float dx = derivX.getF(indexDX++);
float dy = derivY.getF(indexDY++);
// edge intensity and angle
double magnitude = Math.sqrt(dx*dx + dy*dy);
double theta = UtilAngle.domain2PI(Math.atan2(dy,dx));
// weight from gaussian
double weight = computeWeight( x-c_x, y-c_y , sigma );
// histogram index
int h = (int)(theta / histAngleBin) % histogramMag.length;
// update the histogram
histogramMag[h] += magnitude*weight;
histogramX[h] += dx*weight;
histogramY[h] += dy*weight;
}
}
} | java | void computeHistogram(int c_x, int c_y, double sigma) {
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
// make sure it is contained in the image bounds
BoofMiscOps.boundRectangleInside(rawDX,bound);
// clear the histogram
Arrays.fill(histogramMag,0);
Arrays.fill(histogramX,0);
Arrays.fill(histogramY,0);
// construct the histogram
for( int y = bound.y0; y < bound.y1; y++ ) {
// iterate through the raw array for speed
int indexDX = rawDX.startIndex + y*rawDX.stride + bound.x0;
int indexDY = rawDY.startIndex + y*rawDY.stride + bound.x0;
for( int x = bound.x0; x < bound.x1; x++ ) {
float dx = derivX.getF(indexDX++);
float dy = derivY.getF(indexDY++);
// edge intensity and angle
double magnitude = Math.sqrt(dx*dx + dy*dy);
double theta = UtilAngle.domain2PI(Math.atan2(dy,dx));
// weight from gaussian
double weight = computeWeight( x-c_x, y-c_y , sigma );
// histogram index
int h = (int)(theta / histAngleBin) % histogramMag.length;
// update the histogram
histogramMag[h] += magnitude*weight;
histogramX[h] += dx*weight;
histogramY[h] += dy*weight;
}
}
} | [
"void",
"computeHistogram",
"(",
"int",
"c_x",
",",
"int",
"c_y",
",",
"double",
"sigma",
")",
"{",
"int",
"r",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"sigma",
"*",
"sigmaEnlarge",
")",
";",
"// specify the area being sampled",
"bound",
".",
"x0... | Constructs the histogram around the specified point.
@param c_x Center x-axis
@param c_y Center y-axis
@param sigma Scale of feature, adjusted for local octave | [
"Constructs",
"the",
"histogram",
"around",
"the",
"specified",
"point",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L155-L201 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.illegalStateIf | public static void illegalStateIf(boolean tester, String msg, Object... args) {
"""
Throws out an {@link IllegalStateException} with error message specified
if `tester` is `true`.
@param tester
when `true` then throw out the exception.
@param msg
the error message format pattern.
@param args
the error message format arguments.
"""
if (tester) {
throw new IllegalStateException(S.fmt(msg, args));
}
} | java | public static void illegalStateIf(boolean tester, String msg, Object... args) {
if (tester) {
throw new IllegalStateException(S.fmt(msg, args));
}
} | [
"public",
"static",
"void",
"illegalStateIf",
"(",
"boolean",
"tester",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"tester",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"S",
".",
"fmt",
"(",
"msg",
",",
"args",
... | Throws out an {@link IllegalStateException} with error message specified
if `tester` is `true`.
@param tester
when `true` then throw out the exception.
@param msg
the error message format pattern.
@param args
the error message format arguments. | [
"Throws",
"out",
"an",
"{",
"@link",
"IllegalStateException",
"}",
"with",
"error",
"message",
"specified",
"if",
"tester",
"is",
"true",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L783-L787 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.exceptionCaught | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
"""
Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other exceptions.
"""
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onError(ctx, false, cause);
} else {
super.exceptionCaught(ctx, cause);
}
} | java | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onError(ctx, false, cause);
} else {
super.exceptionCaught(ctx, cause);
}
} | [
"@",
"Override",
"public",
"void",
"exceptionCaught",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"if",
"(",
"getEmbeddedHttp2Exception",
"(",
"cause",
")",
"!=",
"null",
")",
"{",
"// Some exception in the causal... | Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other exceptions. | [
"Handles",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L553-L561 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java | SearchManager.setOnline | public void setOnline(boolean isOnline, boolean allowQuery, boolean dropStaleIndexes) throws IOException {
"""
Switches index into corresponding ONLINE or OFFLINE mode. Offline mode means that new indexing data is
collected but index is guaranteed to be unmodified during offline state. Passing the allowQuery flag, can
allow or deny performing queries on index during offline mode. AllowQuery is not used when setting index
back online. When dropStaleIndexes is set, indexes present on the moment of switching index offline will be
marked as stale and removed on switching it back online.
@param isOnline
@param allowQuery
doesn't matter, when switching index to online
@param dropStaleIndexes
doesn't matter, when switching index to online
@throws IOException
"""
handler.setOnline(isOnline, allowQuery, dropStaleIndexes);
} | java | public void setOnline(boolean isOnline, boolean allowQuery, boolean dropStaleIndexes) throws IOException
{
handler.setOnline(isOnline, allowQuery, dropStaleIndexes);
} | [
"public",
"void",
"setOnline",
"(",
"boolean",
"isOnline",
",",
"boolean",
"allowQuery",
",",
"boolean",
"dropStaleIndexes",
")",
"throws",
"IOException",
"{",
"handler",
".",
"setOnline",
"(",
"isOnline",
",",
"allowQuery",
",",
"dropStaleIndexes",
")",
";",
"}... | Switches index into corresponding ONLINE or OFFLINE mode. Offline mode means that new indexing data is
collected but index is guaranteed to be unmodified during offline state. Passing the allowQuery flag, can
allow or deny performing queries on index during offline mode. AllowQuery is not used when setting index
back online. When dropStaleIndexes is set, indexes present on the moment of switching index offline will be
marked as stale and removed on switching it back online.
@param isOnline
@param allowQuery
doesn't matter, when switching index to online
@param dropStaleIndexes
doesn't matter, when switching index to online
@throws IOException | [
"Switches",
"index",
"into",
"corresponding",
"ONLINE",
"or",
"OFFLINE",
"mode",
".",
"Offline",
"mode",
"means",
"that",
"new",
"indexing",
"data",
"is",
"collected",
"but",
"index",
"is",
"guaranteed",
"to",
"be",
"unmodified",
"during",
"offline",
"state",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java#L1201-L1204 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java | Log.logError | public void logError(String message, Exception exception) {
"""
Prints error info to the current errorLog
@param message The message to log
@param exception An Exception
"""
if (!(logError || globalLog.logError))
return;
if (errorLog != null)
log(errorLog, "ERROR", owner, message, exception);
else
log(globalLog.errorLog, "ERROR", owner, message, exception);
} | java | public void logError(String message, Exception exception) {
if (!(logError || globalLog.logError))
return;
if (errorLog != null)
log(errorLog, "ERROR", owner, message, exception);
else
log(globalLog.errorLog, "ERROR", owner, message, exception);
} | [
"public",
"void",
"logError",
"(",
"String",
"message",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"!",
"(",
"logError",
"||",
"globalLog",
".",
"logError",
")",
")",
"return",
";",
"if",
"(",
"errorLog",
"!=",
"null",
")",
"log",
"(",
"errorL... | Prints error info to the current errorLog
@param message The message to log
@param exception An Exception | [
"Prints",
"error",
"info",
"to",
"the",
"current",
"errorLog"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java#L488-L496 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.homepageGet | public static HomePageGetResult homepageGet(String accessToken, ShopInfo shopInfo) {
"""
商家主页管理-查询商家主页
@param accessToken accessToken
@param shopInfo shopInfo
@return HomePageGetResult
"""
return homepageGet(accessToken, JsonUtil.toJSONString(shopInfo));
} | java | public static HomePageGetResult homepageGet(String accessToken, ShopInfo shopInfo) {
return homepageGet(accessToken, JsonUtil.toJSONString(shopInfo));
} | [
"public",
"static",
"HomePageGetResult",
"homepageGet",
"(",
"String",
"accessToken",
",",
"ShopInfo",
"shopInfo",
")",
"{",
"return",
"homepageGet",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopInfo",
")",
")",
";",
"}"
] | 商家主页管理-查询商家主页
@param accessToken accessToken
@param shopInfo shopInfo
@return HomePageGetResult | [
"商家主页管理",
"-",
"查询商家主页"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L477-L479 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.backendHealth | public ApplicationGatewayBackendHealthInner backendHealth(String resourceGroupName, String applicationGatewayName) {
"""
Gets the backend health of the specified application gateway in a resource group.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@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 ApplicationGatewayBackendHealthInner object if successful.
"""
return backendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body();
} | java | public ApplicationGatewayBackendHealthInner backendHealth(String resourceGroupName, String applicationGatewayName) {
return backendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body();
} | [
"public",
"ApplicationGatewayBackendHealthInner",
"backendHealth",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
")",
"{",
"return",
"backendHealthWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"applicationGatewayName",
")",
".",
"toBlo... | Gets the backend health of the specified application gateway in a resource group.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@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 ApplicationGatewayBackendHealthInner object if successful. | [
"Gets",
"the",
"backend",
"health",
"of",
"the",
"specified",
"application",
"gateway",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L1405-L1407 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/LinearSGD.java | LinearSGD.setLambda1 | public void setLambda1(double lambda1) {
"""
λ<sub>1</sub> controls the L<sub>1</sub> regularization penalty.
@param lambda1 the L<sub>1</sub> regularization penalty to use
"""
if(lambda1 < 0 || Double.isNaN(lambda1) || Double.isInfinite(lambda1))
throw new IllegalArgumentException("Lambda1 must be non-negative, not " + lambda1);
this.lambda1 = lambda1;
} | java | public void setLambda1(double lambda1)
{
if(lambda1 < 0 || Double.isNaN(lambda1) || Double.isInfinite(lambda1))
throw new IllegalArgumentException("Lambda1 must be non-negative, not " + lambda1);
this.lambda1 = lambda1;
} | [
"public",
"void",
"setLambda1",
"(",
"double",
"lambda1",
")",
"{",
"if",
"(",
"lambda1",
"<",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"lambda1",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"lambda1",
")",
")",
"throw",
"new",
"IllegalArgumentException",
... | λ<sub>1</sub> controls the L<sub>1</sub> regularization penalty.
@param lambda1 the L<sub>1</sub> regularization penalty to use | [
"&lambda",
";",
"<sub",
">",
"1<",
"/",
"sub",
">",
"controls",
"the",
"L<sub",
">",
"1<",
"/",
"sub",
">",
"regularization",
"penalty",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/LinearSGD.java#L259-L264 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java | CustomFunctions.join | @SuppressWarnings( {
"""
配列の値を結合する。
@param array 結合対象の配列
@param delimiter 区切り文字
@param printer 配列の要素の値のフォーマッタ
@return 結合した文字列を返す。結合の対象の配列がnulの場合、空文字を返す。
@throws NullPointerException {@literal printer is null.}
""""rawtypes", "unchecked"})
public static String join(final Object[] array, final String delimiter, final TextPrinter printer) {
Objects.requireNonNull(printer);
if(array == null || array.length == 0) {
return "";
}
String value = Arrays.stream(array)
.map(v -> printer.print(v))
.collect(Collectors.joining(defaultString(delimiter)));
return value;
} | java | @SuppressWarnings({"rawtypes", "unchecked"})
public static String join(final Object[] array, final String delimiter, final TextPrinter printer) {
Objects.requireNonNull(printer);
if(array == null || array.length == 0) {
return "";
}
String value = Arrays.stream(array)
.map(v -> printer.print(v))
.collect(Collectors.joining(defaultString(delimiter)));
return value;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"static",
"String",
"join",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"String",
"delimiter",
",",
"final",
"TextPrinter",
"printer",
")",
"{",
"Object... | 配列の値を結合する。
@param array 結合対象の配列
@param delimiter 区切り文字
@param printer 配列の要素の値のフォーマッタ
@return 結合した文字列を返す。結合の対象の配列がnulの場合、空文字を返す。
@throws NullPointerException {@literal printer is null.} | [
"配列の値を結合する。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java#L85-L99 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java | HtmlSerialFieldWriter.getSerializableFields | public Content getSerializableFields(String heading, Content serializableFieldsTree) {
"""
Add serializable fields.
@param heading the heading for the section
@param serializableFieldsTree the tree to be added to the serializable fileds
content tree
@return a content tree for the serializable fields content
"""
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (serializableFieldsTree.isValid()) {
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
li.addContent(serialHeading);
li.addContent(serializableFieldsTree);
}
return li;
} | java | public Content getSerializableFields(String heading, Content serializableFieldsTree) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (serializableFieldsTree.isValid()) {
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
li.addContent(serialHeading);
li.addContent(serializableFieldsTree);
}
return li;
} | [
"public",
"Content",
"getSerializableFields",
"(",
"String",
"heading",
",",
"Content",
"serializableFieldsTree",
")",
"{",
"HtmlTree",
"li",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"LI",
")",
";",
"li",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"blockList"... | Add serializable fields.
@param heading the heading for the section
@param serializableFieldsTree the tree to be added to the serializable fileds
content tree
@return a content tree for the serializable fields content | [
"Add",
"serializable",
"fields",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java#L96-L107 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/user/Group.java | Group.getWithJAASKey | public static Group getWithJAASKey(final JAASSystem _jaasSystem,
final String _jaasKey)
throws EFapsException {
"""
Returns for given parameter <i>_jaasKey</i> the instance of class
{@link Group}. The parameter <i>_jaasKey</i> is the name of the group
used in the given JAAS system for the group.
@param _jaasSystem JAAS system for which the JAAS key is named
@param _jaasKey key in the foreign JAAS system for which the group
is searched
@return instance of class {@link Group}, or <code>null</code> if group
is not found
@throws EFapsException if group with JAAS key could not be fetched from
eFaps
@see #get(long)
"""
long groupId = 0;
Connection con = null;
try {
con = Context.getConnection();
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(Group.SQL_JAASKEY);
stmt.setObject(1, _jaasKey);
stmt.setObject(2, _jaasSystem.getId());
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
groupId = rs.getLong(1);
}
rs.close();
} catch (final SQLException e) {
Group.LOG.error("search for group for JAAS system '" + _jaasSystem.getName() + "' "
+ "with key '" + _jaasKey + "' is not possible", e);
throw new EFapsException(Group.class, "getWithJAASKey.SQLException", e,
_jaasSystem.getName(), _jaasKey);
} finally {
try {
stmt.close();
con.commit();
} catch (final SQLException e) {
Group.LOG.error("Statement could not be closed", e);
}
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
return Group.get(groupId);
} | java | public static Group getWithJAASKey(final JAASSystem _jaasSystem,
final String _jaasKey)
throws EFapsException
{
long groupId = 0;
Connection con = null;
try {
con = Context.getConnection();
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(Group.SQL_JAASKEY);
stmt.setObject(1, _jaasKey);
stmt.setObject(2, _jaasSystem.getId());
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
groupId = rs.getLong(1);
}
rs.close();
} catch (final SQLException e) {
Group.LOG.error("search for group for JAAS system '" + _jaasSystem.getName() + "' "
+ "with key '" + _jaasKey + "' is not possible", e);
throw new EFapsException(Group.class, "getWithJAASKey.SQLException", e,
_jaasSystem.getName(), _jaasKey);
} finally {
try {
stmt.close();
con.commit();
} catch (final SQLException e) {
Group.LOG.error("Statement could not be closed", e);
}
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
return Group.get(groupId);
} | [
"public",
"static",
"Group",
"getWithJAASKey",
"(",
"final",
"JAASSystem",
"_jaasSystem",
",",
"final",
"String",
"_jaasKey",
")",
"throws",
"EFapsException",
"{",
"long",
"groupId",
"=",
"0",
";",
"Connection",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=... | Returns for given parameter <i>_jaasKey</i> the instance of class
{@link Group}. The parameter <i>_jaasKey</i> is the name of the group
used in the given JAAS system for the group.
@param _jaasSystem JAAS system for which the JAAS key is named
@param _jaasKey key in the foreign JAAS system for which the group
is searched
@return instance of class {@link Group}, or <code>null</code> if group
is not found
@throws EFapsException if group with JAAS key could not be fetched from
eFaps
@see #get(long) | [
"Returns",
"for",
"given",
"parameter",
"<i",
">",
"_jaasKey<",
"/",
"i",
">",
"the",
"instance",
"of",
"class",
"{",
"@link",
"Group",
"}",
".",
"The",
"parameter",
"<i",
">",
"_jaasKey<",
"/",
"i",
">",
"is",
"the",
"name",
"of",
"the",
"group",
"u... | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/Group.java#L284-L326 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java | _SharedRendererUtils.log | private static void log(FacesContext context, String msg, Exception e) {
"""
This method is different in the two versions of _SharedRendererUtils.
"""
log.log(Level.SEVERE, msg, e);
} | java | private static void log(FacesContext context, String msg, Exception e)
{
log.log(Level.SEVERE, msg, e);
} | [
"private",
"static",
"void",
"log",
"(",
"FacesContext",
"context",
",",
"String",
"msg",
",",
"Exception",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"msg",
",",
"e",
")",
";",
"}"
] | This method is different in the two versions of _SharedRendererUtils. | [
"This",
"method",
"is",
"different",
"in",
"the",
"two",
"versions",
"of",
"_SharedRendererUtils",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java#L499-L502 |
alkacon/opencms-core | src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java | CmsPublishDialog.showPublishDialog | public static void showPublishDialog(
CmsPublishData result,
CloseHandler<PopupPanel> handler,
Runnable refreshAction,
I_CmsContentEditorHandler editorHandler) {
"""
Shows the publish dialog.<p>
@param result the publish data
@param handler the dialog close handler (may be null)
@param refreshAction the action to execute on a context menu triggered refresh
@param editorHandler the content editor handler (may be null)
"""
CmsPublishDialog publishDialog = new CmsPublishDialog(result, refreshAction, editorHandler);
if (handler != null) {
publishDialog.addCloseHandler(handler);
}
publishDialog.centerHorizontally(50);
// replace current notification widget by overlay
publishDialog.catchNotifications();
} | java | public static void showPublishDialog(
CmsPublishData result,
CloseHandler<PopupPanel> handler,
Runnable refreshAction,
I_CmsContentEditorHandler editorHandler) {
CmsPublishDialog publishDialog = new CmsPublishDialog(result, refreshAction, editorHandler);
if (handler != null) {
publishDialog.addCloseHandler(handler);
}
publishDialog.centerHorizontally(50);
// replace current notification widget by overlay
publishDialog.catchNotifications();
} | [
"public",
"static",
"void",
"showPublishDialog",
"(",
"CmsPublishData",
"result",
",",
"CloseHandler",
"<",
"PopupPanel",
">",
"handler",
",",
"Runnable",
"refreshAction",
",",
"I_CmsContentEditorHandler",
"editorHandler",
")",
"{",
"CmsPublishDialog",
"publishDialog",
... | Shows the publish dialog.<p>
@param result the publish data
@param handler the dialog close handler (may be null)
@param refreshAction the action to execute on a context menu triggered refresh
@param editorHandler the content editor handler (may be null) | [
"Shows",
"the",
"publish",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java#L291-L304 |
hdecarne/java-default | src/main/java/de/carne/io/IOUtil.java | IOUtil.copyStream | public static long copyStream(OutputStream dst, InputStream src) throws IOException {
"""
Copies all bytes from an {@linkplain InputStream} to an {@linkplain OutputStream}.
@param dst the {@linkplain OutputStream} to copy to.
@param src the {@linkplain InputStream} to copy from.
@return the number of copied bytes.
@throws IOException if an I/O error occurs.
"""
long copied;
if (dst instanceof FileOutputStream && src instanceof FileInputStream) {
try (FileChannel dstChannel = ((FileOutputStream) dst).getChannel();
FileChannel srcChannel = ((FileInputStream) src).getChannel()) {
copied = copyStreamChannel(dstChannel, srcChannel);
}
} else {
copied = copyStreamStandard(dst, src);
}
return copied;
} | java | public static long copyStream(OutputStream dst, InputStream src) throws IOException {
long copied;
if (dst instanceof FileOutputStream && src instanceof FileInputStream) {
try (FileChannel dstChannel = ((FileOutputStream) dst).getChannel();
FileChannel srcChannel = ((FileInputStream) src).getChannel()) {
copied = copyStreamChannel(dstChannel, srcChannel);
}
} else {
copied = copyStreamStandard(dst, src);
}
return copied;
} | [
"public",
"static",
"long",
"copyStream",
"(",
"OutputStream",
"dst",
",",
"InputStream",
"src",
")",
"throws",
"IOException",
"{",
"long",
"copied",
";",
"if",
"(",
"dst",
"instanceof",
"FileOutputStream",
"&&",
"src",
"instanceof",
"FileInputStream",
")",
"{",... | Copies all bytes from an {@linkplain InputStream} to an {@linkplain OutputStream}.
@param dst the {@linkplain OutputStream} to copy to.
@param src the {@linkplain InputStream} to copy from.
@return the number of copied bytes.
@throws IOException if an I/O error occurs. | [
"Copies",
"all",
"bytes",
"from",
"an",
"{",
"@linkplain",
"InputStream",
"}",
"to",
"an",
"{",
"@linkplain",
"OutputStream",
"}",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/io/IOUtil.java#L53-L65 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java | XMLUnit.compareXML | public static Diff compareXML(String control, Reader test)
throws SAXException, IOException {
"""
Compare XML documents provided by two Reader classes
@param control Control document
@param test Document to test
@return Diff object describing differences in documents
@throws SAXException
@throws IOException
"""
return new Diff(new StringReader(control), test);
} | java | public static Diff compareXML(String control, Reader test)
throws SAXException, IOException {
return new Diff(new StringReader(control), test);
} | [
"public",
"static",
"Diff",
"compareXML",
"(",
"String",
"control",
",",
"Reader",
"test",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"return",
"new",
"Diff",
"(",
"new",
"StringReader",
"(",
"control",
")",
",",
"test",
")",
";",
"}"
] | Compare XML documents provided by two Reader classes
@param control Control document
@param test Document to test
@return Diff object describing differences in documents
@throws SAXException
@throws IOException | [
"Compare",
"XML",
"documents",
"provided",
"by",
"two",
"Reader",
"classes"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java#L593-L596 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_game_ipOnGame_rule_id_GET | public OvhGameMitigationRule ip_game_ipOnGame_rule_id_GET(String ip, String ipOnGame, Long id) throws IOException {
"""
Get this object properties
REST: GET /ip/{ip}/game/{ipOnGame}/rule/{id}
@param ip [required]
@param ipOnGame [required]
@param id [required] ID of the rule
"""
String qPath = "/ip/{ip}/game/{ipOnGame}/rule/{id}";
StringBuilder sb = path(qPath, ip, ipOnGame, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGameMitigationRule.class);
} | java | public OvhGameMitigationRule ip_game_ipOnGame_rule_id_GET(String ip, String ipOnGame, Long id) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}/rule/{id}";
StringBuilder sb = path(qPath, ip, ipOnGame, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGameMitigationRule.class);
} | [
"public",
"OvhGameMitigationRule",
"ip_game_ipOnGame_rule_id_GET",
"(",
"String",
"ip",
",",
"String",
"ipOnGame",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/game/{ipOnGame}/rule/{id}\"",
";",
"StringBuilder",
"sb",
"=",
... | Get this object properties
REST: GET /ip/{ip}/game/{ipOnGame}/rule/{id}
@param ip [required]
@param ipOnGame [required]
@param id [required] ID of the rule | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L329-L334 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java | DirectedGraph.containsBoth | private boolean containsBoth(N a, N b) {
"""
Returns true if both <tt>a</tt> and <tt>b</tt> are nodes in the graph
@param a the first value to check for
@param b the second value to check for
@return true if both <tt>a</tt> and <tt>b</tt> are in the graph, false otherwise
"""
return nodes.containsKey(a) && nodes.containsKey(b);
} | java | private boolean containsBoth(N a, N b)
{
return nodes.containsKey(a) && nodes.containsKey(b);
} | [
"private",
"boolean",
"containsBoth",
"(",
"N",
"a",
",",
"N",
"b",
")",
"{",
"return",
"nodes",
".",
"containsKey",
"(",
"a",
")",
"&&",
"nodes",
".",
"containsKey",
"(",
"b",
")",
";",
"}"
] | Returns true if both <tt>a</tt> and <tt>b</tt> are nodes in the graph
@param a the first value to check for
@param b the second value to check for
@return true if both <tt>a</tt> and <tt>b</tt> are in the graph, false otherwise | [
"Returns",
"true",
"if",
"both",
"<tt",
">",
"a<",
"/",
"tt",
">",
"and",
"<tt",
">",
"b<",
"/",
"tt",
">",
"are",
"nodes",
"in",
"the",
"graph"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L165-L168 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.saveFile | public static void saveFile(String path, String content) throws IOException {
"""
保存文件,覆盖原内容
@param path 文件路径
@param content 内容
@throws IOException 异常
"""
saveFile(path, content, false);
} | java | public static void saveFile(String path, String content) throws IOException {
saveFile(path, content, false);
} | [
"public",
"static",
"void",
"saveFile",
"(",
"String",
"path",
",",
"String",
"content",
")",
"throws",
"IOException",
"{",
"saveFile",
"(",
"path",
",",
"content",
",",
"false",
")",
";",
"}"
] | 保存文件,覆盖原内容
@param path 文件路径
@param content 内容
@throws IOException 异常 | [
"保存文件,覆盖原内容"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L870-L872 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java | ComponentFactory.newEmailTextField | public static EmailTextField newEmailTextField(final String id, final IModel<String> model) {
"""
Factory method for create a new {@link EmailTextField}.
@param id
the id
@param model
the model
@return the new {@link EmailTextField}.
"""
final EmailTextField emailTextField = new EmailTextField(id, model);
emailTextField.setOutputMarkupId(true);
return emailTextField;
} | java | public static EmailTextField newEmailTextField(final String id, final IModel<String> model)
{
final EmailTextField emailTextField = new EmailTextField(id, model);
emailTextField.setOutputMarkupId(true);
return emailTextField;
} | [
"public",
"static",
"EmailTextField",
"newEmailTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"String",
">",
"model",
")",
"{",
"final",
"EmailTextField",
"emailTextField",
"=",
"new",
"EmailTextField",
"(",
"id",
",",
"model",
")",
";"... | Factory method for create a new {@link EmailTextField}.
@param id
the id
@param model
the model
@return the new {@link EmailTextField}. | [
"Factory",
"method",
"for",
"create",
"a",
"new",
"{",
"@link",
"EmailTextField",
"}",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L219-L224 |
pac4j/pac4j | pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java | SAML2AuthnResponseValidator.validateAssertionConditions | protected final void validateAssertionConditions(final Conditions conditions, final SAML2MessageContext context) {
"""
Validate assertionConditions
- notBefore
- notOnOrAfter
@param conditions the conditions
@param context the context
"""
if (conditions == null) {
return;
}
if (conditions.getNotBefore() != null && conditions.getNotBefore().minusSeconds(acceptedSkew).isAfterNow()) {
throw new SAMLAssertionConditionException("Assertion condition notBefore is not valid");
}
if (conditions.getNotOnOrAfter() != null && conditions.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) {
throw new SAMLAssertionConditionException("Assertion condition notOnOrAfter is not valid");
}
final String entityId = context.getSAMLSelfEntityContext().getEntityId();
validateAudienceRestrictions(conditions.getAudienceRestrictions(), entityId);
} | java | protected final void validateAssertionConditions(final Conditions conditions, final SAML2MessageContext context) {
if (conditions == null) {
return;
}
if (conditions.getNotBefore() != null && conditions.getNotBefore().minusSeconds(acceptedSkew).isAfterNow()) {
throw new SAMLAssertionConditionException("Assertion condition notBefore is not valid");
}
if (conditions.getNotOnOrAfter() != null && conditions.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) {
throw new SAMLAssertionConditionException("Assertion condition notOnOrAfter is not valid");
}
final String entityId = context.getSAMLSelfEntityContext().getEntityId();
validateAudienceRestrictions(conditions.getAudienceRestrictions(), entityId);
} | [
"protected",
"final",
"void",
"validateAssertionConditions",
"(",
"final",
"Conditions",
"conditions",
",",
"final",
"SAML2MessageContext",
"context",
")",
"{",
"if",
"(",
"conditions",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"conditions",
".",
... | Validate assertionConditions
- notBefore
- notOnOrAfter
@param conditions the conditions
@param context the context | [
"Validate",
"assertionConditions",
"-",
"notBefore",
"-",
"notOnOrAfter"
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java#L478-L494 |
valfirst/jbehave-junit-runner | src/main/java/com/github/valfirst/jbehave/junit/monitoring/JUnitScenarioReporter.java | JUnitScenarioReporter.scenarioNotAllowed | @Override
public void scenarioNotAllowed(Scenario scenario, String filter) {
"""
Notify the IDE that the current step and scenario is not being executed.
Reason is a JBehave meta tag is filtering out this scenario.
@param scenario Scenario
@param filter Filter
"""
TestState testState = this.testState.get();
notifier.fireTestIgnored(testState.currentStep);
notifier.fireTestIgnored(testState.currentScenario);
} | java | @Override
public void scenarioNotAllowed(Scenario scenario, String filter) {
TestState testState = this.testState.get();
notifier.fireTestIgnored(testState.currentStep);
notifier.fireTestIgnored(testState.currentScenario);
} | [
"@",
"Override",
"public",
"void",
"scenarioNotAllowed",
"(",
"Scenario",
"scenario",
",",
"String",
"filter",
")",
"{",
"TestState",
"testState",
"=",
"this",
".",
"testState",
".",
"get",
"(",
")",
";",
"notifier",
".",
"fireTestIgnored",
"(",
"testState",
... | Notify the IDE that the current step and scenario is not being executed.
Reason is a JBehave meta tag is filtering out this scenario.
@param scenario Scenario
@param filter Filter | [
"Notify",
"the",
"IDE",
"that",
"the",
"current",
"step",
"and",
"scenario",
"is",
"not",
"being",
"executed",
".",
"Reason",
"is",
"a",
"JBehave",
"meta",
"tag",
"is",
"filtering",
"out",
"this",
"scenario",
"."
] | train | https://github.com/valfirst/jbehave-junit-runner/blob/01500b5e8448a9c36fcb9269aaea8690ac028939/src/main/java/com/github/valfirst/jbehave/junit/monitoring/JUnitScenarioReporter.java#L349-L354 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java | JMElasticsearchBulk.buildBulkProcessor | public BulkProcessor buildBulkProcessor(Listener bulkProcessorListener,
int bulkActions, long bulkSizeKB, int flushIntervalSeconds,
Integer concurrentRequests, BackoffPolicy backoffPolicy) {
"""
Build bulk processor bulk processor.
@param bulkProcessorListener the bulk processor listener
@param bulkActions the bulk actions
@param bulkSizeKB the bulk size kb
@param flushIntervalSeconds the flush interval seconds
@param concurrentRequests the concurrent requests
@param backoffPolicy the backoff policy
@return the bulk processor
"""
return getBulkProcessorBuilder(bulkProcessorListener, bulkActions,
new ByteSizeValue(bulkSizeKB, ByteSizeUnit.KB),
TimeValue.timeValueSeconds(flushIntervalSeconds),
concurrentRequests, backoffPolicy).build();
} | java | public BulkProcessor buildBulkProcessor(Listener bulkProcessorListener,
int bulkActions, long bulkSizeKB, int flushIntervalSeconds,
Integer concurrentRequests, BackoffPolicy backoffPolicy) {
return getBulkProcessorBuilder(bulkProcessorListener, bulkActions,
new ByteSizeValue(bulkSizeKB, ByteSizeUnit.KB),
TimeValue.timeValueSeconds(flushIntervalSeconds),
concurrentRequests, backoffPolicy).build();
} | [
"public",
"BulkProcessor",
"buildBulkProcessor",
"(",
"Listener",
"bulkProcessorListener",
",",
"int",
"bulkActions",
",",
"long",
"bulkSizeKB",
",",
"int",
"flushIntervalSeconds",
",",
"Integer",
"concurrentRequests",
",",
"BackoffPolicy",
"backoffPolicy",
")",
"{",
"r... | Build bulk processor bulk processor.
@param bulkProcessorListener the bulk processor listener
@param bulkActions the bulk actions
@param bulkSizeKB the bulk size kb
@param flushIntervalSeconds the flush interval seconds
@param concurrentRequests the concurrent requests
@param backoffPolicy the backoff policy
@return the bulk processor | [
"Build",
"bulk",
"processor",
"bulk",
"processor",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L162-L169 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/Project.java | Project.addWorkingDir | public boolean addWorkingDir(String dirName) {
"""
Add a working directory to the project.
@param dirName
the directory to add
@return true if the working directory was added, or false if the working
directory was already present
"""
if (dirName == null) {
throw new NullPointerException();
}
return addToListInternal(currentWorkingDirectoryList, new File(dirName));
} | java | public boolean addWorkingDir(String dirName) {
if (dirName == null) {
throw new NullPointerException();
}
return addToListInternal(currentWorkingDirectoryList, new File(dirName));
} | [
"public",
"boolean",
"addWorkingDir",
"(",
"String",
"dirName",
")",
"{",
"if",
"(",
"dirName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"return",
"addToListInternal",
"(",
"currentWorkingDirectoryList",
",",
"new",
"... | Add a working directory to the project.
@param dirName
the directory to add
@return true if the working directory was added, or false if the working
directory was already present | [
"Add",
"a",
"working",
"directory",
"to",
"the",
"project",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/Project.java#L292-L297 |
rometools/rome | rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java | MediaModuleGenerator.generateThumbails | private void generateThumbails(final Metadata m, final Element e) {
"""
Generation of thumbnail tags.
@param m source
@param e element to attach new element to
"""
for (final Thumbnail thumb : m.getThumbnail()) {
final Element t = new Element("thumbnail", NS);
addNotNullAttribute(t, "url", thumb.getUrl());
addNotNullAttribute(t, "width", thumb.getWidth());
addNotNullAttribute(t, "height", thumb.getHeight());
addNotNullAttribute(t, "time", thumb.getTime());
e.addContent(t);
}
} | java | private void generateThumbails(final Metadata m, final Element e) {
for (final Thumbnail thumb : m.getThumbnail()) {
final Element t = new Element("thumbnail", NS);
addNotNullAttribute(t, "url", thumb.getUrl());
addNotNullAttribute(t, "width", thumb.getWidth());
addNotNullAttribute(t, "height", thumb.getHeight());
addNotNullAttribute(t, "time", thumb.getTime());
e.addContent(t);
}
} | [
"private",
"void",
"generateThumbails",
"(",
"final",
"Metadata",
"m",
",",
"final",
"Element",
"e",
")",
"{",
"for",
"(",
"final",
"Thumbnail",
"thumb",
":",
"m",
".",
"getThumbnail",
"(",
")",
")",
"{",
"final",
"Element",
"t",
"=",
"new",
"Element",
... | Generation of thumbnail tags.
@param m source
@param e element to attach new element to | [
"Generation",
"of",
"thumbnail",
"tags",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L243-L252 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPConnection.java | RTMPConnection.customizeStream | private void customizeStream(Number streamId, AbstractClientStream stream) {
"""
Specify name, connection, scope and etc for stream
@param streamId
Stream id
@param stream
Stream
"""
Integer buffer = streamBuffers.get(streamId.doubleValue());
if (buffer != null) {
stream.setClientBufferDuration(buffer);
}
stream.setName(createStreamName());
stream.setConnection(this);
stream.setScope(this.getScope());
stream.setStreamId(streamId);
} | java | private void customizeStream(Number streamId, AbstractClientStream stream) {
Integer buffer = streamBuffers.get(streamId.doubleValue());
if (buffer != null) {
stream.setClientBufferDuration(buffer);
}
stream.setName(createStreamName());
stream.setConnection(this);
stream.setScope(this.getScope());
stream.setStreamId(streamId);
} | [
"private",
"void",
"customizeStream",
"(",
"Number",
"streamId",
",",
"AbstractClientStream",
"stream",
")",
"{",
"Integer",
"buffer",
"=",
"streamBuffers",
".",
"get",
"(",
"streamId",
".",
"doubleValue",
"(",
")",
")",
";",
"if",
"(",
"buffer",
"!=",
"null... | Specify name, connection, scope and etc for stream
@param streamId
Stream id
@param stream
Stream | [
"Specify",
"name",
"connection",
"scope",
"and",
"etc",
"for",
"stream"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java#L909-L918 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ArrayUtils.java | ArrayUtils.subArray | public static <T> T[] subArray(final T[] array, final int start) {
"""
裁剪数组。Returns a new array if array is not empty and start greater or equals
0 and less than array length; array self otherwise;
@param array 源数组。array to be handed.
@param start 裁剪的起始位置的索引。start index number.
@return 一个新的数组,包含从指定索引开始到数组结束的所有元素。如果数组为空或起始索引小于0或大于数组本身索引长度,则返回数组本身。a new
array if array is not empty and start greater or equals 0 and less
than array length; array self otherwise;
"""
int end = array == null ? 0 : array.length - 1;
return subArray(array, start, end);
} | java | public static <T> T[] subArray(final T[] array, final int start) {
int end = array == null ? 0 : array.length - 1;
return subArray(array, start, end);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"subArray",
"(",
"final",
"T",
"[",
"]",
"array",
",",
"final",
"int",
"start",
")",
"{",
"int",
"end",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
"-",
"1",
";",
"return"... | 裁剪数组。Returns a new array if array is not empty and start greater or equals
0 and less than array length; array self otherwise;
@param array 源数组。array to be handed.
@param start 裁剪的起始位置的索引。start index number.
@return 一个新的数组,包含从指定索引开始到数组结束的所有元素。如果数组为空或起始索引小于0或大于数组本身索引长度,则返回数组本身。a new
array if array is not empty and start greater or equals 0 and less
than array length; array self otherwise; | [
"裁剪数组。Returns",
"a",
"new",
"array",
"if",
"array",
"is",
"not",
"empty",
"and",
"start",
"greater",
"or",
"equals",
"0",
"and",
"less",
"than",
"array",
"length",
";",
"array",
"self",
"otherwise",
";"
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ArrayUtils.java#L258-L262 |
voldemort/voldemort | src/java/voldemort/utils/ByteUtils.java | ByteUtils.readInt | public static int readInt(byte[] bytes, int offset) {
"""
Read an int from the byte array starting at the given offset
@param bytes The byte array to read from
@param offset The offset to start reading at
@return The int read
"""
return (((bytes[offset + 0] & 0xff) << 24) | ((bytes[offset + 1] & 0xff) << 16)
| ((bytes[offset + 2] & 0xff) << 8) | (bytes[offset + 3] & 0xff));
} | java | public static int readInt(byte[] bytes, int offset) {
return (((bytes[offset + 0] & 0xff) << 24) | ((bytes[offset + 1] & 0xff) << 16)
| ((bytes[offset + 2] & 0xff) << 8) | (bytes[offset + 3] & 0xff));
} | [
"public",
"static",
"int",
"readInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"(",
"bytes",
"[",
"offset",
"+",
"0",
"]",
"&",
"0xff",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"bytes",
"[",
"offset",
"+",... | Read an int from the byte array starting at the given offset
@param bytes The byte array to read from
@param offset The offset to start reading at
@return The int read | [
"Read",
"an",
"int",
"from",
"the",
"byte",
"array",
"starting",
"at",
"the",
"given",
"offset"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L179-L182 |
caspervg/SC4D-LEX4J | lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java | LotRoute.getLot | public Lot getLot(int id, ExtraLotInfo extra) {
"""
Retrieve the lot/file
@param id ID of the lot to be retrieved
@return Lot
@see ExtraLotInfo
"""
ClientResource resource = new ClientResource(Route.LOT.url(id));
Route.handleExtraInfo(resource, extra, auth);
try {
Representation repr = resource.get();
return mapper.readValue(repr.getText(), Lot.class);
} catch (IOException e) {
LEX4JLogger.log(Level.WARNING, "Could not retrieve lot correctly!");
return null;
}
} | java | public Lot getLot(int id, ExtraLotInfo extra) {
ClientResource resource = new ClientResource(Route.LOT.url(id));
Route.handleExtraInfo(resource, extra, auth);
try {
Representation repr = resource.get();
return mapper.readValue(repr.getText(), Lot.class);
} catch (IOException e) {
LEX4JLogger.log(Level.WARNING, "Could not retrieve lot correctly!");
return null;
}
} | [
"public",
"Lot",
"getLot",
"(",
"int",
"id",
",",
"ExtraLotInfo",
"extra",
")",
"{",
"ClientResource",
"resource",
"=",
"new",
"ClientResource",
"(",
"Route",
".",
"LOT",
".",
"url",
"(",
"id",
")",
")",
";",
"Route",
".",
"handleExtraInfo",
"(",
"resour... | Retrieve the lot/file
@param id ID of the lot to be retrieved
@return Lot
@see ExtraLotInfo | [
"Retrieve",
"the",
"lot",
"/",
"file"
] | train | https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java#L66-L77 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.zip | public static File zip(File srcFile, Charset charset) throws UtilException {
"""
打包到当前目录
@param srcFile 源文件或目录
@param charset 编码
@return 打包好的压缩文件
@throws UtilException IO异常
"""
final File zipFile = FileUtil.file(srcFile.getParentFile(), FileUtil.mainName(srcFile) + ".zip");
zip(zipFile, charset, false, srcFile);
return zipFile;
} | java | public static File zip(File srcFile, Charset charset) throws UtilException {
final File zipFile = FileUtil.file(srcFile.getParentFile(), FileUtil.mainName(srcFile) + ".zip");
zip(zipFile, charset, false, srcFile);
return zipFile;
} | [
"public",
"static",
"File",
"zip",
"(",
"File",
"srcFile",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"final",
"File",
"zipFile",
"=",
"FileUtil",
".",
"file",
"(",
"srcFile",
".",
"getParentFile",
"(",
")",
",",
"FileUtil",
".",
"main... | 打包到当前目录
@param srcFile 源文件或目录
@param charset 编码
@return 打包好的压缩文件
@throws UtilException IO异常 | [
"打包到当前目录"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L83-L87 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java | VirtualMachineHandler.attachVirtualMachine | public Object attachVirtualMachine() {
"""
Lookup and create a {@link com.sun.tools.attach.VirtualMachine} via reflection. First, a direct
lookup via {@link Class#forName(String)} is done, which will succeed for JVM on OS X, since tools.jar
is bundled there together with classes.zip. Next, tools.jar is tried to be found (by examine <code>java.home</code>)
and an own classloader is created for looking up the VirtualMachine.
If lookup fails, a message is printed out (except when '--quiet' is provided)
@return the create virtual machine of <code>null</code> if none could be created
"""
if (options.getPid() == null && options.getProcessPattern() == null) {
return null;
}
Class vmClass = lookupVirtualMachineClass();
String pid = null;
try {
Method method = vmClass.getMethod("attach",String.class);
pid = getProcessId(options);
return method.invoke(null, pid);
} catch (NoSuchMethodException e) {
throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options);
} catch (InvocationTargetException e) {
throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options);
} catch (IllegalAccessException e) {
throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options);
} catch (IllegalArgumentException e) {
throw new ProcessingException("Illegal Argument",e,options);
}
} | java | public Object attachVirtualMachine() {
if (options.getPid() == null && options.getProcessPattern() == null) {
return null;
}
Class vmClass = lookupVirtualMachineClass();
String pid = null;
try {
Method method = vmClass.getMethod("attach",String.class);
pid = getProcessId(options);
return method.invoke(null, pid);
} catch (NoSuchMethodException e) {
throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options);
} catch (InvocationTargetException e) {
throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options);
} catch (IllegalAccessException e) {
throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options);
} catch (IllegalArgumentException e) {
throw new ProcessingException("Illegal Argument",e,options);
}
} | [
"public",
"Object",
"attachVirtualMachine",
"(",
")",
"{",
"if",
"(",
"options",
".",
"getPid",
"(",
")",
"==",
"null",
"&&",
"options",
".",
"getProcessPattern",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"vmClass",
"=",
"l... | Lookup and create a {@link com.sun.tools.attach.VirtualMachine} via reflection. First, a direct
lookup via {@link Class#forName(String)} is done, which will succeed for JVM on OS X, since tools.jar
is bundled there together with classes.zip. Next, tools.jar is tried to be found (by examine <code>java.home</code>)
and an own classloader is created for looking up the VirtualMachine.
If lookup fails, a message is printed out (except when '--quiet' is provided)
@return the create virtual machine of <code>null</code> if none could be created | [
"Lookup",
"and",
"create",
"a",
"{",
"@link",
"com",
".",
"sun",
".",
"tools",
".",
"attach",
".",
"VirtualMachine",
"}",
"via",
"reflection",
".",
"First",
"a",
"direct",
"lookup",
"via",
"{",
"@link",
"Class#forName",
"(",
"String",
")",
"}",
"is",
"... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java#L59-L78 |
groovy/groovy-core | src/main/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.postInstantiate | protected void postInstantiate(Object name, Map attributes, Object node) {
"""
A hook after the factory creates the node and before attributes are set.<br>
It will call any registered postInstantiateDelegates, if you override
this method be sure to call this impl somewhere in your code.
@param name the name of the node
@param attributes the attributes for the node
@param node the object created by the node factory
"""
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node});
}
} | java | protected void postInstantiate(Object name, Map attributes, Object node) {
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node});
}
} | [
"protected",
"void",
"postInstantiate",
"(",
"Object",
"name",
",",
"Map",
"attributes",
",",
"Object",
"node",
")",
"{",
"for",
"(",
"Closure",
"postInstantiateDelegate",
":",
"getProxyBuilder",
"(",
")",
".",
"getPostInstantiateDelegates",
"(",
")",
")",
"{",
... | A hook after the factory creates the node and before attributes are set.<br>
It will call any registered postInstantiateDelegates, if you override
this method be sure to call this impl somewhere in your code.
@param name the name of the node
@param attributes the attributes for the node
@param node the object created by the node factory | [
"A",
"hook",
"after",
"the",
"factory",
"creates",
"the",
"node",
"and",
"before",
"attributes",
"are",
"set",
".",
"<br",
">",
"It",
"will",
"call",
"any",
"registered",
"postInstantiateDelegates",
"if",
"you",
"override",
"this",
"method",
"be",
"sure",
"t... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/FactoryBuilderSupport.java#L1022-L1026 |
amzn/ion-java | src/com/amazon/ion/util/IonStreamUtils.java | IonStreamUtils.writeStringList | public static void writeStringList(IonWriter writer, String[] values)
throws IOException {
"""
writes an IonList with a series of IonString values. This
starts a List, writes the values (without any annoations)
and closes the list. For text and tree writers this is
just a convienience, but for the binary writer it can be
optimized internally.
@param values Java String to populate the lists IonString's from
"""
if (writer instanceof _Private_ListWriter) {
((_Private_ListWriter)writer).writeStringList(values);
return;
}
writer.stepIn(IonType.LIST);
for (int ii=0; ii<values.length; ii++) {
writer.writeString(values[ii]);
}
writer.stepOut();
} | java | public static void writeStringList(IonWriter writer, String[] values)
throws IOException
{
if (writer instanceof _Private_ListWriter) {
((_Private_ListWriter)writer).writeStringList(values);
return;
}
writer.stepIn(IonType.LIST);
for (int ii=0; ii<values.length; ii++) {
writer.writeString(values[ii]);
}
writer.stepOut();
} | [
"public",
"static",
"void",
"writeStringList",
"(",
"IonWriter",
"writer",
",",
"String",
"[",
"]",
"values",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"instanceof",
"_Private_ListWriter",
")",
"{",
"(",
"(",
"_Private_ListWriter",
")",
"writer",
... | writes an IonList with a series of IonString values. This
starts a List, writes the values (without any annoations)
and closes the list. For text and tree writers this is
just a convienience, but for the binary writer it can be
optimized internally.
@param values Java String to populate the lists IonString's from | [
"writes",
"an",
"IonList",
"with",
"a",
"series",
"of",
"IonString",
"values",
".",
"This",
"starts",
"a",
"List",
"writes",
"the",
"values",
"(",
"without",
"any",
"annoations",
")",
"and",
"closes",
"the",
"list",
".",
"For",
"text",
"and",
"tree",
"wr... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonStreamUtils.java#L303-L316 |
Falydoor/limesurvey-rc | src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java | LimesurveyRC.getGroups | public Stream<LsQuestionGroup> getGroups(int surveyId) throws LimesurveyRCException {
"""
Gets groups from a survey.
The groups are ordered using the "group_order" field.
@param surveyId the survey id you want to get the groups
@return a stream of groups in an ordered order
@throws LimesurveyRCException the limesurvey rc exception
"""
JsonElement result = callRC(new LsApiBody("list_groups", getParamsWithKey(surveyId)));
List<LsQuestionGroup> questionGroups = gson.fromJson(result, new TypeToken<List<LsQuestionGroup>>() {
}.getType());
return questionGroups.stream().sorted(Comparator.comparing(LsQuestionGroup::getOrder));
} | java | public Stream<LsQuestionGroup> getGroups(int surveyId) throws LimesurveyRCException {
JsonElement result = callRC(new LsApiBody("list_groups", getParamsWithKey(surveyId)));
List<LsQuestionGroup> questionGroups = gson.fromJson(result, new TypeToken<List<LsQuestionGroup>>() {
}.getType());
return questionGroups.stream().sorted(Comparator.comparing(LsQuestionGroup::getOrder));
} | [
"public",
"Stream",
"<",
"LsQuestionGroup",
">",
"getGroups",
"(",
"int",
"surveyId",
")",
"throws",
"LimesurveyRCException",
"{",
"JsonElement",
"result",
"=",
"callRC",
"(",
"new",
"LsApiBody",
"(",
"\"list_groups\"",
",",
"getParamsWithKey",
"(",
"surveyId",
")... | Gets groups from a survey.
The groups are ordered using the "group_order" field.
@param surveyId the survey id you want to get the groups
@return a stream of groups in an ordered order
@throws LimesurveyRCException the limesurvey rc exception | [
"Gets",
"groups",
"from",
"a",
"survey",
".",
"The",
"groups",
"are",
"ordered",
"using",
"the",
"group_order",
"field",
"."
] | train | https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L255-L261 |
jmeetsma/Iglu-Common | src/main/java/org/ijsberg/iglu/database/component/StandardConnectionPool.java | StandardConnectionPool.replaceConnection | void replaceConnection(ConnectionWrapper connWrap) {
"""
Closes the connection and replaces it in the pool
To be invoked by ConnectionWrapper and StandardConnectionPool only only
@param connWrap
"""
synchronized (allConnections) {
try {
if (usedConnections.remove(connWrap)) {
nrofReset++;
//the object was indeed locked
allConnections.remove(connWrap);
//IMPORTANT does this result in an SQL error which breaks off the connection?
connWrap.getConnection().close();
System.out.println(new LogEntry(Level.CRITICAL, "Connection reset" + (connWrap.getLastStatement() != null ? " while executing '" + connWrap.getLastStatement() + '\'' : "")));
//lets create a fresh successor
ConnectionWrapper newConnWrap = createConnectionWrapper(dbUrl, dbUsername, dbUserpassword);
availableConnections.add(newConnWrap);
allConnections.add(newConnWrap);
} else {
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "error in connection pool: attempt to close a Connection that does not exist in pool"));
}
} catch (SQLException sqle) {
//happens if db unreachable
//connection will be lost for the time being
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "can not create new connection to " + dbUrl + " unreachable or useless connection settings", sqle));
}
try {
if (!connWrap.isClosed()) {
connWrap.getConnection().close();
}
} catch (SQLException sqle) {
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "", sqle));
}
}
} | java | void replaceConnection(ConnectionWrapper connWrap) {
synchronized (allConnections) {
try {
if (usedConnections.remove(connWrap)) {
nrofReset++;
//the object was indeed locked
allConnections.remove(connWrap);
//IMPORTANT does this result in an SQL error which breaks off the connection?
connWrap.getConnection().close();
System.out.println(new LogEntry(Level.CRITICAL, "Connection reset" + (connWrap.getLastStatement() != null ? " while executing '" + connWrap.getLastStatement() + '\'' : "")));
//lets create a fresh successor
ConnectionWrapper newConnWrap = createConnectionWrapper(dbUrl, dbUsername, dbUserpassword);
availableConnections.add(newConnWrap);
allConnections.add(newConnWrap);
} else {
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "error in connection pool: attempt to close a Connection that does not exist in pool"));
}
} catch (SQLException sqle) {
//happens if db unreachable
//connection will be lost for the time being
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "can not create new connection to " + dbUrl + " unreachable or useless connection settings", sqle));
}
try {
if (!connWrap.isClosed()) {
connWrap.getConnection().close();
}
} catch (SQLException sqle) {
nrofErrors++;
System.out.println(new LogEntry(Level.CRITICAL, "", sqle));
}
}
} | [
"void",
"replaceConnection",
"(",
"ConnectionWrapper",
"connWrap",
")",
"{",
"synchronized",
"(",
"allConnections",
")",
"{",
"try",
"{",
"if",
"(",
"usedConnections",
".",
"remove",
"(",
"connWrap",
")",
")",
"{",
"nrofReset",
"++",
";",
"//the object was indee... | Closes the connection and replaces it in the pool
To be invoked by ConnectionWrapper and StandardConnectionPool only only
@param connWrap | [
"Closes",
"the",
"connection",
"and",
"replaces",
"it",
"in",
"the",
"pool",
"To",
"be",
"invoked",
"by",
"ConnectionWrapper",
"and",
"StandardConnectionPool",
"only",
"only"
] | train | https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/database/component/StandardConnectionPool.java#L486-L520 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForPolicySetDefinitionAsync | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) {
"""
Queries policy events for the subscription level policy set definition.
@param subscriptionId Microsoft Azure subscription ID.
@param policySetDefinitionName Policy set definition name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object
"""
return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) {
return listQueryResultsForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyEventsQueryResultsInner",
">",
"listQueryResultsForPolicySetDefinitionAsync",
"(",
"String",
"subscriptionId",
",",
"String",
"policySetDefinitionName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForPolicySetDefin... | Queries policy events for the subscription level policy set definition.
@param subscriptionId Microsoft Azure subscription ID.
@param policySetDefinitionName Policy set definition name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object | [
"Queries",
"policy",
"events",
"for",
"the",
"subscription",
"level",
"policy",
"set",
"definition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L988-L995 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/SnapshotRestoreResultSet.java | SnapshotRestoreResultSet.addRowsForKey | public boolean addRowsForKey(RestoreResultKey key, VoltTable vt) {
"""
Add restore result row(s). Replicated table results are expanded
to multiple rows. Partitioned table results are merged.
@param key result key
@param vt output table
@return true if a row was successfully added
"""
if (vt == null || key == null) {
return false;
}
RestoreResultValue value = get(key);
if (value == null) {
return false;
}
try {
if (key.m_partitionId == -1) {
// Re-expand replicated table results.
for (int i = 0; i < value.getCount(); ++i) {
vt.addRow(key.m_hostId,
value.m_hostName,
value.m_siteId,
key.m_table,
key.m_partitionId,
value.m_successes.get(i) ? "SUCCESS" : "FAILURE",
value.m_errMsgs.get(i));
}
}
else {
// Partitioned table results merge redundant partition results.
vt.addRow(key.m_hostId,
value.m_hostName,
value.m_siteId,
key.m_table,
key.m_partitionId,
value.getSuccessColumnValue(),
value.getErrorMessageColumnValue());
}
}
catch(RuntimeException e) {
SNAP_LOG.error("Exception received while adding snapshot restore result row.", e);
throw e;
}
return true;
} | java | public boolean addRowsForKey(RestoreResultKey key, VoltTable vt)
{
if (vt == null || key == null) {
return false;
}
RestoreResultValue value = get(key);
if (value == null) {
return false;
}
try {
if (key.m_partitionId == -1) {
// Re-expand replicated table results.
for (int i = 0; i < value.getCount(); ++i) {
vt.addRow(key.m_hostId,
value.m_hostName,
value.m_siteId,
key.m_table,
key.m_partitionId,
value.m_successes.get(i) ? "SUCCESS" : "FAILURE",
value.m_errMsgs.get(i));
}
}
else {
// Partitioned table results merge redundant partition results.
vt.addRow(key.m_hostId,
value.m_hostName,
value.m_siteId,
key.m_table,
key.m_partitionId,
value.getSuccessColumnValue(),
value.getErrorMessageColumnValue());
}
}
catch(RuntimeException e) {
SNAP_LOG.error("Exception received while adding snapshot restore result row.", e);
throw e;
}
return true;
} | [
"public",
"boolean",
"addRowsForKey",
"(",
"RestoreResultKey",
"key",
",",
"VoltTable",
"vt",
")",
"{",
"if",
"(",
"vt",
"==",
"null",
"||",
"key",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"RestoreResultValue",
"value",
"=",
"get",
"(",
"key"... | Add restore result row(s). Replicated table results are expanded
to multiple rows. Partitioned table results are merged.
@param key result key
@param vt output table
@return true if a row was successfully added | [
"Add",
"restore",
"result",
"row",
"(",
"s",
")",
".",
"Replicated",
"table",
"results",
"are",
"expanded",
"to",
"multiple",
"rows",
".",
"Partitioned",
"table",
"results",
"are",
"merged",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/SnapshotRestoreResultSet.java#L183-L221 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicConnectionFactoryImpl.java | JmsTopicConnectionFactoryImpl.instantiateConnection | JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException {
"""
This overrides a superclass method, so that the superclass's
createConnection() method can be inherited, but still return an object of
this class's type.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection);
JmsTopicConnectionImpl jmsTopicConnection = new JmsTopicConnectionImpl(jcaConnection, isManaged(), _passThruProps);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsTopicConnection);
return jmsTopicConnection;
} | java | JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection);
JmsTopicConnectionImpl jmsTopicConnection = new JmsTopicConnectionImpl(jcaConnection, isManaged(), _passThruProps);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsTopicConnection);
return jmsTopicConnection;
} | [
"JmsConnectionImpl",
"instantiateConnection",
"(",
"JmsJcaConnection",
"jcaConnection",
",",
"Map",
"_passThruProps",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
... | This overrides a superclass method, so that the superclass's
createConnection() method can be inherited, but still return an object of
this class's type. | [
"This",
"overrides",
"a",
"superclass",
"method",
"so",
"that",
"the",
"superclass",
"s",
"createConnection",
"()",
"method",
"can",
"be",
"inherited",
"but",
"still",
"return",
"an",
"object",
"of",
"this",
"class",
"s",
"type",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicConnectionFactoryImpl.java#L78-L83 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/LoggingUtil.java | LoggingUtil.logExpensive | public static void logExpensive(Level level, String message, Throwable e) {
"""
Expensive logging function that is convenient, but should only be used in
rare conditions.
For 'frequent' logging, use more efficient techniques, such as explained in
the {@link de.lmu.ifi.dbs.elki.logging logging package documentation}.
@param level Logging level
@param message Message to log.
@param e Exception to report.
"""
String[] caller = inferCaller();
if(caller != null) {
Logger logger = Logger.getLogger(caller[0]);
logger.logp(level, caller[0], caller[1], message, e);
}
else {
Logger.getAnonymousLogger().log(level, message, e);
}
} | java | public static void logExpensive(Level level, String message, Throwable e) {
String[] caller = inferCaller();
if(caller != null) {
Logger logger = Logger.getLogger(caller[0]);
logger.logp(level, caller[0], caller[1], message, e);
}
else {
Logger.getAnonymousLogger().log(level, message, e);
}
} | [
"public",
"static",
"void",
"logExpensive",
"(",
"Level",
"level",
",",
"String",
"message",
",",
"Throwable",
"e",
")",
"{",
"String",
"[",
"]",
"caller",
"=",
"inferCaller",
"(",
")",
";",
"if",
"(",
"caller",
"!=",
"null",
")",
"{",
"Logger",
"logge... | Expensive logging function that is convenient, but should only be used in
rare conditions.
For 'frequent' logging, use more efficient techniques, such as explained in
the {@link de.lmu.ifi.dbs.elki.logging logging package documentation}.
@param level Logging level
@param message Message to log.
@param e Exception to report. | [
"Expensive",
"logging",
"function",
"that",
"is",
"convenient",
"but",
"should",
"only",
"be",
"used",
"in",
"rare",
"conditions",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/LoggingUtil.java#L58-L67 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java | VentoFoggia.findIdentical | public static Pattern findIdentical(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) {
"""
Create a pattern which can be used to find molecules which are the same
as the {@code query} structure.
@param query the substructure to find
@param atomMatcher how atoms are matched
@param bondMatcher how bonds are matched
@return a pattern for finding the {@code query}
"""
return new VentoFoggia(query, atomMatcher, bondMatcher, false);
} | java | public static Pattern findIdentical(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) {
return new VentoFoggia(query, atomMatcher, bondMatcher, false);
} | [
"public",
"static",
"Pattern",
"findIdentical",
"(",
"IAtomContainer",
"query",
",",
"AtomMatcher",
"atomMatcher",
",",
"BondMatcher",
"bondMatcher",
")",
"{",
"return",
"new",
"VentoFoggia",
"(",
"query",
",",
"atomMatcher",
",",
"bondMatcher",
",",
"false",
")",... | Create a pattern which can be used to find molecules which are the same
as the {@code query} structure.
@param query the substructure to find
@param atomMatcher how atoms are matched
@param bondMatcher how bonds are matched
@return a pattern for finding the {@code query} | [
"Create",
"a",
"pattern",
"which",
"can",
"be",
"used",
"to",
"find",
"molecules",
"which",
"are",
"the",
"same",
"as",
"the",
"{",
"@code",
"query",
"}",
"structure",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java#L197-L199 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java | B2BAccountUrl.getUserRolesAsyncUrl | public static MozuUrl getUserRolesAsyncUrl(Integer accountId, String responseFields, String userId) {
"""
Get Resource Url for GetUserRolesAsync
@param accountId Unique identifier of the customer account.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getUserRolesAsyncUrl(Integer accountId, String responseFields, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getUserRolesAsyncUrl",
"(",
"Integer",
"accountId",
",",
"String",
"responseFields",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/b2baccounts/{accountId}/user/{user... | Get Resource Url for GetUserRolesAsync
@param accountId Unique identifier of the customer account.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetUserRolesAsync"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L87-L94 |
querydsl/querydsl | querydsl-codegen/src/main/java/com/querydsl/codegen/ClassPathUtils.java | ClassPathUtils.scanPackage | public static Set<Class<?>> scanPackage(ClassLoader classLoader, Package pkg) throws IOException {
"""
Return the classes from the given package and subpackages using the supplied classloader
@param classLoader classloader to be used
@param pkg package to scan
@return set of found classes
@throws IOException
"""
return scanPackage(classLoader, pkg.getName());
} | java | public static Set<Class<?>> scanPackage(ClassLoader classLoader, Package pkg) throws IOException {
return scanPackage(classLoader, pkg.getName());
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scanPackage",
"(",
"ClassLoader",
"classLoader",
",",
"Package",
"pkg",
")",
"throws",
"IOException",
"{",
"return",
"scanPackage",
"(",
"classLoader",
",",
"pkg",
".",
"getName",
"(",
")",
")",... | Return the classes from the given package and subpackages using the supplied classloader
@param classLoader classloader to be used
@param pkg package to scan
@return set of found classes
@throws IOException | [
"Return",
"the",
"classes",
"from",
"the",
"given",
"package",
"and",
"subpackages",
"using",
"the",
"supplied",
"classloader"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-codegen/src/main/java/com/querydsl/codegen/ClassPathUtils.java#L40-L42 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.addName | public void addName(final String name, int id) {
"""
Adds a new variable name with a given variable index to this solver.
@param name the variable name
@param id the variable index
"""
this.name2idx.put(name, id);
this.idx2name.put(id, name);
} | java | public void addName(final String name, int id) {
this.name2idx.put(name, id);
this.idx2name.put(id, name);
} | [
"public",
"void",
"addName",
"(",
"final",
"String",
"name",
",",
"int",
"id",
")",
"{",
"this",
".",
"name2idx",
".",
"put",
"(",
"name",
",",
"id",
")",
";",
"this",
".",
"idx2name",
".",
"put",
"(",
"id",
",",
"name",
")",
";",
"}"
] | Adds a new variable name with a given variable index to this solver.
@param name the variable name
@param id the variable index | [
"Adds",
"a",
"new",
"variable",
"name",
"with",
"a",
"given",
"variable",
"index",
"to",
"this",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L294-L297 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/AnnotationValidatorCache.java | AnnotationValidatorCache.addByClass | private static void addByClass(Registry registry, Class<?> clazz) {
"""
为某个类添加所有待验证属性的<code>AnnotationValidator</code>到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>中
<p/>
流程如下:
<ul>
<li>1. 如果<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>已缓存了类对应的验证器,则直接退出</li>
<li>2. 寻找类中所有装饰有{@link FluentValidate}注解的属性,遍历之。</li>
<li>3. 取出{@link FluentValidate}注解中的值,包含所有验证器的类定义。</li>
<li>4. 遍历所有的验证器类定义,如果验证器类不是实现了<code>Validator</code>接口跳过。</li>
<li>5. <code>VALIDATOR_MAP</code>中如果已经存在了改验证器类对应的实例,则跳过,如果没有就尝试从<code>Registry</code
>中查询实例对象,一般情况下当前线程classLoader下只有一个实例,当使用Spring等IoC容器的时候会出现多个,则取第一个,放入 <code>validatorsMap</code>中。
</li>
<li>6. 组装<code>AnnotationValidator</code>,放到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>缓存住。</li>
</ul>
@param registry 验证器对象寻找注册器
@param clazz 待验证类定义
"""
try {
if (CLASS_2_ANNOTATION_VALIDATOR_MAP.contains(clazz)) {
return;
}
List<AnnotationValidator> annotationValidators = getAllAnnotationValidators(registry, clazz);
if (CollectionUtil.isEmpty(annotationValidators)) {
LOGGER.debug(String.format("Annotation-based validation enabled for %s, and to-do validators are empty",
clazz.getSimpleName()));
} else {
CLASS_2_ANNOTATION_VALIDATOR_MAP.putIfAbsent(clazz, annotationValidators);
LOGGER.debug(
String.format("Annotation-based validation added for %s, and to-do validators are %s", clazz
.getSimpleName(), annotationValidators));
}
} catch (Exception e) {
LOGGER.error("Failed to add annotation validators " + e.getMessage(), e);
}
} | java | private static void addByClass(Registry registry, Class<?> clazz) {
try {
if (CLASS_2_ANNOTATION_VALIDATOR_MAP.contains(clazz)) {
return;
}
List<AnnotationValidator> annotationValidators = getAllAnnotationValidators(registry, clazz);
if (CollectionUtil.isEmpty(annotationValidators)) {
LOGGER.debug(String.format("Annotation-based validation enabled for %s, and to-do validators are empty",
clazz.getSimpleName()));
} else {
CLASS_2_ANNOTATION_VALIDATOR_MAP.putIfAbsent(clazz, annotationValidators);
LOGGER.debug(
String.format("Annotation-based validation added for %s, and to-do validators are %s", clazz
.getSimpleName(), annotationValidators));
}
} catch (Exception e) {
LOGGER.error("Failed to add annotation validators " + e.getMessage(), e);
}
} | [
"private",
"static",
"void",
"addByClass",
"(",
"Registry",
"registry",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"try",
"{",
"if",
"(",
"CLASS_2_ANNOTATION_VALIDATOR_MAP",
".",
"contains",
"(",
"clazz",
")",
")",
"{",
"return",
";",
"}",
"List",
"... | 为某个类添加所有待验证属性的<code>AnnotationValidator</code>到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>中
<p/>
流程如下:
<ul>
<li>1. 如果<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>已缓存了类对应的验证器,则直接退出</li>
<li>2. 寻找类中所有装饰有{@link FluentValidate}注解的属性,遍历之。</li>
<li>3. 取出{@link FluentValidate}注解中的值,包含所有验证器的类定义。</li>
<li>4. 遍历所有的验证器类定义,如果验证器类不是实现了<code>Validator</code>接口跳过。</li>
<li>5. <code>VALIDATOR_MAP</code>中如果已经存在了改验证器类对应的实例,则跳过,如果没有就尝试从<code>Registry</code
>中查询实例对象,一般情况下当前线程classLoader下只有一个实例,当使用Spring等IoC容器的时候会出现多个,则取第一个,放入 <code>validatorsMap</code>中。
</li>
<li>6. 组装<code>AnnotationValidator</code>,放到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>缓存住。</li>
</ul>
@param registry 验证器对象寻找注册器
@param clazz 待验证类定义 | [
"为某个类添加所有待验证属性的<code",
">",
"AnnotationValidator<",
"/",
"code",
">",
"到<code",
">",
"CLASS_2_ANNOTATION_VALIDATOR_MAP<",
"/",
"code",
">",
"中",
"<p",
"/",
">",
"流程如下:",
"<ul",
">",
"<li",
">",
"1",
".",
"如果<code",
">",
"CLASS_2_ANNOTATION_VALIDATOR_MAP<",
"/",
... | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/AnnotationValidatorCache.java#L75-L94 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.logIdent | protected static RedactableArgument logIdent(final ChannelHandlerContext ctx, final Endpoint endpoint) {
"""
Simple log helper to give logs a common prefix.
@param ctx the context.
@param endpoint the endpoint.
@return a prefix string for logs.
"""
return system("[" + ctx.channel().remoteAddress() + "][" + endpoint.getClass().getSimpleName() + "]: ");
} | java | protected static RedactableArgument logIdent(final ChannelHandlerContext ctx, final Endpoint endpoint) {
return system("[" + ctx.channel().remoteAddress() + "][" + endpoint.getClass().getSimpleName() + "]: ");
} | [
"protected",
"static",
"RedactableArgument",
"logIdent",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"Endpoint",
"endpoint",
")",
"{",
"return",
"system",
"(",
"\"[\"",
"+",
"ctx",
".",
"channel",
"(",
")",
".",
"remoteAddress",
"(",
")",
"+",
... | Simple log helper to give logs a common prefix.
@param ctx the context.
@param endpoint the endpoint.
@return a prefix string for logs. | [
"Simple",
"log",
"helper",
"to",
"give",
"logs",
"a",
"common",
"prefix",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L850-L852 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java | CmsXmlContentPropertyHelper.getPropValuePaths | public static String getPropValuePaths(CmsObject cms, String type, String value) {
"""
Returns a converted property value depending on the given type.<p>
If the type is {@link CmsXmlContentProperty.PropType#vfslist}, the value is parsed as a
list of IDs and converted to a list of paths.<p>
@param cms the current CMS context
@param type the property type
@param value the raw property value
@return a converted property value depending on the given type
"""
if (PropType.isVfsList(type)) {
return convertIdsToPaths(cms, value);
}
return value;
} | java | public static String getPropValuePaths(CmsObject cms, String type, String value) {
if (PropType.isVfsList(type)) {
return convertIdsToPaths(cms, value);
}
return value;
} | [
"public",
"static",
"String",
"getPropValuePaths",
"(",
"CmsObject",
"cms",
",",
"String",
"type",
",",
"String",
"value",
")",
"{",
"if",
"(",
"PropType",
".",
"isVfsList",
"(",
"type",
")",
")",
"{",
"return",
"convertIdsToPaths",
"(",
"cms",
",",
"value... | Returns a converted property value depending on the given type.<p>
If the type is {@link CmsXmlContentProperty.PropType#vfslist}, the value is parsed as a
list of IDs and converted to a list of paths.<p>
@param cms the current CMS context
@param type the property type
@param value the raw property value
@return a converted property value depending on the given type | [
"Returns",
"a",
"converted",
"property",
"value",
"depending",
"on",
"the",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L329-L335 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java | MessageAction.addFile | @CheckReturnValue
public MessageAction addFile(final InputStream data, final String name) {
"""
Adds the provided {@link java.io.InputStream InputStream} as file data.
<br><u>The stream will be closed upon execution!</u>
<p>To reset all files use {@link #clearFiles()}
@param data
The InputStream that will be interpreted as file data
@param name
The file name that should be used to interpret the type of the given data
using the file-name extension. This name is similar to what will be visible
through {@link net.dv8tion.jda.core.entities.Message.Attachment#getFileName() Message.Attachment.getFileName()}
@throws java.lang.IllegalStateException
If the file limit of {@value Message#MAX_FILE_AMOUNT} has been reached prior to calling this method,
or if this MessageAction will perform an edit operation on an existing Message (see {@link #isEdit()})
@throws java.lang.IllegalArgumentException
If the provided data is {@code null} or the provided name is blank or {@code null}
@throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
If this is targeting a TextChannel and the currently logged in account does not have
{@link net.dv8tion.jda.core.Permission#MESSAGE_ATTACH_FILES Permission.MESSAGE_ATTACH_FILES}
@return Updated MessageAction for chaining convenience
"""
checkEdit();
Checks.notNull(data, "Data");
Checks.notBlank(name, "Name");
checkFileAmount();
checkPermission(Permission.MESSAGE_ATTACH_FILES);
files.put(name, data);
return this;
} | java | @CheckReturnValue
public MessageAction addFile(final InputStream data, final String name)
{
checkEdit();
Checks.notNull(data, "Data");
Checks.notBlank(name, "Name");
checkFileAmount();
checkPermission(Permission.MESSAGE_ATTACH_FILES);
files.put(name, data);
return this;
} | [
"@",
"CheckReturnValue",
"public",
"MessageAction",
"addFile",
"(",
"final",
"InputStream",
"data",
",",
"final",
"String",
"name",
")",
"{",
"checkEdit",
"(",
")",
";",
"Checks",
".",
"notNull",
"(",
"data",
",",
"\"Data\"",
")",
";",
"Checks",
".",
"notB... | Adds the provided {@link java.io.InputStream InputStream} as file data.
<br><u>The stream will be closed upon execution!</u>
<p>To reset all files use {@link #clearFiles()}
@param data
The InputStream that will be interpreted as file data
@param name
The file name that should be used to interpret the type of the given data
using the file-name extension. This name is similar to what will be visible
through {@link net.dv8tion.jda.core.entities.Message.Attachment#getFileName() Message.Attachment.getFileName()}
@throws java.lang.IllegalStateException
If the file limit of {@value Message#MAX_FILE_AMOUNT} has been reached prior to calling this method,
or if this MessageAction will perform an edit operation on an existing Message (see {@link #isEdit()})
@throws java.lang.IllegalArgumentException
If the provided data is {@code null} or the provided name is blank or {@code null}
@throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
If this is targeting a TextChannel and the currently logged in account does not have
{@link net.dv8tion.jda.core.Permission#MESSAGE_ATTACH_FILES Permission.MESSAGE_ATTACH_FILES}
@return Updated MessageAction for chaining convenience | [
"Adds",
"the",
"provided",
"{",
"@link",
"java",
".",
"io",
".",
"InputStream",
"InputStream",
"}",
"as",
"file",
"data",
".",
"<br",
">",
"<u",
">",
"The",
"stream",
"will",
"be",
"closed",
"upon",
"execution!<",
"/",
"u",
">"
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java#L366-L376 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/ArrayHelp.java | ArrayHelp.contains | public static final <T> boolean contains(T[] array, T item) {
"""
Returns true if one of arr members equals item
@param <T>
@param array
@param item
@return
"""
for (T b : array)
{
if (b.equals(item))
{
return true;
}
}
return false;
} | java | public static final <T> boolean contains(T[] array, T item)
{
for (T b : array)
{
if (b.equals(item))
{
return true;
}
}
return false;
} | [
"public",
"static",
"final",
"<",
"T",
">",
"boolean",
"contains",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"item",
")",
"{",
"for",
"(",
"T",
"b",
":",
"array",
")",
"{",
"if",
"(",
"b",
".",
"equals",
"(",
"item",
")",
")",
"{",
"return",
"tr... | Returns true if one of arr members equals item
@param <T>
@param array
@param item
@return | [
"Returns",
"true",
"if",
"one",
"of",
"arr",
"members",
"equals",
"item"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L374-L384 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/admin/ColumnDescriptorAdapter.java | ColumnDescriptorAdapter.processIntersection | protected static void processIntersection(GcRule gcRule, HColumnDescriptor columnDescriptor) {
"""
<p>processIntersection.</p>
@param gcRule a {@link com.google.bigtable.admin.v2.GcRule} object.
@param columnDescriptor a {@link org.apache.hadoop.hbase.HColumnDescriptor} object.
"""
// minVersions and maxAge are set.
List<GcRule> intersectionRules = gcRule.getIntersection().getRulesList();
Preconditions.checkArgument(intersectionRules.size() == 2, "Cannot process rule " + gcRule);
columnDescriptor.setMinVersions(getVersionCount(intersectionRules));
columnDescriptor.setTimeToLive(getTtl(intersectionRules));
} | java | protected static void processIntersection(GcRule gcRule, HColumnDescriptor columnDescriptor) {
// minVersions and maxAge are set.
List<GcRule> intersectionRules = gcRule.getIntersection().getRulesList();
Preconditions.checkArgument(intersectionRules.size() == 2, "Cannot process rule " + gcRule);
columnDescriptor.setMinVersions(getVersionCount(intersectionRules));
columnDescriptor.setTimeToLive(getTtl(intersectionRules));
} | [
"protected",
"static",
"void",
"processIntersection",
"(",
"GcRule",
"gcRule",
",",
"HColumnDescriptor",
"columnDescriptor",
")",
"{",
"// minVersions and maxAge are set.",
"List",
"<",
"GcRule",
">",
"intersectionRules",
"=",
"gcRule",
".",
"getIntersection",
"(",
")",... | <p>processIntersection.</p>
@param gcRule a {@link com.google.bigtable.admin.v2.GcRule} object.
@param columnDescriptor a {@link org.apache.hadoop.hbase.HColumnDescriptor} object. | [
"<p",
">",
"processIntersection",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/admin/ColumnDescriptorAdapter.java#L262-L268 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asAccumulatorProcedure | public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) {
"""
Creates an accumulator procedure that adapts a vector accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple vectors.
@param accumulator the vector accumulator
@return an accumulator procedure
"""
return new VectorProcedure() {
@Override
public void apply(int i, double value) {
accumulator.update(i, value);
}
};
} | java | public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) {
return new VectorProcedure() {
@Override
public void apply(int i, double value) {
accumulator.update(i, value);
}
};
} | [
"public",
"static",
"VectorProcedure",
"asAccumulatorProcedure",
"(",
"final",
"VectorAccumulator",
"accumulator",
")",
"{",
"return",
"new",
"VectorProcedure",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"int",
"i",
",",
"double",
"value",
"... | Creates an accumulator procedure that adapts a vector accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple vectors.
@param accumulator the vector accumulator
@return an accumulator procedure | [
"Creates",
"an",
"accumulator",
"procedure",
"that",
"adapts",
"a",
"vector",
"accumulator",
"for",
"procedure",
"interface",
".",
"This",
"is",
"useful",
"for",
"reusing",
"a",
"single",
"accumulator",
"for",
"multiple",
"fold",
"operations",
"in",
"multiple",
... | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L457-L464 |
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/util/TypeReferences.java | TypeReferences.findDeclaredType | public JvmType findDeclaredType(Class<?> clazz, Notifier context) {
"""
looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non-
{@link TypeResource} in the given EObject's resourceSet, but goes straight to the Java-layer, using a
{@link IJvmTypeProvider}.
@return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType
could be found using the context's resourceSet.
"""
if (clazz == null)
throw new NullPointerException("clazz");
JvmType declaredType = findDeclaredType(clazz.getName(), context);
return declaredType;
} | java | public JvmType findDeclaredType(Class<?> clazz, Notifier context) {
if (clazz == null)
throw new NullPointerException("clazz");
JvmType declaredType = findDeclaredType(clazz.getName(), context);
return declaredType;
} | [
"public",
"JvmType",
"findDeclaredType",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Notifier",
"context",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"clazz\"",
")",
";",
"JvmType",
"declaredType",
"=",
... | looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non-
{@link TypeResource} in the given EObject's resourceSet, but goes straight to the Java-layer, using a
{@link IJvmTypeProvider}.
@return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType
could be found using the context's resourceSet. | [
"looks",
"up",
"a",
"JVMType",
"corresponding",
"to",
"the",
"given",
"{",
"@link",
"Class",
"}",
".",
"This",
"method",
"ignores",
"any",
"Jvm",
"types",
"created",
"in",
"non",
"-",
"{",
"@link",
"TypeResource",
"}",
"in",
"the",
"given",
"EObject",
"s... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/util/TypeReferences.java#L229-L234 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java | AVAKeyword.getOID | static ObjectIdentifier getOID(String keyword, int standard)
throws IOException {
"""
Get an object identifier representing the specified keyword (or
string encoded object identifier) in the given standard.
@throws IOException If the keyword is not valid in the specified standard
"""
return getOID
(keyword, standard, Collections.<String, String>emptyMap());
} | java | static ObjectIdentifier getOID(String keyword, int standard)
throws IOException {
return getOID
(keyword, standard, Collections.<String, String>emptyMap());
} | [
"static",
"ObjectIdentifier",
"getOID",
"(",
"String",
"keyword",
",",
"int",
"standard",
")",
"throws",
"IOException",
"{",
"return",
"getOID",
"(",
"keyword",
",",
"standard",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")"... | Get an object identifier representing the specified keyword (or
string encoded object identifier) in the given standard.
@throws IOException If the keyword is not valid in the specified standard | [
"Get",
"an",
"object",
"identifier",
"representing",
"the",
"specified",
"keyword",
"(",
"or",
"string",
"encoded",
"object",
"identifier",
")",
"in",
"the",
"given",
"standard",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L1231-L1235 |
elki-project/elki | elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNPreprocessor.java | MaterializeKNNPreprocessor.fireKNNsRemoved | protected void fireKNNsRemoved(DBIDs removals, DBIDs updates) {
"""
Informs all registered KNNListener that existing kNNs have been removed and
as a result some kNNs have been changed.
@param removals the ids of the removed kNNs
@param updates the ids of kNNs which have been changed due to the removals
@see KNNListener
"""
KNNChangeEvent e = new KNNChangeEvent(this, KNNChangeEvent.Type.DELETE, removals, updates);
Object[] listeners = listenerList.getListenerList();
for(int i = listeners.length - 2; i >= 0; i -= 2) {
if(listeners[i] == KNNListener.class) {
((KNNListener) listeners[i + 1]).kNNsChanged(e);
}
}
} | java | protected void fireKNNsRemoved(DBIDs removals, DBIDs updates) {
KNNChangeEvent e = new KNNChangeEvent(this, KNNChangeEvent.Type.DELETE, removals, updates);
Object[] listeners = listenerList.getListenerList();
for(int i = listeners.length - 2; i >= 0; i -= 2) {
if(listeners[i] == KNNListener.class) {
((KNNListener) listeners[i + 1]).kNNsChanged(e);
}
}
} | [
"protected",
"void",
"fireKNNsRemoved",
"(",
"DBIDs",
"removals",
",",
"DBIDs",
"updates",
")",
"{",
"KNNChangeEvent",
"e",
"=",
"new",
"KNNChangeEvent",
"(",
"this",
",",
"KNNChangeEvent",
".",
"Type",
".",
"DELETE",
",",
"removals",
",",
"updates",
")",
";... | Informs all registered KNNListener that existing kNNs have been removed and
as a result some kNNs have been changed.
@param removals the ids of the removed kNNs
@param updates the ids of kNNs which have been changed due to the removals
@see KNNListener | [
"Informs",
"all",
"registered",
"KNNListener",
"that",
"existing",
"kNNs",
"have",
"been",
"removed",
"and",
"as",
"a",
"result",
"some",
"kNNs",
"have",
"been",
"changed",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNPreprocessor.java#L327-L335 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/StringUtil.java | StringUtil.getTokens | public static String[] getTokens(String str, String delim, boolean trim) {
"""
Splits given string into tokens with delimiters specified.
It uses StringTokenizer for tokenizing.
@param str string to be tokenized
@param delim delimiters used for tokenizing
@param trim trim the tokens
@return non-null token array
"""
StringTokenizer stok = new StringTokenizer(str, delim);
String tokens[] = new String[stok.countTokens()];
for(int i=0; i<tokens.length; i++){
tokens[i] = stok.nextToken();
if(trim)
tokens[i] = tokens[i].trim();
}
return tokens;
} | java | public static String[] getTokens(String str, String delim, boolean trim){
StringTokenizer stok = new StringTokenizer(str, delim);
String tokens[] = new String[stok.countTokens()];
for(int i=0; i<tokens.length; i++){
tokens[i] = stok.nextToken();
if(trim)
tokens[i] = tokens[i].trim();
}
return tokens;
} | [
"public",
"static",
"String",
"[",
"]",
"getTokens",
"(",
"String",
"str",
",",
"String",
"delim",
",",
"boolean",
"trim",
")",
"{",
"StringTokenizer",
"stok",
"=",
"new",
"StringTokenizer",
"(",
"str",
",",
"delim",
")",
";",
"String",
"tokens",
"[",
"]... | Splits given string into tokens with delimiters specified.
It uses StringTokenizer for tokenizing.
@param str string to be tokenized
@param delim delimiters used for tokenizing
@param trim trim the tokens
@return non-null token array | [
"Splits",
"given",
"string",
"into",
"tokens",
"with",
"delimiters",
"specified",
".",
"It",
"uses",
"StringTokenizer",
"for",
"tokenizing",
"."
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/StringUtil.java#L79-L88 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Entity.java | Entity.getListRelation | <T extends ListValue> T getListRelation(Class<T> valuesClass, String name) {
"""
Method getListRelation.
@param valuesClass Class<T>.
@param name String.
@return T.
"""
return getRelation(valuesClass, name, true);
} | java | <T extends ListValue> T getListRelation(Class<T> valuesClass, String name) {
return getRelation(valuesClass, name, true);
} | [
"<",
"T",
"extends",
"ListValue",
">",
"T",
"getListRelation",
"(",
"Class",
"<",
"T",
">",
"valuesClass",
",",
"String",
"name",
")",
"{",
"return",
"getRelation",
"(",
"valuesClass",
",",
"name",
",",
"true",
")",
";",
"}"
] | Method getListRelation.
@param valuesClass Class<T>.
@param name String.
@return T. | [
"Method",
"getListRelation",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Entity.java#L335-L337 |
joniles/mpxj | src/main/java/net/sf/mpxj/ActivityCode.java | ActivityCode.addValue | public ActivityCodeValue addValue(Integer uniqueID, String name, String description) {
"""
Add a value to this activity code.
@param uniqueID value unique ID
@param name value name
@param description value description
@return ActivityCodeValue instance
"""
ActivityCodeValue value = new ActivityCodeValue(this, uniqueID, name, description);
m_values.add(value);
return value;
} | java | public ActivityCodeValue addValue(Integer uniqueID, String name, String description)
{
ActivityCodeValue value = new ActivityCodeValue(this, uniqueID, name, description);
m_values.add(value);
return value;
} | [
"public",
"ActivityCodeValue",
"addValue",
"(",
"Integer",
"uniqueID",
",",
"String",
"name",
",",
"String",
"description",
")",
"{",
"ActivityCodeValue",
"value",
"=",
"new",
"ActivityCodeValue",
"(",
"this",
",",
"uniqueID",
",",
"name",
",",
"description",
")... | Add a value to this activity code.
@param uniqueID value unique ID
@param name value name
@param description value description
@return ActivityCodeValue instance | [
"Add",
"a",
"value",
"to",
"this",
"activity",
"code",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ActivityCode.java#L75-L80 |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/GetConsoleOutputResult.java | GetConsoleOutputResult.getDecodedOutput | public String getDecodedOutput() {
"""
The decoded console output.
@return The decoded console output.
"""
byte[] bytes = com.amazonaws.util.BinaryUtils.fromBase64(output);
return new String(bytes, com.amazonaws.util.StringUtils.UTF8);
} | java | public String getDecodedOutput() {
byte[] bytes = com.amazonaws.util.BinaryUtils.fromBase64(output);
return new String(bytes, com.amazonaws.util.StringUtils.UTF8);
} | [
"public",
"String",
"getDecodedOutput",
"(",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"com",
".",
"amazonaws",
".",
"util",
".",
"BinaryUtils",
".",
"fromBase64",
"(",
"output",
")",
";",
"return",
"new",
"String",
"(",
"bytes",
",",
"com",
".",
"amaz... | The decoded console output.
@return The decoded console output. | [
"The",
"decoded",
"console",
"output",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/GetConsoleOutputResult.java#L173-L176 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java | ModbusSerialTransport.writeAsciiBytes | int writeAsciiBytes(byte[] buffer, long bytesToWrite) throws IOException {
"""
Writes an array of bytes out as a stream of ascii characters
@param buffer Buffer of bytes to write
@param bytesToWrite Number of characters to write
@return Number of bytes written
@throws IOException If a problem with the port
"""
if (commPort != null && commPort.isOpen()) {
int cnt = 0;
for (int i = 0; i < bytesToWrite; i++) {
if (writeAsciiByte(buffer[i]) != 2) {
return cnt;
}
cnt++;
}
return cnt;
}
else {
throw new IOException("Comm port is not valid or not open");
}
} | java | int writeAsciiBytes(byte[] buffer, long bytesToWrite) throws IOException {
if (commPort != null && commPort.isOpen()) {
int cnt = 0;
for (int i = 0; i < bytesToWrite; i++) {
if (writeAsciiByte(buffer[i]) != 2) {
return cnt;
}
cnt++;
}
return cnt;
}
else {
throw new IOException("Comm port is not valid or not open");
}
} | [
"int",
"writeAsciiBytes",
"(",
"byte",
"[",
"]",
"buffer",
",",
"long",
"bytesToWrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"commPort",
"!=",
"null",
"&&",
"commPort",
".",
"isOpen",
"(",
")",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"for",
"... | Writes an array of bytes out as a stream of ascii characters
@param buffer Buffer of bytes to write
@param bytesToWrite Number of characters to write
@return Number of bytes written
@throws IOException If a problem with the port | [
"Writes",
"an",
"array",
"of",
"bytes",
"out",
"as",
"a",
"stream",
"of",
"ascii",
"characters"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java#L538-L552 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/REST.java | REST.getNonOAuth | @Override
public Response getNonOAuth(String path, Map<String, String> parameters) {
"""
Invoke a non OAuth HTTP GET request on a remote host.
<p>
This is only used for the Flickr OAuth methods checkToken and getAccessToken.
@param path The request path
@param parameters The parameters
@return The Response
"""
InputStream in = null;
try {
URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters);
if (Flickr.debugRequest) {
logger.debug("GET: " + url);
}
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
if (proxyAuth) {
conn.setRequestProperty("Proxy-Authorization", "Basic " + getProxyCredentials());
}
setTimeouts(conn);
conn.connect();
if (Flickr.debugStream) {
in = new DebugInputStream(conn.getInputStream(), System.out);
} else {
in = conn.getInputStream();
}
Response response;
DocumentBuilder builder = getDocumentBuilder();
Document document = builder.parse(in);
response = (Response) responseClass.newInstance();
response.parse(document);
return response;
} catch (IllegalAccessException | SAXException | IOException | InstantiationException | ParserConfigurationException e) {
throw new FlickrRuntimeException(e);
} finally {
IOUtilities.close(in);
}
} | java | @Override
public Response getNonOAuth(String path, Map<String, String> parameters) {
InputStream in = null;
try {
URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters);
if (Flickr.debugRequest) {
logger.debug("GET: " + url);
}
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
if (proxyAuth) {
conn.setRequestProperty("Proxy-Authorization", "Basic " + getProxyCredentials());
}
setTimeouts(conn);
conn.connect();
if (Flickr.debugStream) {
in = new DebugInputStream(conn.getInputStream(), System.out);
} else {
in = conn.getInputStream();
}
Response response;
DocumentBuilder builder = getDocumentBuilder();
Document document = builder.parse(in);
response = (Response) responseClass.newInstance();
response.parse(document);
return response;
} catch (IllegalAccessException | SAXException | IOException | InstantiationException | ParserConfigurationException e) {
throw new FlickrRuntimeException(e);
} finally {
IOUtilities.close(in);
}
} | [
"@",
"Override",
"public",
"Response",
"getNonOAuth",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"URL",
"url",
"=",
"UrlUtilities",
".",
"buildUrl",
"("... | Invoke a non OAuth HTTP GET request on a remote host.
<p>
This is only used for the Flickr OAuth methods checkToken and getAccessToken.
@param path The request path
@param parameters The parameters
@return The Response | [
"Invoke",
"a",
"non",
"OAuth",
"HTTP",
"GET",
"request",
"on",
"a",
"remote",
"host",
".",
"<p",
">",
"This",
"is",
"only",
"used",
"for",
"the",
"Flickr",
"OAuth",
"methods",
"checkToken",
"and",
"getAccessToken",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L281-L315 |
cojen/Cojen | src/main/java/org/cojen/util/ThrowUnchecked.java | ThrowUnchecked.fireDeclaredCause | public static void fireDeclaredCause(Throwable t, Class... declaredTypes) {
"""
Throws the cause of the given exception if it is unchecked or an
instance of any of the given declared types. Otherwise, it is thrown as
an UndeclaredThrowableException. If the cause is null, then the original
exception is thrown. This method only returns normally if the exception
is null.
@param t exception whose cause is to be thrown
@param declaredTypes if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.
"""
if (t != null) {
Throwable cause = t.getCause();
if (cause == null) {
cause = t;
}
fireDeclared(cause, declaredTypes);
}
} | java | public static void fireDeclaredCause(Throwable t, Class... declaredTypes) {
if (t != null) {
Throwable cause = t.getCause();
if (cause == null) {
cause = t;
}
fireDeclared(cause, declaredTypes);
}
} | [
"public",
"static",
"void",
"fireDeclaredCause",
"(",
"Throwable",
"t",
",",
"Class",
"...",
"declaredTypes",
")",
"{",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"Throwable",
"cause",
"=",
"t",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"==",
... | Throws the cause of the given exception if it is unchecked or an
instance of any of the given declared types. Otherwise, it is thrown as
an UndeclaredThrowableException. If the cause is null, then the original
exception is thrown. This method only returns normally if the exception
is null.
@param t exception whose cause is to be thrown
@param declaredTypes if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException. | [
"Throws",
"the",
"cause",
"of",
"the",
"given",
"exception",
"if",
"it",
"is",
"unchecked",
"or",
"an",
"instance",
"of",
"any",
"of",
"the",
"given",
"declared",
"types",
".",
"Otherwise",
"it",
"is",
"thrown",
"as",
"an",
"UndeclaredThrowableException",
".... | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/util/ThrowUnchecked.java#L206-L214 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.getDerivedColor | protected final Color getDerivedColor(Color color1, Color color2,
float midPoint) {
"""
Decodes and returns a color, which is derived from a offset between two
other colors.
@param color1 The first color
@param color2 The second color
@param midPoint The offset between color 1 and color 2, a value of 0.0 is
color 1 and 1.0 is color 2;
@return The derived color, which will be a UIResource
"""
return getDerivedColor(color1, color2, midPoint, true);
} | java | protected final Color getDerivedColor(Color color1, Color color2,
float midPoint) {
return getDerivedColor(color1, color2, midPoint, true);
} | [
"protected",
"final",
"Color",
"getDerivedColor",
"(",
"Color",
"color1",
",",
"Color",
"color2",
",",
"float",
"midPoint",
")",
"{",
"return",
"getDerivedColor",
"(",
"color1",
",",
"color2",
",",
"midPoint",
",",
"true",
")",
";",
"}"
] | Decodes and returns a color, which is derived from a offset between two
other colors.
@param color1 The first color
@param color2 The second color
@param midPoint The offset between color 1 and color 2, a value of 0.0 is
color 1 and 1.0 is color 2;
@return The derived color, which will be a UIResource | [
"Decodes",
"and",
"returns",
"a",
"color",
"which",
"is",
"derived",
"from",
"a",
"offset",
"between",
"two",
"other",
"colors",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L3470-L3473 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.put | public Sftp put(String srcFilePath, String destPath, Mode mode) {
"""
将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。
@param srcFilePath 本地文件路径
@param destPath 目标路径,
@param mode {@link Mode} 模式
@return this
"""
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | java | public Sftp put(String srcFilePath, String destPath, Mode mode) {
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | [
"public",
"Sftp",
"put",
"(",
"String",
"srcFilePath",
",",
"String",
"destPath",
",",
"Mode",
"mode",
")",
"{",
"try",
"{",
"channel",
".",
"put",
"(",
"srcFilePath",
",",
"destPath",
",",
"mode",
".",
"ordinal",
"(",
")",
")",
";",
"}",
"catch",
"(... | 将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。
@param srcFilePath 本地文件路径
@param destPath 目标路径,
@param mode {@link Mode} 模式
@return this | [
"将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L375-L382 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.ambWith | @SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> ambWith(Publisher<? extends T> other) {
"""
Mirrors the Publisher (current or provided) that first either emits an item or sends a termination
notification.
<p>
<img width="640" height="385" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/amb.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator itself doesn't interfere with backpressure which is determined by the winning
{@code Publisher}'s backpressure behavior.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code ambWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param other
a Publisher competing to react first. A subscription to this provided Publisher will occur after subscribing
to the current Publisher.
@return a Flowable that emits the same sequence as whichever of the source Publishers first
emitted an item or sent a termination notification
@see <a href="http://reactivex.io/documentation/operators/amb.html">ReactiveX operators documentation: Amb</a>
"""
ObjectHelper.requireNonNull(other, "other is null");
return ambArray(this, other);
} | java | @SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> ambWith(Publisher<? extends T> other) {
ObjectHelper.requireNonNull(other, "other is null");
return ambArray(this, other);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
... | Mirrors the Publisher (current or provided) that first either emits an item or sends a termination
notification.
<p>
<img width="640" height="385" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/amb.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator itself doesn't interfere with backpressure which is determined by the winning
{@code Publisher}'s backpressure behavior.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code ambWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param other
a Publisher competing to react first. A subscription to this provided Publisher will occur after subscribing
to the current Publisher.
@return a Flowable that emits the same sequence as whichever of the source Publishers first
emitted an item or sent a termination notification
@see <a href="http://reactivex.io/documentation/operators/amb.html">ReactiveX operators documentation: Amb</a> | [
"Mirrors",
"the",
"Publisher",
"(",
"current",
"or",
"provided",
")",
"that",
"first",
"either",
"emits",
"an",
"item",
"or",
"sends",
"a",
"termination",
"notification",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"385",
"src",
"=",
"htt... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L5418-L5425 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java | S3Manager.getObject | public S3Object getObject(String bucketName, String objectKey) {
"""
Download an S3 object.
@param bucketName The S3 bucket name from which to download the object.
@param objectKey The S3 key name of the object to download.
@return The downloaded
<a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/S3Object.html">S3Object</a>.
"""
try {
return s3Client.getObject(bucketName, objectKey);
} catch (AmazonServiceException e) {
logger.error("Failed to get object " + objectKey + " from s3 bucket " + bucketName);
throw e;
}
} | java | public S3Object getObject(String bucketName, String objectKey) {
try {
return s3Client.getObject(bucketName, objectKey);
} catch (AmazonServiceException e) {
logger.error("Failed to get object " + objectKey + " from s3 bucket " + bucketName);
throw e;
}
} | [
"public",
"S3Object",
"getObject",
"(",
"String",
"bucketName",
",",
"String",
"objectKey",
")",
"{",
"try",
"{",
"return",
"s3Client",
".",
"getObject",
"(",
"bucketName",
",",
"objectKey",
")",
";",
"}",
"catch",
"(",
"AmazonServiceException",
"e",
")",
"{... | Download an S3 object.
@param bucketName The S3 bucket name from which to download the object.
@param objectKey The S3 key name of the object to download.
@return The downloaded
<a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/S3Object.html">S3Object</a>. | [
"Download",
"an",
"S3",
"object",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java#L110-L117 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/DimensionSelectorUtils.java | DimensionSelectorUtils.makeValueMatcherGeneric | public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, Predicate<String> predicate) {
"""
Generic implementation of {@link DimensionSelector#makeValueMatcher(Predicate)}, uses {@link
DimensionSelector#getRow()} of the given {@link DimensionSelector}. "Lazy" DimensionSelectors could delegate
{@code makeValueMatcher()} to this method, but encouraged to implement {@code makeValueMatcher()} themselves,
bypassing the {@link IndexedInts} abstraction.
"""
int cardinality = selector.getValueCardinality();
if (cardinality >= 0 && selector.nameLookupPossibleInAdvance()) {
return makeDictionaryEncodedValueMatcherGeneric(selector, predicate);
} else {
return makeNonDictionaryEncodedValueMatcherGeneric(selector, predicate);
}
} | java | public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, Predicate<String> predicate)
{
int cardinality = selector.getValueCardinality();
if (cardinality >= 0 && selector.nameLookupPossibleInAdvance()) {
return makeDictionaryEncodedValueMatcherGeneric(selector, predicate);
} else {
return makeNonDictionaryEncodedValueMatcherGeneric(selector, predicate);
}
} | [
"public",
"static",
"ValueMatcher",
"makeValueMatcherGeneric",
"(",
"DimensionSelector",
"selector",
",",
"Predicate",
"<",
"String",
">",
"predicate",
")",
"{",
"int",
"cardinality",
"=",
"selector",
".",
"getValueCardinality",
"(",
")",
";",
"if",
"(",
"cardinal... | Generic implementation of {@link DimensionSelector#makeValueMatcher(Predicate)}, uses {@link
DimensionSelector#getRow()} of the given {@link DimensionSelector}. "Lazy" DimensionSelectors could delegate
{@code makeValueMatcher()} to this method, but encouraged to implement {@code makeValueMatcher()} themselves,
bypassing the {@link IndexedInts} abstraction. | [
"Generic",
"implementation",
"of",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/DimensionSelectorUtils.java#L156-L164 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java | Converter.toObject | public Object toObject(final String pString, final Class pType) throws ConversionException {
"""
Converts the string to an object of the given type.
@param pString the string to convert
@param pType the type to convert to
@return the object created from the given string.
@throws ConversionException if the string cannot be converted for any
reason.
"""
return toObject(pString, pType, null);
} | java | public Object toObject(final String pString, final Class pType) throws ConversionException {
return toObject(pString, pType, null);
} | [
"public",
"Object",
"toObject",
"(",
"final",
"String",
"pString",
",",
"final",
"Class",
"pType",
")",
"throws",
"ConversionException",
"{",
"return",
"toObject",
"(",
"pString",
",",
"pType",
",",
"null",
")",
";",
"}"
] | Converts the string to an object of the given type.
@param pString the string to convert
@param pType the type to convert to
@return the object created from the given string.
@throws ConversionException if the string cannot be converted for any
reason. | [
"Converts",
"the",
"string",
"to",
"an",
"object",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java#L149-L151 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/index/IndexUpdateTransactionEventHandler.java | IndexUpdateTransactionEventHandler.indexUpdate | private Void indexUpdate(Collection<Consumer<Void>> state, Consumer<Void> indexAction) {
"""
in async mode add the index action to a collection for consumption in {@link #afterCommit(TransactionData, Collection)}, in sync mode, run it directly
"""
if (async) {
state.add(indexAction);
} else {
indexAction.accept(null);
}
return null;
} | java | private Void indexUpdate(Collection<Consumer<Void>> state, Consumer<Void> indexAction) {
if (async) {
state.add(indexAction);
} else {
indexAction.accept(null);
}
return null;
} | [
"private",
"Void",
"indexUpdate",
"(",
"Collection",
"<",
"Consumer",
"<",
"Void",
">",
">",
"state",
",",
"Consumer",
"<",
"Void",
">",
"indexAction",
")",
"{",
"if",
"(",
"async",
")",
"{",
"state",
".",
"add",
"(",
"indexAction",
")",
";",
"}",
"e... | in async mode add the index action to a collection for consumption in {@link #afterCommit(TransactionData, Collection)}, in sync mode, run it directly | [
"in",
"async",
"mode",
"add",
"the",
"index",
"action",
"to",
"a",
"collection",
"for",
"consumption",
"in",
"{"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/index/IndexUpdateTransactionEventHandler.java#L202-L209 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.