repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.checkRasterMapConsistence | public static boolean checkRasterMapConsistence( String mapsetPath, String mapname ) {
File file = null;
File file2 = null;
file = new File(mapsetPath + File.separator + GrassLegacyConstans.FCELL + File.separator + mapname);
file2 = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL + File.separator + mapname);
// the map is in one of the two
if (!file.exists() && !file2.exists())
return false;
/*
* helper files
*/
file = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator + mapname);
if (!file.exists())
return false;
// it is important that the folder cell_misc/mapname comes before the
// files in it
file = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator + mapname);
if (!file.exists())
return false;
return true;
} | java | public static boolean checkRasterMapConsistence( String mapsetPath, String mapname ) {
File file = null;
File file2 = null;
file = new File(mapsetPath + File.separator + GrassLegacyConstans.FCELL + File.separator + mapname);
file2 = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL + File.separator + mapname);
// the map is in one of the two
if (!file.exists() && !file2.exists())
return false;
/*
* helper files
*/
file = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator + mapname);
if (!file.exists())
return false;
// it is important that the folder cell_misc/mapname comes before the
// files in it
file = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator + mapname);
if (!file.exists())
return false;
return true;
} | [
"public",
"static",
"boolean",
"checkRasterMapConsistence",
"(",
"String",
"mapsetPath",
",",
"String",
"mapname",
")",
"{",
"File",
"file",
"=",
"null",
";",
"File",
"file2",
"=",
"null",
";",
"file",
"=",
"new",
"File",
"(",
"mapsetPath",
"+",
"File",
".... | Returns the list of files involved in the raster map issues. If for example a map has to be
deleted, then all these files have to.
@param mapsetPath - the path of the mapset
@param mapname -the name of the map
@return the array of strings containing the full path to the involved files | [
"Returns",
"the",
"list",
"of",
"files",
"involved",
"in",
"the",
"raster",
"map",
"issues",
".",
"If",
"for",
"example",
"a",
"map",
"has",
"to",
"be",
"deleted",
"then",
"all",
"these",
"files",
"have",
"to",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L290-L312 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java | StructureSequenceMatcher.getSubstructureMatchingProteinSequence | public static Structure getSubstructureMatchingProteinSequence(ProteinSequence sequence, Structure wholeStructure) {
ResidueNumber[] rns = matchSequenceToStructure(sequence, wholeStructure);
Structure structure = wholeStructure.clone();
structure.setChains(new ArrayList<>());
// structure.getHetGroups().clear();
Chain currentChain = null;
for (ResidueNumber rn : rns) {
if (rn == null) continue;
Group group; // note that we don't clone
try {
group = StructureTools.getGroupByPDBResidueNumber(wholeStructure, rn);
} catch (StructureException e) {
throw new IllegalArgumentException("Could not find residue " + rn + " in structure", e);
}
Chain chain = new ChainImpl();
chain.setName(group.getChain().getName());
chain.setId(group.getChain().getId());
if (currentChain == null || !currentChain.getId().equals(chain.getId())) {
structure.addChain(chain);
chain.setEntityInfo(group.getChain().getEntityInfo());
chain.setStructure(structure);
chain.setSwissprotId(group.getChain().getSwissprotId());
chain.setId(group.getChain().getId());
chain.setName(group.getChain().getName());
currentChain = chain;
}
currentChain.addGroup(group);
}
return structure;
} | java | public static Structure getSubstructureMatchingProteinSequence(ProteinSequence sequence, Structure wholeStructure) {
ResidueNumber[] rns = matchSequenceToStructure(sequence, wholeStructure);
Structure structure = wholeStructure.clone();
structure.setChains(new ArrayList<>());
// structure.getHetGroups().clear();
Chain currentChain = null;
for (ResidueNumber rn : rns) {
if (rn == null) continue;
Group group; // note that we don't clone
try {
group = StructureTools.getGroupByPDBResidueNumber(wholeStructure, rn);
} catch (StructureException e) {
throw new IllegalArgumentException("Could not find residue " + rn + " in structure", e);
}
Chain chain = new ChainImpl();
chain.setName(group.getChain().getName());
chain.setId(group.getChain().getId());
if (currentChain == null || !currentChain.getId().equals(chain.getId())) {
structure.addChain(chain);
chain.setEntityInfo(group.getChain().getEntityInfo());
chain.setStructure(structure);
chain.setSwissprotId(group.getChain().getSwissprotId());
chain.setId(group.getChain().getId());
chain.setName(group.getChain().getName());
currentChain = chain;
}
currentChain.addGroup(group);
}
return structure;
} | [
"public",
"static",
"Structure",
"getSubstructureMatchingProteinSequence",
"(",
"ProteinSequence",
"sequence",
",",
"Structure",
"wholeStructure",
")",
"{",
"ResidueNumber",
"[",
"]",
"rns",
"=",
"matchSequenceToStructure",
"(",
"sequence",
",",
"wholeStructure",
")",
"... | Get a substructure of {@code wholeStructure} containing only the {@link Group Groups} that are included in
{@code sequence}. The resulting structure will contain only {@code ATOM} residues; the SEQ-RES will be empty.
The {@link Chain Chains} of the Structure will be new instances (cloned), but the {@link Group Groups} will not.
@param sequence The input protein sequence
@param wholeStructure The structure from which to take a substructure
@return The resulting structure
@throws StructureException
@see {@link #matchSequenceToStructure(ProteinSequence, Structure)} | [
"Get",
"a",
"substructure",
"of",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java#L65-L94 |
lukas-krecan/json2xml | src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java | JsonXmlHelper.convertToJson | public static void convertToJson(Node node, JsonGenerator generator, ElementNameConverter converter) throws IOException {
Element element;
if (node instanceof Document) {
element = ((Document) node).getDocumentElement();
} else if (node instanceof Element) {
element = (Element) node;
} else {
throw new IllegalArgumentException("Node must be either a Document or an Element");
}
TYPE type = toTYPE(element.getAttribute("type"));
switch (type) {
case OBJECT:
case ARRAY:
convertElement(generator, element, true, converter);
break;
default:
throw new RuntimeException("invalid root type [" + type + "]");
}
generator.close();
} | java | public static void convertToJson(Node node, JsonGenerator generator, ElementNameConverter converter) throws IOException {
Element element;
if (node instanceof Document) {
element = ((Document) node).getDocumentElement();
} else if (node instanceof Element) {
element = (Element) node;
} else {
throw new IllegalArgumentException("Node must be either a Document or an Element");
}
TYPE type = toTYPE(element.getAttribute("type"));
switch (type) {
case OBJECT:
case ARRAY:
convertElement(generator, element, true, converter);
break;
default:
throw new RuntimeException("invalid root type [" + type + "]");
}
generator.close();
} | [
"public",
"static",
"void",
"convertToJson",
"(",
"Node",
"node",
",",
"JsonGenerator",
"generator",
",",
"ElementNameConverter",
"converter",
")",
"throws",
"IOException",
"{",
"Element",
"element",
";",
"if",
"(",
"node",
"instanceof",
"Document",
")",
"{",
"e... | More complete helper method to convert DOM node back to JSON.The node
MUST have the "type" attributes (generated with addTypeAttributes flag
set as true).This method allows to customize the JsonGenerator.
@param node The DOM Node
@param generator A configured JsonGenerator
@param converter Converter to convert elements names from XML to JSON
@throws IOException | [
"More",
"complete",
"helper",
"method",
"to",
"convert",
"DOM",
"node",
"back",
"to",
"JSON",
".",
"The",
"node",
"MUST",
"have",
"the",
"type",
"attributes",
"(",
"generated",
"with",
"addTypeAttributes",
"flag",
"set",
"as",
"true",
")",
".",
"This",
"me... | train | https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L101-L121 |
aws/aws-sdk-java | aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/DecryptRequest.java | DecryptRequest.withEncryptionContext | public DecryptRequest withEncryptionContext(java.util.Map<String, String> encryptionContext) {
setEncryptionContext(encryptionContext);
return this;
} | java | public DecryptRequest withEncryptionContext(java.util.Map<String, String> encryptionContext) {
setEncryptionContext(encryptionContext);
return this;
} | [
"public",
"DecryptRequest",
"withEncryptionContext",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"encryptionContext",
")",
"{",
"setEncryptionContext",
"(",
"encryptionContext",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The encryption context. If this was specified in the <a>Encrypt</a> function, it must be specified here or the
decryption operation will fail. For more information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html">Encryption Context</a>.
</p>
@param encryptionContext
The encryption context. If this was specified in the <a>Encrypt</a> function, it must be specified here or
the decryption operation will fail. For more information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html">Encryption
Context</a>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"encryption",
"context",
".",
"If",
"this",
"was",
"specified",
"in",
"the",
"<a",
">",
"Encrypt<",
"/",
"a",
">",
"function",
"it",
"must",
"be",
"specified",
"here",
"or",
"the",
"decryption",
"operation",
"will",
"fail",
".",
"For",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/DecryptRequest.java#L173-L176 |
weld/core | impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java | CovariantTypes.isAssignableFrom | private static boolean isAssignableFrom(TypeVariable<?> type1, TypeVariable<?> type2) {
if (type1.equals(type2)) {
return true;
}
// if a type variable extends another type variable, it cannot declare other bounds
if (type2.getBounds()[0] instanceof TypeVariable<?>) {
return isAssignableFrom(type1, (TypeVariable<?>) type2.getBounds()[0]);
}
return false;
} | java | private static boolean isAssignableFrom(TypeVariable<?> type1, TypeVariable<?> type2) {
if (type1.equals(type2)) {
return true;
}
// if a type variable extends another type variable, it cannot declare other bounds
if (type2.getBounds()[0] instanceof TypeVariable<?>) {
return isAssignableFrom(type1, (TypeVariable<?>) type2.getBounds()[0]);
}
return false;
} | [
"private",
"static",
"boolean",
"isAssignableFrom",
"(",
"TypeVariable",
"<",
"?",
">",
"type1",
",",
"TypeVariable",
"<",
"?",
">",
"type2",
")",
"{",
"if",
"(",
"type1",
".",
"equals",
"(",
"type2",
")",
")",
"{",
"return",
"true",
";",
"}",
"// if a... | Returns <tt>true</tt> if <tt>type2</tt> is a "sub-variable" of <tt>type1</tt>, i.e. if they are equal or if
<tt>type2</tt> (transitively) extends <tt>type1</tt>. | [
"Returns",
"<tt",
">",
"true<",
"/",
"tt",
">",
"if",
"<tt",
">",
"type2<",
"/",
"tt",
">",
"is",
"a",
"sub",
"-",
"variable",
"of",
"<tt",
">",
"type1<",
"/",
"tt",
">",
"i",
".",
"e",
".",
"if",
"they",
"are",
"equal",
"or",
"if",
"<tt",
">... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java#L269-L278 |
VoltDB/voltdb | examples/windowing/procedures/windowing/InsertAndDeleteAfterDate.java | InsertAndDeleteAfterDate.run | public long run(String uuid, long val, TimestampType update_ts, TimestampType newestToDiscard, long targetMaxRowsToDelete) {
if (newestToDiscard == null) {
throw new VoltAbortException("newestToDiscard shouldn't be null.");
// It might be Long.MIN_VALUE as a TimestampType though.
}
if (targetMaxRowsToDelete <= 0) {
throw new VoltAbortException("maxRowsToDeletePerProc must be > 0.");
}
// This line inserts the row.
voltQueueSQL(insert, EXPECT_SCALAR_MATCH(1), uuid, val, update_ts);
// In the same round trip to the storage engine, count the rows.
voltQueueSQL(countMatchingRows, EXPECT_SCALAR_LONG, newestToDiscard);
// Can assume insert worked because of EXPECT_SCALAR_MATCH(1)
// Note that the index into the set of results tables below is the second table.
long agedOutCount = voltExecuteSQL()[1].asScalarLong();
if (agedOutCount > targetMaxRowsToDelete) {
// Find the timestamp of the row at position N in the sorted order, where N is the chunk size
voltQueueSQL(getNthOldestTimestamp, EXPECT_SCALAR, targetMaxRowsToDelete);
newestToDiscard = voltExecuteSQL()[0].fetchRow(0).getTimestampAsTimestamp(0);
}
// Delete all rows >= the timestamp found in the previous statement.
// This will delete AT LEAST N rows, but since timestamps may be non-unique,
// it might delete more than N. In the worst case, it could delete all rows
// if every row has an identical timestamp value. It is guaranteed to make
// progress. If we used strictly less than, it might not make progress.
// This is why the max rows to delete number is a target, not always a perfect max.
voltQueueSQL(deleteOlderThanDate, EXPECT_SCALAR_LONG, newestToDiscard);
long deletedCount = voltExecuteSQL(true)[0].asScalarLong();
return deletedCount;
} | java | public long run(String uuid, long val, TimestampType update_ts, TimestampType newestToDiscard, long targetMaxRowsToDelete) {
if (newestToDiscard == null) {
throw new VoltAbortException("newestToDiscard shouldn't be null.");
// It might be Long.MIN_VALUE as a TimestampType though.
}
if (targetMaxRowsToDelete <= 0) {
throw new VoltAbortException("maxRowsToDeletePerProc must be > 0.");
}
// This line inserts the row.
voltQueueSQL(insert, EXPECT_SCALAR_MATCH(1), uuid, val, update_ts);
// In the same round trip to the storage engine, count the rows.
voltQueueSQL(countMatchingRows, EXPECT_SCALAR_LONG, newestToDiscard);
// Can assume insert worked because of EXPECT_SCALAR_MATCH(1)
// Note that the index into the set of results tables below is the second table.
long agedOutCount = voltExecuteSQL()[1].asScalarLong();
if (agedOutCount > targetMaxRowsToDelete) {
// Find the timestamp of the row at position N in the sorted order, where N is the chunk size
voltQueueSQL(getNthOldestTimestamp, EXPECT_SCALAR, targetMaxRowsToDelete);
newestToDiscard = voltExecuteSQL()[0].fetchRow(0).getTimestampAsTimestamp(0);
}
// Delete all rows >= the timestamp found in the previous statement.
// This will delete AT LEAST N rows, but since timestamps may be non-unique,
// it might delete more than N. In the worst case, it could delete all rows
// if every row has an identical timestamp value. It is guaranteed to make
// progress. If we used strictly less than, it might not make progress.
// This is why the max rows to delete number is a target, not always a perfect max.
voltQueueSQL(deleteOlderThanDate, EXPECT_SCALAR_LONG, newestToDiscard);
long deletedCount = voltExecuteSQL(true)[0].asScalarLong();
return deletedCount;
} | [
"public",
"long",
"run",
"(",
"String",
"uuid",
",",
"long",
"val",
",",
"TimestampType",
"update_ts",
",",
"TimestampType",
"newestToDiscard",
",",
"long",
"targetMaxRowsToDelete",
")",
"{",
"if",
"(",
"newestToDiscard",
"==",
"null",
")",
"{",
"throw",
"new"... | Procedure main logic.
@param uuid Column value for tuple insertion and partitioning key for this procedure.
@param val Column value for tuple insertion.
@param update_ts Column value for tuple insertion.
@param newestToDiscard Try to remove any tuples as old or older than this value.
@param targetMaxRowsToDelete The upper limit on the number of rows to delete per transaction.
@return The number of deleted rows.
@throws VoltAbortException on bad input. | [
"Procedure",
"main",
"logic",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/windowing/procedures/windowing/InsertAndDeleteAfterDate.java#L74-L107 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseAdditiveExpression | private Expr parseAdditiveExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseMultiplicativeExpression(scope, terminated);
Token lookahead;
while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
Expr rhs = parseMultiplicativeExpression(scope, terminated);
switch (lookahead.kind) {
case Plus:
lhs = new Expr.IntegerAddition(Type.Void, lhs, rhs);
break;
case Minus:
lhs = new Expr.IntegerSubtraction(Type.Void, lhs, rhs);
break;
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs, start);
}
return lhs;
} | java | private Expr parseAdditiveExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseMultiplicativeExpression(scope, terminated);
Token lookahead;
while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
Expr rhs = parseMultiplicativeExpression(scope, terminated);
switch (lookahead.kind) {
case Plus:
lhs = new Expr.IntegerAddition(Type.Void, lhs, rhs);
break;
case Minus:
lhs = new Expr.IntegerSubtraction(Type.Void, lhs, rhs);
break;
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs, start);
}
return lhs;
} | [
"private",
"Expr",
"parseAdditiveExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"Expr",
"lhs",
"=",
"parseMultiplicativeExpression",
"(",
"scope",
",",
"terminated",
")",
";",
"Token",
"loo... | Parse an additive expression.
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"additive",
"expression",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2076-L2096 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.substituteWithEnvironment | public static String substituteWithEnvironment(String string0) throws SubstitutionException {
// turn environment into properties
Properties envProps = new Properties();
// add all system environment vars to the properties
envProps.putAll(System.getenv());
// delegate to other method using the default syntax $ENV{<key>}
return substituteWithProperties(string0, "$ENV{", "}", envProps);
} | java | public static String substituteWithEnvironment(String string0) throws SubstitutionException {
// turn environment into properties
Properties envProps = new Properties();
// add all system environment vars to the properties
envProps.putAll(System.getenv());
// delegate to other method using the default syntax $ENV{<key>}
return substituteWithProperties(string0, "$ENV{", "}", envProps);
} | [
"public",
"static",
"String",
"substituteWithEnvironment",
"(",
"String",
"string0",
")",
"throws",
"SubstitutionException",
"{",
"// turn environment into properties",
"Properties",
"envProps",
"=",
"new",
"Properties",
"(",
")",
";",
"// add all system environment vars to t... | Searches the string for occurrences of the pattern $ENV{key} and
attempts to replace this pattern with a value from the System environment
obtained using the 'key'. For example, including "$ENV{USERNAME}" in
a string and calling this method would then attempt to replace the entire
pattern with the value of the environment variable "USERNAME". The System
environment is obtained in Java with a call to System.getenv(). An environment variable is typically
defined in the Linux shell or Windows property tabs. NOTE: A Java System
property is not the same as an environment variable.
@param string0 The string to perform substitution on such as "Hello $ENV{USERNAME}".
This string may be null, empty, or contain one or more substitutions.
@return A string with all occurrences of keys substituted with their
values obtained from the System environment. Can be null if the
original string was null.
@throws SubstitutionException Thrown if a starting string was found, but the
ending string was not. Also, thrown if a key value was empty such
as using "$ENV{}". Finally, thrown if the property key was not
found in the properties object (could not be replaced).
@see #substituteWithProperties(java.lang.String, java.lang.String, java.lang.String, java.util.Properties) | [
"Searches",
"the",
"string",
"for",
"occurrences",
"of",
"the",
"pattern",
"$ENV",
"{",
"key",
"}",
"and",
"attempts",
"to",
"replace",
"this",
"pattern",
"with",
"a",
"value",
"from",
"the",
"System",
"environment",
"obtained",
"using",
"the",
"key",
".",
... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L70-L77 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java | SVGIcon.seBackgroundIconColor | public void seBackgroundIconColor(final Color color, final Color outline, final double width) {
setBackgroundIconColor(color);
backgroundIcon.setStroke(outline);
backgroundIcon.setStrokeWidth(width);
} | java | public void seBackgroundIconColor(final Color color, final Color outline, final double width) {
setBackgroundIconColor(color);
backgroundIcon.setStroke(outline);
backgroundIcon.setStrokeWidth(width);
} | [
"public",
"void",
"seBackgroundIconColor",
"(",
"final",
"Color",
"color",
",",
"final",
"Color",
"outline",
",",
"final",
"double",
"width",
")",
"{",
"setBackgroundIconColor",
"(",
"color",
")",
";",
"backgroundIcon",
".",
"setStroke",
"(",
"outline",
")",
"... | Method sets the icon color and a stroke with a given color and width.
@param color color for the background icon to be set
@param outline color for the stroke
@param width width of the stroke | [
"Method",
"sets",
"the",
"icon",
"color",
"and",
"a",
"stroke",
"with",
"a",
"given",
"color",
"and",
"width",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L479-L483 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.renamenx | @Override
public Long renamenx(final byte[] oldkey, final byte[] newkey) {
checkIsInMultiOrPipeline();
client.renamenx(oldkey, newkey);
return client.getIntegerReply();
} | java | @Override
public Long renamenx(final byte[] oldkey, final byte[] newkey) {
checkIsInMultiOrPipeline();
client.renamenx(oldkey, newkey);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"renamenx",
"(",
"final",
"byte",
"[",
"]",
"oldkey",
",",
"final",
"byte",
"[",
"]",
"newkey",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"renamenx",
"(",
"oldkey",
",",
"newkey",
")",
";",
"... | Rename oldkey into newkey but fails if the destination key newkey already exists.
<p>
Time complexity: O(1)
@param oldkey
@param newkey
@return Integer reply, specifically: 1 if the key was renamed 0 if the target key already exist | [
"Rename",
"oldkey",
"into",
"newkey",
"but",
"fails",
"if",
"the",
"destination",
"key",
"newkey",
"already",
"exists",
".",
"<p",
">",
"Time",
"complexity",
":",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L436-L441 |
landawn/AbacusUtil | src/com/landawn/abacus/util/TriIterator.java | TriIterator.generate | public static <A, B, C> TriIterator<A, B, C> generate(final Consumer<Triple<A, B, C>> output) {
return generate(BooleanSupplier.TRUE, output);
} | java | public static <A, B, C> TriIterator<A, B, C> generate(final Consumer<Triple<A, B, C>> output) {
return generate(BooleanSupplier.TRUE, output);
} | [
"public",
"static",
"<",
"A",
",",
"B",
",",
"C",
">",
"TriIterator",
"<",
"A",
",",
"B",
",",
"C",
">",
"generate",
"(",
"final",
"Consumer",
"<",
"Triple",
"<",
"A",
",",
"B",
",",
"C",
">",
">",
"output",
")",
"{",
"return",
"generate",
"(",... | Returns an infinite {@code BiIterator}.
@param output transfer the next values.
@return | [
"Returns",
"an",
"infinite",
"{",
"@code",
"BiIterator",
"}",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/TriIterator.java#L71-L73 |
radkovo/SwingBox | src/main/java/org/fit/cssbox/swingbox/view/TextBoxView.java | TextBoxView.processPaint | protected void processPaint(Graphics gg, Shape a)
{
Graphics2D g = (Graphics2D) gg;
AffineTransform tmpTransform = g.getTransform();
if (!tmpTransform.equals(transform))
{
transform = tmpTransform;
invalidateTextLayout();
}
Component c = container;
int p0 = getStartOffset();
int p1 = getEndOffset();
Color fg = getForeground();
if (c instanceof JTextComponent)
{
JTextComponent tc = (JTextComponent) c;
if (!tc.isEnabled())
{
fg = tc.getDisabledTextColor();
}
// javax.swing.plaf.basic.BasicTextUI $ BasicHighlighter
// >> DefaultHighlighter
// >> DefaultHighlightPainter
Highlighter highLighter = tc.getHighlighter();
if (highLighter instanceof LayeredHighlighter)
{
((LayeredHighlighter) highLighter).paintLayeredHighlights(g, p0, p1, box.getAbsoluteContentBounds(), tc, this);
// (g, p0, p1, a, tc, this);
}
}
// nothing is selected
if (!box.isEmpty() && !getText().isEmpty())
renderContent(g, a, fg, p0, p1);
} | java | protected void processPaint(Graphics gg, Shape a)
{
Graphics2D g = (Graphics2D) gg;
AffineTransform tmpTransform = g.getTransform();
if (!tmpTransform.equals(transform))
{
transform = tmpTransform;
invalidateTextLayout();
}
Component c = container;
int p0 = getStartOffset();
int p1 = getEndOffset();
Color fg = getForeground();
if (c instanceof JTextComponent)
{
JTextComponent tc = (JTextComponent) c;
if (!tc.isEnabled())
{
fg = tc.getDisabledTextColor();
}
// javax.swing.plaf.basic.BasicTextUI $ BasicHighlighter
// >> DefaultHighlighter
// >> DefaultHighlightPainter
Highlighter highLighter = tc.getHighlighter();
if (highLighter instanceof LayeredHighlighter)
{
((LayeredHighlighter) highLighter).paintLayeredHighlights(g, p0, p1, box.getAbsoluteContentBounds(), tc, this);
// (g, p0, p1, a, tc, this);
}
}
// nothing is selected
if (!box.isEmpty() && !getText().isEmpty())
renderContent(g, a, fg, p0, p1);
} | [
"protected",
"void",
"processPaint",
"(",
"Graphics",
"gg",
",",
"Shape",
"a",
")",
"{",
"Graphics2D",
"g",
"=",
"(",
"Graphics2D",
")",
"gg",
";",
"AffineTransform",
"tmpTransform",
"=",
"g",
".",
"getTransform",
"(",
")",
";",
"if",
"(",
"!",
"tmpTrans... | Process paint.
@param gg
the graphics context
@param a
the allocation | [
"Process",
"paint",
"."
] | train | https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/view/TextBoxView.java#L359-L397 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java | DualInputSemanticProperties.addForwardedField2 | public void addForwardedField2(int sourceField, int destinationField) {
FieldSet fs;
if((fs = this.forwardedFields2.get(sourceField)) != null) {
fs.add(destinationField);
} else {
fs = new FieldSet(destinationField);
this.forwardedFields2.put(sourceField, fs);
}
} | java | public void addForwardedField2(int sourceField, int destinationField) {
FieldSet fs;
if((fs = this.forwardedFields2.get(sourceField)) != null) {
fs.add(destinationField);
} else {
fs = new FieldSet(destinationField);
this.forwardedFields2.put(sourceField, fs);
}
} | [
"public",
"void",
"addForwardedField2",
"(",
"int",
"sourceField",
",",
"int",
"destinationField",
")",
"{",
"FieldSet",
"fs",
";",
"if",
"(",
"(",
"fs",
"=",
"this",
".",
"forwardedFields2",
".",
"get",
"(",
"sourceField",
")",
")",
"!=",
"null",
")",
"... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) in the second input to the destination
record(s).
@param sourceField the position in the source record(s) from the first input
@param destinationField the position in the destination record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"in",
"the",
"second",
"input",
"to",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java#L124-L132 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.copyBits | public void copyBits(BufferedImage pSrcBitmap, Rectangle pSrcRect, Rectangle pDstRect, int pMode, Shape pMaskRgn) {
graphics.setComposite(getCompositeFor(pMode));
if (pMaskRgn != null) {
setClipRegion(pMaskRgn);
}
graphics.drawImage(
pSrcBitmap,
pDstRect.x,
pDstRect.y,
pDstRect.x + pDstRect.width,
pDstRect.y + pDstRect.height,
pSrcRect.x,
pSrcRect.y,
pSrcRect.x + pSrcRect.width,
pSrcRect.y + pSrcRect.height,
null
);
setClipRegion(null);
} | java | public void copyBits(BufferedImage pSrcBitmap, Rectangle pSrcRect, Rectangle pDstRect, int pMode, Shape pMaskRgn) {
graphics.setComposite(getCompositeFor(pMode));
if (pMaskRgn != null) {
setClipRegion(pMaskRgn);
}
graphics.drawImage(
pSrcBitmap,
pDstRect.x,
pDstRect.y,
pDstRect.x + pDstRect.width,
pDstRect.y + pDstRect.height,
pSrcRect.x,
pSrcRect.y,
pSrcRect.x + pSrcRect.width,
pSrcRect.y + pSrcRect.height,
null
);
setClipRegion(null);
} | [
"public",
"void",
"copyBits",
"(",
"BufferedImage",
"pSrcBitmap",
",",
"Rectangle",
"pSrcRect",
",",
"Rectangle",
"pDstRect",
",",
"int",
"pMode",
",",
"Shape",
"pMaskRgn",
")",
"{",
"graphics",
".",
"setComposite",
"(",
"getCompositeFor",
"(",
"pMode",
")",
"... | CopyBits.
<p/>
Note that the destination is always {@code this}.
@param pSrcBitmap the source bitmap to copy pixels from
@param pSrcRect the source rectangle
@param pDstRect the destination rectangle
@param pMode the blending mode
@param pMaskRgn the mask region | [
"CopyBits",
".",
"<p",
"/",
">",
"Note",
"that",
"the",
"destination",
"is",
"always",
"{",
"@code",
"this",
"}",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L933-L953 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricDistiller.java | MetricDistiller.setCommonAttributes | public static void setCommonAttributes(List<Metric> metrics, Metric result) {
MetricDistiller distiller = new MetricDistiller();
distiller.distill(metrics);
result.setDisplayName(distiller.getDisplayName());
result.setUnits(distiller.getUnits());
result.setTags(distiller.getTags());
} | java | public static void setCommonAttributes(List<Metric> metrics, Metric result) {
MetricDistiller distiller = new MetricDistiller();
distiller.distill(metrics);
result.setDisplayName(distiller.getDisplayName());
result.setUnits(distiller.getUnits());
result.setTags(distiller.getTags());
} | [
"public",
"static",
"void",
"setCommonAttributes",
"(",
"List",
"<",
"Metric",
">",
"metrics",
",",
"Metric",
"result",
")",
"{",
"MetricDistiller",
"distiller",
"=",
"new",
"MetricDistiller",
"(",
")",
";",
"distiller",
".",
"distill",
"(",
"metrics",
")",
... | Filters common attributes from list of metrics and writes them to result metric.
@param metrics - The set of metrics that needs to be filtered
@param result - The resultant metric that gets populated with the common tags | [
"Filters",
"common",
"attributes",
"from",
"list",
"of",
"metrics",
"and",
"writes",
"them",
"to",
"result",
"metric",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricDistiller.java#L65-L72 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java | Locale.setDefault | public static synchronized void setDefault(Locale.Category category,
Locale newLocale) {
if (category == null)
throw new NullPointerException("Category cannot be NULL");
if (newLocale == null)
throw new NullPointerException("Can't set default locale to NULL");
/* J2ObjC removed.
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new PropertyPermission
("user.language", "write"));*/
switch (category) {
case DISPLAY:
defaultDisplayLocale = newLocale;
break;
case FORMAT:
defaultFormatLocale = newLocale;
break;
default:
assert false: "Unknown Category";
}
} | java | public static synchronized void setDefault(Locale.Category category,
Locale newLocale) {
if (category == null)
throw new NullPointerException("Category cannot be NULL");
if (newLocale == null)
throw new NullPointerException("Can't set default locale to NULL");
/* J2ObjC removed.
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new PropertyPermission
("user.language", "write"));*/
switch (category) {
case DISPLAY:
defaultDisplayLocale = newLocale;
break;
case FORMAT:
defaultFormatLocale = newLocale;
break;
default:
assert false: "Unknown Category";
}
} | [
"public",
"static",
"synchronized",
"void",
"setDefault",
"(",
"Locale",
".",
"Category",
"category",
",",
"Locale",
"newLocale",
")",
"{",
"if",
"(",
"category",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Category cannot be NULL\"",
")",
... | Sets the default locale for the specified Category for this instance
of the Java Virtual Machine. This does not affect the host locale.
<p>
If there is a security manager, its checkPermission method is called
with a PropertyPermission("user.language", "write") permission before
the default locale is changed.
<p>
The Java Virtual Machine sets the default locale during startup based
on the host environment. It is used by many locale-sensitive methods
if no locale is explicitly specified.
<p>
Since changing the default locale may affect many different areas of
functionality, this method should only be used if the caller is
prepared to reinitialize locale-sensitive code running within the
same Java Virtual Machine.
<p>
@param category - the specified category to set the default locale
@param newLocale - the new default locale
@throws SecurityException - if a security manager exists and its
checkPermission method doesn't allow the operation.
@throws NullPointerException - if category and/or newLocale is null
@see SecurityManager#checkPermission(java.security.Permission)
@see PropertyPermission
@see #getDefault(Locale.Category)
@since 1.7 | [
"Sets",
"the",
"default",
"locale",
"for",
"the",
"specified",
"Category",
"for",
"this",
"instance",
"of",
"the",
"Java",
"Virtual",
"Machine",
".",
"This",
"does",
"not",
"affect",
"the",
"host",
"locale",
".",
"<p",
">",
"If",
"there",
"is",
"a",
"sec... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L968-L989 |
zerodhatech/javakiteconnect | kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java | KiteRequestHandler.createGetRequest | public Request createGetRequest(String url, String commonKey, String[] values, String apiKey, String accessToken) {
HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
for(int i = 0; i < values.length; i++) {
httpBuilder.addQueryParameter(commonKey, values[i]);
}
return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
} | java | public Request createGetRequest(String url, String commonKey, String[] values, String apiKey, String accessToken) {
HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
for(int i = 0; i < values.length; i++) {
httpBuilder.addQueryParameter(commonKey, values[i]);
}
return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
} | [
"public",
"Request",
"createGetRequest",
"(",
"String",
"url",
",",
"String",
"commonKey",
",",
"String",
"[",
"]",
"values",
",",
"String",
"apiKey",
",",
"String",
"accessToken",
")",
"{",
"HttpUrl",
".",
"Builder",
"httpBuilder",
"=",
"HttpUrl",
".",
"par... | Creates a GET request.
@param url is the endpoint to which request has to be done.
@param apiKey is the api key of the Kite Connect app.
@param accessToken is the access token obtained after successful login process.
@param commonKey is the key that has to be sent in query param for quote calls.
@param values is the values that has to be sent in query param like 265, 256265, NSE:INFY. | [
"Creates",
"a",
"GET",
"request",
"."
] | train | https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java#L184-L190 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_upload | public T photos_upload(File photo)
throws FacebookException, IOException {
return photos_upload(photo, /*caption*/ null, /*albumId*/ null) ;
} | java | public T photos_upload(File photo)
throws FacebookException, IOException {
return photos_upload(photo, /*caption*/ null, /*albumId*/ null) ;
} | [
"public",
"T",
"photos_upload",
"(",
"File",
"photo",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"photos_upload",
"(",
"photo",
",",
"/*caption*/",
"null",
",",
"/*albumId*/",
"null",
")",
";",
"}"
] | Uploads a photo to Facebook.
@param photo an image file
@return a T with the standard Facebook photo information
@see <a href="http://wiki.developers.facebook.com/index.php/Photos.upload">
Developers wiki: Photos.upload</a> | [
"Uploads",
"a",
"photo",
"to",
"Facebook",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1282-L1285 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | StorableGenerator.branchIfDirty | private void branchIfDirty(CodeBuilder b, boolean includePk, Label label) {
int count = mAllProperties.size();
int ordinal = 0;
int andMask = 0;
boolean anyNonDerived = false;
for (StorableProperty property : mAllProperties.values()) {
if (!property.isDerived()) {
anyNonDerived = true;
if (!property.isJoin() && (!property.isPrimaryKeyMember() || includePk)) {
// Logical 'and' will convert state 1 (clean) to state 0, so
// that it will be ignored. State 3 (dirty) is what we're
// looking for, and it turns into 2. Essentially, we leave the
// high order bit on, since there is no state which has the
// high order bit on unless the low order bit is also on.
andMask |= 2 << ((ordinal & 0xf) * 2);
}
}
ordinal++;
if ((ordinal & 0xf) == 0 || ordinal >= count) {
if (anyNonDerived) {
String stateFieldName = PROPERTY_STATE_FIELD_NAME + ((ordinal - 1) >> 4);
b.loadThis();
b.loadField(stateFieldName, TypeDesc.INT);
b.loadConstant(andMask);
b.math(Opcode.IAND);
// At least one property is dirty, so short circuit.
b.ifZeroComparisonBranch(label, "!=");
}
andMask = 0;
anyNonDerived = false;
}
}
} | java | private void branchIfDirty(CodeBuilder b, boolean includePk, Label label) {
int count = mAllProperties.size();
int ordinal = 0;
int andMask = 0;
boolean anyNonDerived = false;
for (StorableProperty property : mAllProperties.values()) {
if (!property.isDerived()) {
anyNonDerived = true;
if (!property.isJoin() && (!property.isPrimaryKeyMember() || includePk)) {
// Logical 'and' will convert state 1 (clean) to state 0, so
// that it will be ignored. State 3 (dirty) is what we're
// looking for, and it turns into 2. Essentially, we leave the
// high order bit on, since there is no state which has the
// high order bit on unless the low order bit is also on.
andMask |= 2 << ((ordinal & 0xf) * 2);
}
}
ordinal++;
if ((ordinal & 0xf) == 0 || ordinal >= count) {
if (anyNonDerived) {
String stateFieldName = PROPERTY_STATE_FIELD_NAME + ((ordinal - 1) >> 4);
b.loadThis();
b.loadField(stateFieldName, TypeDesc.INT);
b.loadConstant(andMask);
b.math(Opcode.IAND);
// At least one property is dirty, so short circuit.
b.ifZeroComparisonBranch(label, "!=");
}
andMask = 0;
anyNonDerived = false;
}
}
} | [
"private",
"void",
"branchIfDirty",
"(",
"CodeBuilder",
"b",
",",
"boolean",
"includePk",
",",
"Label",
"label",
")",
"{",
"int",
"count",
"=",
"mAllProperties",
".",
"size",
"(",
")",
";",
"int",
"ordinal",
"=",
"0",
";",
"int",
"andMask",
"=",
"0",
"... | Generates code that branches to the given label if any properties are dirty. | [
"Generates",
"code",
"that",
"branches",
"to",
"the",
"given",
"label",
"if",
"any",
"properties",
"are",
"dirty",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2423-L2458 |
bpsm/edn-java | src/main/java/us/bpsm/edn/Symbol.java | Symbol.newSymbol | public static Symbol newSymbol(String prefix, String name) {
checkArguments(prefix, name);
return new Symbol(prefix, name);
} | java | public static Symbol newSymbol(String prefix, String name) {
checkArguments(prefix, name);
return new Symbol(prefix, name);
} | [
"public",
"static",
"Symbol",
"newSymbol",
"(",
"String",
"prefix",
",",
"String",
"name",
")",
"{",
"checkArguments",
"(",
"prefix",
",",
"name",
")",
";",
"return",
"new",
"Symbol",
"(",
"prefix",
",",
"name",
")",
";",
"}"
] | Provide a Symbol with the given prefix and name.
@param prefix
An empty String or a non-empty String obeying the
restrictions specified by edn. Never null.
@param name
A non-empty string obeying the restrictions specified by edn.
Never null.
@return a Symbol, never null. | [
"Provide",
"a",
"Symbol",
"with",
"the",
"given",
"prefix",
"and",
"name",
"."
] | train | https://github.com/bpsm/edn-java/blob/c5dfdb77431da1aca3c257599b237a21575629b2/src/main/java/us/bpsm/edn/Symbol.java#L50-L53 |
MenoData/Time4J | base/src/main/java/net/time4j/MachineTime.java | MachineTime.ofPosixSeconds | public static MachineTime<TimeUnit> ofPosixSeconds(double seconds) {
if (Double.isInfinite(seconds) || Double.isNaN(seconds)) {
throw new IllegalArgumentException("Invalid value: " + seconds);
}
long secs = (long) Math.floor(seconds);
int fraction = (int) ((seconds - secs) * MRD);
return ofPosixUnits(secs, fraction);
} | java | public static MachineTime<TimeUnit> ofPosixSeconds(double seconds) {
if (Double.isInfinite(seconds) || Double.isNaN(seconds)) {
throw new IllegalArgumentException("Invalid value: " + seconds);
}
long secs = (long) Math.floor(seconds);
int fraction = (int) ((seconds - secs) * MRD);
return ofPosixUnits(secs, fraction);
} | [
"public",
"static",
"MachineTime",
"<",
"TimeUnit",
">",
"ofPosixSeconds",
"(",
"double",
"seconds",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"seconds",
")",
"||",
"Double",
".",
"isNaN",
"(",
"seconds",
")",
")",
"{",
"throw",
"new",
"Ille... | /*[deutsch]
<p>Erzeugt eine Dauer als Maschinenzeit auf der POSIX-Skala. </p>
@param seconds decimal POSIX-seconds
@return new machine time duration
@throws ArithmeticException in case of numerical overflow
@throws IllegalArgumentException if the argument is infinite or NaN
@since 2.0 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"eine",
"Dauer",
"als",
"Maschinenzeit",
"auf",
"der",
"POSIX",
"-",
"Skala",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/MachineTime.java#L330-L340 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_virtualNumbers_number_incoming_GET | public ArrayList<Long> serviceName_virtualNumbers_number_incoming_GET(String serviceName, String number, Date creationDatetime_from, Date creationDatetime_to, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/virtualNumbers/{number}/incoming";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_virtualNumbers_number_incoming_GET(String serviceName, String number, Date creationDatetime_from, Date creationDatetime_to, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/virtualNumbers/{number}/incoming";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_virtualNumbers_number_incoming_GET",
"(",
"String",
"serviceName",
",",
"String",
"number",
",",
"Date",
"creationDatetime_from",
",",
"Date",
"creationDatetime_to",
",",
"String",
"sender",
",",
"String",
"tag",
"... | Sms received associated to the sms account
REST: GET /sms/{serviceName}/virtualNumbers/{number}/incoming
@param creationDatetime_from [required] Filter the value of creationDatetime property (>=)
@param creationDatetime_to [required] Filter the value of creationDatetime property (<=)
@param tag [required] Filter the value of tag property (=)
@param sender [required] Filter the value of sender property (=)
@param serviceName [required] The internal name of your SMS offer
@param number [required] The virtual number | [
"Sms",
"received",
"associated",
"to",
"the",
"sms",
"account"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L410-L419 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java | CassandraClientBase.populateCounterFkey | private CounterColumn populateCounterFkey(String rlName, Object rlValue) {
CounterColumn counterCol = new CounterColumn();
counterCol.setName(PropertyAccessorFactory.STRING.toBytes(rlName));
counterCol.setValue((Long) rlValue);
return counterCol;
} | java | private CounterColumn populateCounterFkey(String rlName, Object rlValue) {
CounterColumn counterCol = new CounterColumn();
counterCol.setName(PropertyAccessorFactory.STRING.toBytes(rlName));
counterCol.setValue((Long) rlValue);
return counterCol;
} | [
"private",
"CounterColumn",
"populateCounterFkey",
"(",
"String",
"rlName",
",",
"Object",
"rlValue",
")",
"{",
"CounterColumn",
"counterCol",
"=",
"new",
"CounterColumn",
"(",
")",
";",
"counterCol",
".",
"setName",
"(",
"PropertyAccessorFactory",
".",
"STRING",
... | Populate counter fkey.
@param rlName
the rl name
@param rlValue
the rl value
@return the counter column | [
"Populate",
"counter",
"fkey",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java#L479-L484 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Popups.java | Popups.errorAbove | public static InfoPopup errorAbove (String message, Widget source)
{
return error(message, Position.ABOVE, source);
} | java | public static InfoPopup errorAbove (String message, Widget source)
{
return error(message, Position.ABOVE, source);
} | [
"public",
"static",
"InfoPopup",
"errorAbove",
"(",
"String",
"message",
",",
"Widget",
"source",
")",
"{",
"return",
"error",
"(",
"message",
",",
"Position",
".",
"ABOVE",
",",
"source",
")",
";",
"}"
] | Displays error feedback to the user in a non-offensive way. The error feedback is displayed
near the supplied component and if the component supports focus, it is focused. | [
"Displays",
"error",
"feedback",
"to",
"the",
"user",
"in",
"a",
"non",
"-",
"offensive",
"way",
".",
"The",
"error",
"feedback",
"is",
"displayed",
"near",
"the",
"supplied",
"component",
"and",
"if",
"the",
"component",
"supports",
"focus",
"it",
"is",
"... | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L127-L130 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/expt/ExtractAbbreviations.java | ExtractAbbreviations.main | public static void main(String[] args) {
if(args.length < 2){
System.out.println("Usage: ExtractAbbreviations input experiment_name [gold-file] [train-dir] \n\n"+
"input - Corpus file (one line per file) from which abbreviations will be extracted.\n"+
"experiment_name - The experiment name will be used to create these output files:\n"+
" './<name>_abbvs' - contains the abbreviations extracted from the corpus, in a format similar to './train/abbvAlign_pairs.txt', "+
"the abbreviations from each document are concatenated to one line.\n"+
" './<name>_strings' - contains pairs of short and long forms of abbreviations extracted from the corpus, "+
"in a format that can be used for a matching experiment (using MatchExpt, AbbreviationsBlocker, and AbbreviationAlignment distance)."+
"train - Optional. Directory containing a corpus file named 'abbvAlign_corpus.txt' for training the abbreviation HMM. "+
"Corpus format is one line per file.\n"+
" The model parameters will be saved in this directory under 'hmmModelParams.txt' so the HMM will only have to be trained once.\n"+
" Default = './train/'\n"+
"gold - Optional. If available, the gold data will be used to estimate the performance of the HMM on the input corpus.\n"+
" './train/abbvAlign_pairs.txt' is a sample gold file for the 'train/abbvAlign_corpus.txt corpus.'\n"+
" Default = by default, no gold data is given and no estimation is done."
);
System.exit(1);
}
String input = args[0];
String output = args[1];
String gold = null;
if(args.length > 2)
gold = args[2];
String train = "./train";
if(args.length > 3)
train = args[3];
ExtractAbbreviations tester = new ExtractAbbreviations(input, output, train, gold);
try {
tester.run();
} catch (IOException e) {
e.printStackTrace();
}
} | java | public static void main(String[] args) {
if(args.length < 2){
System.out.println("Usage: ExtractAbbreviations input experiment_name [gold-file] [train-dir] \n\n"+
"input - Corpus file (one line per file) from which abbreviations will be extracted.\n"+
"experiment_name - The experiment name will be used to create these output files:\n"+
" './<name>_abbvs' - contains the abbreviations extracted from the corpus, in a format similar to './train/abbvAlign_pairs.txt', "+
"the abbreviations from each document are concatenated to one line.\n"+
" './<name>_strings' - contains pairs of short and long forms of abbreviations extracted from the corpus, "+
"in a format that can be used for a matching experiment (using MatchExpt, AbbreviationsBlocker, and AbbreviationAlignment distance)."+
"train - Optional. Directory containing a corpus file named 'abbvAlign_corpus.txt' for training the abbreviation HMM. "+
"Corpus format is one line per file.\n"+
" The model parameters will be saved in this directory under 'hmmModelParams.txt' so the HMM will only have to be trained once.\n"+
" Default = './train/'\n"+
"gold - Optional. If available, the gold data will be used to estimate the performance of the HMM on the input corpus.\n"+
" './train/abbvAlign_pairs.txt' is a sample gold file for the 'train/abbvAlign_corpus.txt corpus.'\n"+
" Default = by default, no gold data is given and no estimation is done."
);
System.exit(1);
}
String input = args[0];
String output = args[1];
String gold = null;
if(args.length > 2)
gold = args[2];
String train = "./train";
if(args.length > 3)
train = args[3];
ExtractAbbreviations tester = new ExtractAbbreviations(input, output, train, gold);
try {
tester.run();
} catch (IOException e) {
e.printStackTrace();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"<",
"2",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage: ExtractAbbreviations input experiment_name [gold-file] [train-dir] \\n\\n\"",
... | Extracts abbreviation pairs from text.<br><br>
Usage: ExtractAbbreviations input experiment_name [gold-file] [train-dir] | [
"Extracts",
"abbreviation",
"pairs",
"from",
"text",
".",
"<br",
">",
"<br",
">",
"Usage",
":",
"ExtractAbbreviations",
"input",
"experiment_name",
"[",
"gold",
"-",
"file",
"]",
"[",
"train",
"-",
"dir",
"]"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/expt/ExtractAbbreviations.java#L256-L293 |
aws/aws-sdk-java | aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/SecretListEntry.java | SecretListEntry.withSecretVersionsToStages | public SecretListEntry withSecretVersionsToStages(java.util.Map<String, java.util.List<String>> secretVersionsToStages) {
setSecretVersionsToStages(secretVersionsToStages);
return this;
} | java | public SecretListEntry withSecretVersionsToStages(java.util.Map<String, java.util.List<String>> secretVersionsToStages) {
setSecretVersionsToStages(secretVersionsToStages);
return this;
} | [
"public",
"SecretListEntry",
"withSecretVersionsToStages",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"secretVersionsToStages",
")",
"{",
"setSecretVersionsToStages",
"(",
"secretVersionsToS... | <p>
A list of all of the currently assigned <code>SecretVersionStage</code> staging labels and the
<code>SecretVersionId</code> that each is attached to. Staging labels are used to keep track of the different
versions during the rotation process.
</p>
<note>
<p>
A version that does not have any <code>SecretVersionStage</code> is considered deprecated and subject to
deletion. Such versions are not included in this list.
</p>
</note>
@param secretVersionsToStages
A list of all of the currently assigned <code>SecretVersionStage</code> staging labels and the
<code>SecretVersionId</code> that each is attached to. Staging labels are used to keep track of the
different versions during the rotation process.</p> <note>
<p>
A version that does not have any <code>SecretVersionStage</code> is considered deprecated and subject to
deletion. Such versions are not included in this list.
</p>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"list",
"of",
"all",
"of",
"the",
"currently",
"assigned",
"<code",
">",
"SecretVersionStage<",
"/",
"code",
">",
"staging",
"labels",
"and",
"the",
"<code",
">",
"SecretVersionId<",
"/",
"code",
">",
"that",
"each",
"is",
"attached",
"to",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/SecretListEntry.java#L822-L825 |
influxdata/influxdb-java | src/main/java/org/influxdb/impl/Preconditions.java | Preconditions.checkNotNegativeNumber | public static void checkNotNegativeNumber(final Number number, final String name) throws IllegalArgumentException {
if (number == null || number.doubleValue() < 0) {
throw new IllegalArgumentException("Expecting a positive or zero number for " + name);
}
} | java | public static void checkNotNegativeNumber(final Number number, final String name) throws IllegalArgumentException {
if (number == null || number.doubleValue() < 0) {
throw new IllegalArgumentException("Expecting a positive or zero number for " + name);
}
} | [
"public",
"static",
"void",
"checkNotNegativeNumber",
"(",
"final",
"Number",
"number",
",",
"final",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"number",
"==",
"null",
"||",
"number",
".",
"doubleValue",
"(",
")",
"<",
"0",
... | Enforces that the number is not negative.
@param number the number to test
@param name variable name for reporting
@throws IllegalArgumentException if the number is less or equal to 0 | [
"Enforces",
"that",
"the",
"number",
"is",
"not",
"negative",
"."
] | train | https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/Preconditions.java#L45-L49 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/RtfWriter2.java | RtfWriter2.importRtfDocumentIntoElement | public void importRtfDocumentIntoElement(Element elem, FileInputStream documentSource, EventListener[] events) throws IOException, DocumentException {
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfDocumentIntoElement(elem, documentSource, rtfDoc);
} | java | public void importRtfDocumentIntoElement(Element elem, FileInputStream documentSource, EventListener[] events) throws IOException, DocumentException {
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfDocumentIntoElement(elem, documentSource, rtfDoc);
} | [
"public",
"void",
"importRtfDocumentIntoElement",
"(",
"Element",
"elem",
",",
"FileInputStream",
"documentSource",
",",
"EventListener",
"[",
"]",
"events",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"RtfParser",
"rtfImport",
"=",
"new",
"RtfParser"... | Adds the complete RTF document to the current RTF element being generated.
It will parse the font and color tables and correct the font and color references
so that the imported RTF document retains its formattings.
@param elem The Element the RTF document is to be imported into.
@param documentSource The Reader to read the RTF document from.
@param events The event array for listeners.
@throws IOException On errors reading the RTF document.
@throws DocumentException On errors adding to this RTF document.
@since 2.1.4 | [
"Adds",
"the",
"complete",
"RTF",
"document",
"to",
"the",
"current",
"RTF",
"element",
"being",
"generated",
".",
"It",
"will",
"parse",
"the",
"font",
"and",
"color",
"tables",
"and",
"correct",
"the",
"font",
"and",
"color",
"references",
"so",
"that",
... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L376-L385 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.getAncestor | public static Element getAncestor(Element element, String className) {
if (hasClass(className, element)) {
return element;
}
if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
return null;
}
return getAncestor(element.getParentElement(), className);
} | java | public static Element getAncestor(Element element, String className) {
if (hasClass(className, element)) {
return element;
}
if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
return null;
}
return getAncestor(element.getParentElement(), className);
} | [
"public",
"static",
"Element",
"getAncestor",
"(",
"Element",
"element",
",",
"String",
"className",
")",
"{",
"if",
"(",
"hasClass",
"(",
"className",
",",
"element",
")",
")",
"{",
"return",
"element",
";",
"}",
"if",
"(",
"element",
".",
"getTagName",
... | Returns the given element or it's closest ancestor with the given class.<p>
Returns <code>null</code> if no appropriate element was found.<p>
@param element the element
@param className the class name
@return the matching element | [
"Returns",
"the",
"given",
"element",
"or",
"it",
"s",
"closest",
"ancestor",
"with",
"the",
"given",
"class",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1140-L1149 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/row/RowRenderer.java | RowRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
// Row row = (Row) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset((IContentDisabled)component, rw);
rw.endElement("div");
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
// Row row = (Row) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset((IContentDisabled)component, rw);
rw.endElement("div");
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Row row = (Row) comp... | This methods generates the HTML code of the current b:row.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:row.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"row",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework",
"c... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/row/RowRenderer.java#L98-L107 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java | AuthenticationHandler.endRequest | private void endRequest(HttpServerExchange exchange, String redirect) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.LOCATION.toHttpString(), redirect);
exchange.endExchange();
} | java | private void endRequest(HttpServerExchange exchange, String redirect) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.LOCATION.toHttpString(), redirect);
exchange.endExchange();
} | [
"private",
"void",
"endRequest",
"(",
"HttpServerExchange",
"exchange",
",",
"String",
"redirect",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"FOUND",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"... | Ends the current request by sending a HTTP 302 status code and a direct to the given URL
@param exchange The HttpServerExchange | [
"Ends",
"the",
"current",
"request",
"by",
"sending",
"a",
"HTTP",
"302",
"status",
"code",
"and",
"a",
"direct",
"to",
"the",
"given",
"URL"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java#L62-L73 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Program.java | Program.addRule | public Rule addRule(String name, Node condition) {
Rule rule = new Rule(name, condition);
rules.put(name, rule);
return rule;
} | java | public Rule addRule(String name, Node condition) {
Rule rule = new Rule(name, condition);
rules.put(name, rule);
return rule;
} | [
"public",
"Rule",
"addRule",
"(",
"String",
"name",
",",
"Node",
"condition",
")",
"{",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
"name",
",",
"condition",
")",
";",
"rules",
".",
"put",
"(",
"name",
",",
"rule",
")",
";",
"return",
"rule",
";",
"}"... | Add a rule to this program.
<p>
@param name is the rule name
@param condition is the rule condition
@return the rule | [
"Add",
"a",
"rule",
"to",
"this",
"program",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Program.java#L123-L127 |
phax/ph-css | ph-css/src/main/java/com/helger/css/decl/CSSExpression.java | CSSExpression.addNumber | @Nonnull
public CSSExpression addNumber (@Nonnegative final int nIndex, final int nValue)
{
return addMember (nIndex, new CSSExpressionMemberTermSimple (nValue));
} | java | @Nonnull
public CSSExpression addNumber (@Nonnegative final int nIndex, final int nValue)
{
return addMember (nIndex, new CSSExpressionMemberTermSimple (nValue));
} | [
"@",
"Nonnull",
"public",
"CSSExpression",
"addNumber",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"final",
"int",
"nValue",
")",
"{",
"return",
"addMember",
"(",
"nIndex",
",",
"new",
"CSSExpressionMemberTermSimple",
"(",
"nValue",
")",
")",
";",... | Shortcut method to add a numeric value
@param nIndex
The index where the member should be added. Must be ≥ 0.
@param nValue
The value to be added.
@return this | [
"Shortcut",
"method",
"to",
"add",
"a",
"numeric",
"value"
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CSSExpression.java#L140-L144 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.TITLE | public static HtmlTree TITLE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
return htmltree;
} | java | public static HtmlTree TITLE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"TITLE",
"(",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TITLE",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"return",
"htmltree",
";",
"}"
] | Generates a TITLE tag with some content.
@param body content for the tag
@return an HtmlTree object for the TITLE tag | [
"Generates",
"a",
"TITLE",
"tag",
"with",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L842-L845 |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.readFromFileIntoString | public static String readFromFileIntoString(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
while( (line = reader.readLine()) != null) {
text.append(line).append("\n");
}
inputStream.close();
return text.toString();
} | java | public static String readFromFileIntoString(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
while( (line = reader.readLine()) != null) {
text.append(line).append("\n");
}
inputStream.close();
return text.toString();
} | [
"public",
"static",
"String",
"readFromFileIntoString",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"inputStream",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"... | This method reads all data from a file into a String object
@param file file to read text from
@return <code>String</code> containing all file data
@throws IOException IO exception | [
"This",
"method",
"reads",
"all",
"data",
"from",
"a",
"file",
"into",
"a",
"String",
"object"
] | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L43-L55 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java | MainController.init | private void init() {
if (provider != null) {
propertyGrid.setTarget(StringUtils.isEmpty(groupId) ? null : new Settings(groupId, provider));
}
} | java | private void init() {
if (provider != null) {
propertyGrid.setTarget(StringUtils.isEmpty(groupId) ? null : new Settings(groupId, provider));
}
} | [
"private",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"provider",
"!=",
"null",
")",
"{",
"propertyGrid",
".",
"setTarget",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"groupId",
")",
"?",
"null",
":",
"new",
"Settings",
"(",
"groupId",
",",
"provider",
")... | Activates the property grid once the provider and group ids are set. | [
"Activates",
"the",
"property",
"grid",
"once",
"the",
"provider",
"and",
"group",
"ids",
"are",
"set",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java#L100-L104 |
airlift/slice | src/main/java/io/airlift/slice/Slices.java | Slices.wrappedIntArray | public static Slice wrappedIntArray(int[] array, int offset, int length)
{
if (length == 0) {
return EMPTY_SLICE;
}
return new Slice(array, offset, length);
} | java | public static Slice wrappedIntArray(int[] array, int offset, int length)
{
if (length == 0) {
return EMPTY_SLICE;
}
return new Slice(array, offset, length);
} | [
"public",
"static",
"Slice",
"wrappedIntArray",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_SLICE",
";",
"}",
"return",
"new",
"Slice",
"(",
"array",
... | Creates a slice over the specified array range.
@param offset the array position at which the slice begins
@param length the number of array positions to include in the slice | [
"Creates",
"a",
"slice",
"over",
"the",
"specified",
"array",
"range",
"."
] | train | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/Slices.java#L215-L221 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getCustomBundlePropertyAsList | public List<String> getCustomBundlePropertyAsList(String bundleName, String key) {
List<String> propertiesList = new ArrayList<>();
StringTokenizer tk = new StringTokenizer(getCustomBundleProperty(bundleName, key, ""), ",");
while (tk.hasMoreTokens())
propertiesList.add(tk.nextToken().trim());
return propertiesList;
} | java | public List<String> getCustomBundlePropertyAsList(String bundleName, String key) {
List<String> propertiesList = new ArrayList<>();
StringTokenizer tk = new StringTokenizer(getCustomBundleProperty(bundleName, key, ""), ",");
while (tk.hasMoreTokens())
propertiesList.add(tk.nextToken().trim());
return propertiesList;
} | [
"public",
"List",
"<",
"String",
">",
"getCustomBundlePropertyAsList",
"(",
"String",
"bundleName",
",",
"String",
"key",
")",
"{",
"List",
"<",
"String",
">",
"propertiesList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"StringTokenizer",
"tk",
"=",
"new... | Returns as a list, the comma separated values of a property
@param bundleName
the bundle name
@param key
the key of the property
@return a list of the comma separated values of a property | [
"Returns",
"as",
"a",
"list",
"the",
"comma",
"separated",
"values",
"of",
"a",
"property"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L181-L187 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/ClassHelper.java | ClassHelper.newInstance | public static Object newInstance(Class target, boolean makeAccessible) throws InstantiationException,
IllegalAccessException
{
if (makeAccessible)
{
try
{
return newInstance(target, NO_ARGS_CLASS, NO_ARGS, makeAccessible);
}
catch (InvocationTargetException e)
{
throw new OJBRuntimeException("Unexpected exception while instantiate class '"
+ target + "' with default constructor", e);
}
catch (NoSuchMethodException e)
{
throw new OJBRuntimeException("Unexpected exception while instantiate class '"
+ target + "' with default constructor", e);
}
}
else
{
return target.newInstance();
}
} | java | public static Object newInstance(Class target, boolean makeAccessible) throws InstantiationException,
IllegalAccessException
{
if (makeAccessible)
{
try
{
return newInstance(target, NO_ARGS_CLASS, NO_ARGS, makeAccessible);
}
catch (InvocationTargetException e)
{
throw new OJBRuntimeException("Unexpected exception while instantiate class '"
+ target + "' with default constructor", e);
}
catch (NoSuchMethodException e)
{
throw new OJBRuntimeException("Unexpected exception while instantiate class '"
+ target + "' with default constructor", e);
}
}
else
{
return target.newInstance();
}
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"Class",
"target",
",",
"boolean",
"makeAccessible",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"if",
"(",
"makeAccessible",
")",
"{",
"try",
"{",
"return",
"newInstance",
"(",
"ta... | Returns a new instance of the given class, using the default or a no-arg constructor.
This method can also use private no-arg constructors if <code>makeAccessible</code>
is set to <code>true</code> (and there are no other security constraints).
@param target The class to instantiate
@param makeAccessible If the constructor shall be made accessible prior to using it
@return The instance | [
"Returns",
"a",
"new",
"instance",
"of",
"the",
"given",
"class",
"using",
"the",
"default",
"or",
"a",
"no",
"-",
"arg",
"constructor",
".",
"This",
"method",
"can",
"also",
"use",
"private",
"no",
"-",
"arg",
"constructors",
"if",
"<code",
">",
"makeAc... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L146-L170 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addParentChildRelation | protected void addParentChildRelation(Document doc, String parentId) throws RepositoryException
{
doc.add(new Field(FieldNames.PARENT, parentId, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS,
Field.TermVector.NO));
// NodeState parent = (NodeState) stateProvider.getItemState(parentId);
// ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
// if (child == null) {
// // this can only happen when jackrabbit
// // is running in a cluster.
// throw new RepositoryException(
// "Missing child node entry for node with id: "
// + node.getNodeId());
// }
InternalQName name = node.getQPath().getName();
addNodeName(doc, name.getNamespace(), name.getName());
} | java | protected void addParentChildRelation(Document doc, String parentId) throws RepositoryException
{
doc.add(new Field(FieldNames.PARENT, parentId, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS,
Field.TermVector.NO));
// NodeState parent = (NodeState) stateProvider.getItemState(parentId);
// ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
// if (child == null) {
// // this can only happen when jackrabbit
// // is running in a cluster.
// throw new RepositoryException(
// "Missing child node entry for node with id: "
// + node.getNodeId());
// }
InternalQName name = node.getQPath().getName();
addNodeName(doc, name.getNamespace(), name.getName());
} | [
"protected",
"void",
"addParentChildRelation",
"(",
"Document",
"doc",
",",
"String",
"parentId",
")",
"throws",
"RepositoryException",
"{",
"doc",
".",
"add",
"(",
"new",
"Field",
"(",
"FieldNames",
".",
"PARENT",
",",
"parentId",
",",
"Field",
".",
"Store",
... | Adds a parent child relation to the given <code>doc</code>.
@param doc the document.
@param parentId the id of the parent node.
@throws RepositoryException if the parent node does not have a child node
entry for the current node. | [
"Adds",
"a",
"parent",
"child",
"relation",
"to",
"the",
"given",
"<code",
">",
"doc<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L1072-L1087 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.isEqualList | public static <T> Boolean isEqualList(List<T> list1, List<T> list2) {
if (list1 == list2) {
return Boolean.TRUE;
} else if ((list1 == null) || (list2 == null) || (list1.size() != list2.size())) {
return Boolean.FALSE;
}
final Iterator<T> itr1 = list1.iterator();
final Iterator<T> itr2 = list2.iterator();
Object obj1 = null;
Object obj2 = null;
while (itr1.hasNext() && itr2.hasNext()) {
obj1 = itr1.next();
obj2 = itr2.next();
if (!(obj1 == null ? obj2 == null : Objects.equal(obj1, obj2))) {
return Boolean.FALSE;
}
}
return !(itr1.hasNext() || itr2.hasNext());
} | java | public static <T> Boolean isEqualList(List<T> list1, List<T> list2) {
if (list1 == list2) {
return Boolean.TRUE;
} else if ((list1 == null) || (list2 == null) || (list1.size() != list2.size())) {
return Boolean.FALSE;
}
final Iterator<T> itr1 = list1.iterator();
final Iterator<T> itr2 = list2.iterator();
Object obj1 = null;
Object obj2 = null;
while (itr1.hasNext() && itr2.hasNext()) {
obj1 = itr1.next();
obj2 = itr2.next();
if (!(obj1 == null ? obj2 == null : Objects.equal(obj1, obj2))) {
return Boolean.FALSE;
}
}
return !(itr1.hasNext() || itr2.hasNext());
} | [
"public",
"static",
"<",
"T",
">",
"Boolean",
"isEqualList",
"(",
"List",
"<",
"T",
">",
"list1",
",",
"List",
"<",
"T",
">",
"list2",
")",
"{",
"if",
"(",
"list1",
"==",
"list2",
")",
"{",
"return",
"Boolean",
".",
"TRUE",
";",
"}",
"else",
"if"... | Method based on
{@link org.apache.commons.collections.ListUtils#isEqualList(java.util.Collection, java.util.Collection)} rewrote
for performance reasons.
<p>
Basically employs {@link ObjectUtils#equals(Object)} instead of {@link #equals(Object)} since the first
one checks identity before calling <code>equals</code>.
@param <T>
the type of the elements in the list.
@param list1
the first list, may be null
@param list2
the second list, may be null
@return whether the lists are equal by value comparison | [
"Method",
"based",
"on",
"{",
"@link",
"org",
".",
"apache",
".",
"commons",
".",
"collections",
".",
"ListUtils#isEqualList",
"(",
"java",
".",
"util",
".",
"Collection",
"java",
".",
"util",
".",
"Collection",
")",
"}",
"rewrote",
"for",
"performance",
"... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L185-L208 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/repo/jdbc/LoggingDataSource.java | LoggingDataSource.create | public static DataSource create(DataSource ds, Log log) {
if (ds == null) {
throw new IllegalArgumentException();
}
if (log == null) {
log = LogFactory.getLog(LoggingDataSource.class);
}
if (!log.isDebugEnabled()) {
return ds;
}
return new LoggingDataSource(log, ds);
} | java | public static DataSource create(DataSource ds, Log log) {
if (ds == null) {
throw new IllegalArgumentException();
}
if (log == null) {
log = LogFactory.getLog(LoggingDataSource.class);
}
if (!log.isDebugEnabled()) {
return ds;
}
return new LoggingDataSource(log, ds);
} | [
"public",
"static",
"DataSource",
"create",
"(",
"DataSource",
"ds",
",",
"Log",
"log",
")",
"{",
"if",
"(",
"ds",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"if",
"(",
"log",
"==",
"null",
")",
"{",
"log"... | Wraps the given DataSource which logs to the given log. If debug logging
is disabled, the original DataSource is returned. | [
"Wraps",
"the",
"given",
"DataSource",
"which",
"logs",
"to",
"the",
"given",
"log",
".",
"If",
"debug",
"logging",
"is",
"disabled",
"the",
"original",
"DataSource",
"is",
"returned",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/jdbc/LoggingDataSource.java#L48-L59 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201811/ratecardservice/GetRateCardsByStatement.java | GetRateCardsByStatement.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the RateCardService.
RateCardServiceInterface rateCardService =
adManagerServices.get(session, RateCardServiceInterface.class);
// Create a statement to get all rate cards using USD as currency.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("currencyCode = 'USD'")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get rate cards by statement.
RateCardPage page = rateCardService.getRateCardsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (RateCard rateCard : page.getResults()) {
System.out.printf(
"%d) Rate card with ID %d, name '%s', and currency '%s' was found.%n",
i++, rateCard.getId(), rateCard.getName(), rateCard.getCurrencyCode());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the RateCardService.
RateCardServiceInterface rateCardService =
adManagerServices.get(session, RateCardServiceInterface.class);
// Create a statement to get all rate cards using USD as currency.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("currencyCode = 'USD'")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get rate cards by statement.
RateCardPage page = rateCardService.getRateCardsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (RateCard rateCard : page.getResults()) {
System.out.printf(
"%d) Rate card with ID %d, name '%s', and currency '%s' was found.%n",
i++, rateCard.getId(), rateCard.getName(), rateCard.getCurrencyCode());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the RateCardService.",
"RateCardServiceInterface",
"rateCardService",
"=",
"adManagerServices",
".",
"ge... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/ratecardservice/GetRateCardsByStatement.java#L51-L85 |
virgo47/javasimon | core/src/main/java/org/javasimon/ManagerConfiguration.java | ManagerConfiguration.setProperty | private void setProperty(Callback callback, String property, String value) {
try {
if (value != null) {
SimonBeanUtils.getInstance().setProperty(callback, property, value);
} else {
callback.getClass().getMethod(setterName(property)).invoke(callback);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SimonException(e);
}
} | java | private void setProperty(Callback callback, String property, String value) {
try {
if (value != null) {
SimonBeanUtils.getInstance().setProperty(callback, property, value);
} else {
callback.getClass().getMethod(setterName(property)).invoke(callback);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SimonException(e);
}
} | [
"private",
"void",
"setProperty",
"(",
"Callback",
"callback",
",",
"String",
"property",
",",
"String",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"SimonBeanUtils",
".",
"getInstance",
"(",
")",
".",
"setProperty",
"(",
"... | Sets the callback property.
@param callback callback object
@param property name of the property
@param value value of the property | [
"Sets",
"the",
"callback",
"property",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/ManagerConfiguration.java#L200-L210 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MediaAPI.java | MediaAPI.mediaGetJssdk | public static MediaGetResult mediaGetJssdk(String access_token,String media_id){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/cgi-bin/media/get/jssdk")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("media_id", media_id)
.build();
return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class));
} | java | public static MediaGetResult mediaGetJssdk(String access_token,String media_id){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/cgi-bin/media/get/jssdk")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("media_id", media_id)
.build();
return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class));
} | [
"public",
"static",
"MediaGetResult",
"mediaGetJssdk",
"(",
"String",
"access_token",
",",
"String",
"media_id",
")",
"{",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"get",
"(",
")",
".",
"setUri",
"(",
"BASE_URI",
"+",
"\"/cgi-bin/media/get/jss... | 高清语音素材获取接口 <br>
公众号可以使用本接口获取从JSSDK的uploadVoice接口上传的临时语音素材,格式为speex,16K采样率。<br>
该音频比上文的临时素材获取接口(格式为amr,8K采样率)更加清晰,适合用作语音识别等对音质要求较高的业务。
@since 2.8.6
@param access_token access_token
@param media_id media_id
@return MediaGetResult <br>
如果speex音频格式不符合业务需求,开发者可在获取后,再自行于本地对该语音素材进行转码。<br>
转码请使用speex的官方解码库 http://speex.org/downloads/ ,并结合微信的解码库(含示例代码:<a href="http://wximg.gtimg.com/shake_tv/mpwiki/declib.zip">下载地址</a>)。 | [
"高清语音素材获取接口",
"<br",
">",
"公众号可以使用本接口获取从JSSDK的uploadVoice接口上传的临时语音素材,格式为speex,16K采样率。<br",
">",
"该音频比上文的临时素材获取接口(格式为amr,8K采样率)更加清晰,适合用作语音识别等对音质要求较高的业务。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MediaAPI.java#L184-L191 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.getUserProperty | @Override
public final Serializable getUserProperty(String name) throws IOException, ClassNotFoundException {
/* If the name is null there is nothing to do. so only proceed if it is */
/* supplied. */
if (name != null) {
/* Call the real getUserProperty with forMatching set to false. */
return getUserProperty(name, false);
}
/* If the name is null always return null. */
else {
return null;
}
} | java | @Override
public final Serializable getUserProperty(String name) throws IOException, ClassNotFoundException {
/* If the name is null there is nothing to do. so only proceed if it is */
/* supplied. */
if (name != null) {
/* Call the real getUserProperty with forMatching set to false. */
return getUserProperty(name, false);
}
/* If the name is null always return null. */
else {
return null;
}
} | [
"@",
"Override",
"public",
"final",
"Serializable",
"getUserProperty",
"(",
"String",
"name",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"/* If the name is null there is nothing to do. so only proceed if it is */",
"/* supplied. */",
"if",
"(",
"name",
... | /*
Return the User Property stored in the Message under the given name.
<p>
User Properties are stored as name-value pairs where the value may be any
Object which implements java.io.Serializable.
Note that the reference returned is to a copy of the actual Object stored.
Javadoc description supplied by SIBusSdoMessage & JsApiMessage interfaces. | [
"/",
"*",
"Return",
"the",
"User",
"Property",
"stored",
"in",
"the",
"Message",
"under",
"the",
"given",
"name",
".",
"<p",
">",
"User",
"Properties",
"are",
"stored",
"as",
"name",
"-",
"value",
"pairs",
"where",
"the",
"value",
"may",
"be",
"any",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L325-L341 |
traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.createAnimation | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
radiusMax -= ripplePadding;
if (isCentered || rippleType == 1) {
this.x = getMeasuredWidth() / 2;
this.y = getMeasuredHeight() / 2;
} else {
this.x = x;
this.y = y;
}
animationRunning = true;
if (rippleType == 1 && originBitmap == null)
originBitmap = getDrawingCache(true);
invalidate();
}
} | java | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
radiusMax -= ripplePadding;
if (isCentered || rippleType == 1) {
this.x = getMeasuredWidth() / 2;
this.y = getMeasuredHeight() / 2;
} else {
this.x = x;
this.y = y;
}
animationRunning = true;
if (rippleType == 1 && originBitmap == null)
originBitmap = getDrawingCache(true);
invalidate();
}
} | [
"private",
"void",
"createAnimation",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"{",
"if",
"(",
"this",
".",
"isEnabled",
"(",
")",
"&&",
"!",
"animationRunning",
")",
"{",
"if",
"(",
"hasToZoom",
")",
"this",
".",
"startAnimation",
... | Create Ripple animation centered at x, y
@param x Horizontal position of the ripple center
@param y Vertical position of the ripple center | [
"Create",
"Ripple",
"animation",
"centered",
"at",
"x",
"y"
] | train | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L249-L276 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McfCodeGen.java | McfCodeGen.writeConnectionFactory | private void writeConnectionFactory(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @param cxManager ConnectionManager to be "
+ "associated with created EIS connection factory instance\n");
writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
+ "javax.resource.cci.ConnectionFactory instance\n");
writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent,
"public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "createConnectionFactory", "cxManager");
writeIndent(out, indent + 1);
if (def.getMcfDefs().get(getNumOfMcf()).isUseCciConnection())
out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnFactoryClass() + "(cxManager);");
else
out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCfClass() + "(this, cxManager);");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
+ "javax.resource.cci.ConnectionFactory instance\n");
writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public Object createConnectionFactory() throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1,
"throw new ResourceException(\"This resource adapter doesn't support non-managed environments\");");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | java | private void writeConnectionFactory(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @param cxManager ConnectionManager to be "
+ "associated with created EIS connection factory instance\n");
writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
+ "javax.resource.cci.ConnectionFactory instance\n");
writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent,
"public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "createConnectionFactory", "cxManager");
writeIndent(out, indent + 1);
if (def.getMcfDefs().get(getNumOfMcf()).isUseCciConnection())
out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnFactoryClass() + "(cxManager);");
else
out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCfClass() + "(this, cxManager);");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
+ "javax.resource.cci.ConnectionFactory instance\n");
writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public Object createConnectionFactory() throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1,
"throw new ResourceException(\"This resource adapter doesn't support non-managed environments\");");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | [
"private",
"void",
"writeConnectionFactory",
"(",
"Definition",
"def",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"/**\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",... | Output ConnectionFactory method
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"ConnectionFactory",
"method"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McfCodeGen.java#L196-L236 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addAnnotationOrGetExisting | public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass, Map<String, Object> members) {
ClassNode annotationClassNode = ClassHelper.make(annotationClass);
return addAnnotationOrGetExisting(classNode, annotationClassNode, members);
} | java | public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass, Map<String, Object> members) {
ClassNode annotationClassNode = ClassHelper.make(annotationClass);
return addAnnotationOrGetExisting(classNode, annotationClassNode, members);
} | [
"public",
"static",
"AnnotationNode",
"addAnnotationOrGetExisting",
"(",
"ClassNode",
"classNode",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"members",
")",
"{",
"ClassNode",
"annotation... | Adds an annotation to the given class node or returns the existing annotation
@param classNode The class node
@param annotationClass The annotation class | [
"Adds",
"an",
"annotation",
"to",
"the",
"given",
"class",
"node",
"or",
"returns",
"the",
"existing",
"annotation"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L836-L839 |
cerner/beadledom | guice-dynamicbindings/src/main/java/com/cerner/beadledom/guice/dynamicbindings/DynamicAnnotations.java | DynamicAnnotations.bindDynamicProvider | static <T> void bindDynamicProvider(Binder binder, Key<?> key) {
binder.getProvider(key);
ParameterizedType type =
Types.newParameterizedType(DynamicBindingProvider.class, key.getTypeLiteral().getType());
@SuppressWarnings("unchecked")
DynamicBindingProvider<T> provider =
new DynamicBindingProviderImpl<T>((TypeLiteral<T>) key.getTypeLiteral());
@SuppressWarnings("unchecked")
Key<DynamicBindingProvider<T>> dynamicKey = (Key<DynamicBindingProvider<T>>) Key.get(type);
binder.bind(dynamicKey).toInstance(provider);
} | java | static <T> void bindDynamicProvider(Binder binder, Key<?> key) {
binder.getProvider(key);
ParameterizedType type =
Types.newParameterizedType(DynamicBindingProvider.class, key.getTypeLiteral().getType());
@SuppressWarnings("unchecked")
DynamicBindingProvider<T> provider =
new DynamicBindingProviderImpl<T>((TypeLiteral<T>) key.getTypeLiteral());
@SuppressWarnings("unchecked")
Key<DynamicBindingProvider<T>> dynamicKey = (Key<DynamicBindingProvider<T>>) Key.get(type);
binder.bind(dynamicKey).toInstance(provider);
} | [
"static",
"<",
"T",
">",
"void",
"bindDynamicProvider",
"(",
"Binder",
"binder",
",",
"Key",
"<",
"?",
">",
"key",
")",
"{",
"binder",
".",
"getProvider",
"(",
"key",
")",
";",
"ParameterizedType",
"type",
"=",
"Types",
".",
"newParameterizedType",
"(",
... | Binds a {@link DynamicBindingProvider} for the specified key.
<p>The instance bound to the key can later be retrieved through
{@link DynamicBindingProvider#get(Class)} given the same annotation provided during binding
time. This method also 'requires' a binding for {@code key}.
<p>This method requires a binder, and must be used from a Guice module that is in the
configure phase.
<p>Note: The annotation on the key will only be used for required binding checks by Guice.
@param binder the Guice binder to bind with
@param key the key to create a {@link DynamicBindingProvider} for | [
"Binds",
"a",
"{",
"@link",
"DynamicBindingProvider",
"}",
"for",
"the",
"specified",
"key",
"."
] | train | https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/guice-dynamicbindings/src/main/java/com/cerner/beadledom/guice/dynamicbindings/DynamicAnnotations.java#L62-L73 |
killbill/killbill | util/src/main/java/org/killbill/billing/util/entity/dao/EntitySqlDaoWrapperInvocationHandler.java | EntitySqlDaoWrapperInvocationHandler.errorDuringTransaction | private void errorDuringTransaction(final Throwable t, final Method method, final String extraErrorMessage) throws Throwable {
final StringBuilder errorMessageBuilder = new StringBuilder("Error during transaction for sql entity {} and method {}");
if (t instanceof SQLException) {
final SQLException sqlException = (SQLException) t;
errorMessageBuilder.append(" [SQL DefaultState: ")
.append(sqlException.getSQLState())
.append(", Vendor Error Code: ")
.append(sqlException.getErrorCode())
.append("]");
}
if (extraErrorMessage != null) {
// This is usually the SQL statement
errorMessageBuilder.append("\n").append(extraErrorMessage);
}
logger.warn(errorMessageBuilder.toString(), sqlDaoClass, method.getName());
// This is to avoid throwing an exception wrapped in an UndeclaredThrowableException
if (!(t instanceof RuntimeException)) {
throw new RuntimeException(t);
} else {
throw t;
}
} | java | private void errorDuringTransaction(final Throwable t, final Method method, final String extraErrorMessage) throws Throwable {
final StringBuilder errorMessageBuilder = new StringBuilder("Error during transaction for sql entity {} and method {}");
if (t instanceof SQLException) {
final SQLException sqlException = (SQLException) t;
errorMessageBuilder.append(" [SQL DefaultState: ")
.append(sqlException.getSQLState())
.append(", Vendor Error Code: ")
.append(sqlException.getErrorCode())
.append("]");
}
if (extraErrorMessage != null) {
// This is usually the SQL statement
errorMessageBuilder.append("\n").append(extraErrorMessage);
}
logger.warn(errorMessageBuilder.toString(), sqlDaoClass, method.getName());
// This is to avoid throwing an exception wrapped in an UndeclaredThrowableException
if (!(t instanceof RuntimeException)) {
throw new RuntimeException(t);
} else {
throw t;
}
} | [
"private",
"void",
"errorDuringTransaction",
"(",
"final",
"Throwable",
"t",
",",
"final",
"Method",
"method",
",",
"final",
"String",
"extraErrorMessage",
")",
"throws",
"Throwable",
"{",
"final",
"StringBuilder",
"errorMessageBuilder",
"=",
"new",
"StringBuilder",
... | Nice method name to ease debugging while looking at log files | [
"Nice",
"method",
"name",
"to",
"ease",
"debugging",
"while",
"looking",
"at",
"log",
"files"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/entity/dao/EntitySqlDaoWrapperInvocationHandler.java#L162-L184 |
jhunters/jprotobuf | jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/AbstractExecMojo.java | AbstractExecMojo.collectProjectArtifactsAndClasspath | @SuppressWarnings( "unchecked" )
protected void collectProjectArtifactsAndClasspath( List<Artifact> artifacts, List<File> theClasspathFiles )
{
if ( "compile".equals( classpathScope ) )
{
artifacts.addAll( project.getCompileArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "test".equals( classpathScope ) )
{
artifacts.addAll( project.getTestArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getTestOutputDirectory() ) );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "runtime".equals( classpathScope ) )
{
artifacts.addAll( project.getRuntimeArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "system".equals( classpathScope ) )
{
artifacts.addAll( project.getSystemArtifacts() );
}
else
{
throw new IllegalStateException( "Invalid classpath scope: " + classpathScope );
}
getLog().debug( "Collected project artifacts " + artifacts );
getLog().debug( "Collected project classpath " + theClasspathFiles );
} | java | @SuppressWarnings( "unchecked" )
protected void collectProjectArtifactsAndClasspath( List<Artifact> artifacts, List<File> theClasspathFiles )
{
if ( "compile".equals( classpathScope ) )
{
artifacts.addAll( project.getCompileArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "test".equals( classpathScope ) )
{
artifacts.addAll( project.getTestArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getTestOutputDirectory() ) );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "runtime".equals( classpathScope ) )
{
artifacts.addAll( project.getRuntimeArtifacts() );
theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) );
}
else if ( "system".equals( classpathScope ) )
{
artifacts.addAll( project.getSystemArtifacts() );
}
else
{
throw new IllegalStateException( "Invalid classpath scope: " + classpathScope );
}
getLog().debug( "Collected project artifacts " + artifacts );
getLog().debug( "Collected project classpath " + theClasspathFiles );
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"collectProjectArtifactsAndClasspath",
"(",
"List",
"<",
"Artifact",
">",
"artifacts",
",",
"List",
"<",
"File",
">",
"theClasspathFiles",
")",
"{",
"if",
"(",
"\"compile\"",
".",
"equals",
... | Collects the project artifacts in the specified List and the project specific classpath (build output and build
test output) Files in the specified List, depending on the plugin classpathScope value.
@param artifacts the list where to collect the scope specific artifacts
@param theClasspathFiles the list where to collect the scope specific output directories | [
"Collects",
"the",
"project",
"artifacts",
"in",
"the",
"specified",
"List",
"and",
"the",
"project",
"specific",
"classpath",
"(",
"build",
"output",
"and",
"build",
"test",
"output",
")",
"Files",
"in",
"the",
"specified",
"List",
"depending",
"on",
"the",
... | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/AbstractExecMojo.java#L93-L124 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java | ResourceClaim.releaseTicket | static void releaseTicket(ZooKeeper zookeeper, String lockNode, String ticket)
throws KeeperException, InterruptedException {
logger.debug("Releasing ticket {}.", ticket);
try {
zookeeper.delete(lockNode + "/" + ticket, -1);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NONODE) {
// If it the node is already gone, than that is fine, otherwise:
throw e;
}
}
} | java | static void releaseTicket(ZooKeeper zookeeper, String lockNode, String ticket)
throws KeeperException, InterruptedException {
logger.debug("Releasing ticket {}.", ticket);
try {
zookeeper.delete(lockNode + "/" + ticket, -1);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NONODE) {
// If it the node is already gone, than that is fine, otherwise:
throw e;
}
}
} | [
"static",
"void",
"releaseTicket",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"lockNode",
",",
"String",
"ticket",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"logger",
".",
"debug",
"(",
"\"Releasing ticket {}.\"",
",",
"ticket",
")",
"... | Release an acquired lock.
@param zookeeper ZooKeeper connection to use.
@param lockNode Path to the znode representing the locking queue.
@param ticket Name of the first node in the queue. | [
"Release",
"an",
"acquired",
"lock",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java#L203-L215 |
fuinorg/units4j | src/main/java/org/fuin/units4j/AssertCoverage.java | AssertCoverage.isInclude | static boolean isInclude(final Class<?> clasz, final ClassFilter classFilter) {
final int modifiers = clasz.getModifiers();
return classFilter.isIncludeClass(clasz) && !clasz.isAnnotation() && !clasz.isEnum() && !clasz.isInterface()
&& !Modifier.isAbstract(modifiers);
} | java | static boolean isInclude(final Class<?> clasz, final ClassFilter classFilter) {
final int modifiers = clasz.getModifiers();
return classFilter.isIncludeClass(clasz) && !clasz.isAnnotation() && !clasz.isEnum() && !clasz.isInterface()
&& !Modifier.isAbstract(modifiers);
} | [
"static",
"boolean",
"isInclude",
"(",
"final",
"Class",
"<",
"?",
">",
"clasz",
",",
"final",
"ClassFilter",
"classFilter",
")",
"{",
"final",
"int",
"modifiers",
"=",
"clasz",
".",
"getModifiers",
"(",
")",
";",
"return",
"classFilter",
".",
"isIncludeClas... | Determines if the class meets the following conditions. <br>
<ul>
<li>Class filter returns TRUE</li>
<li>Not an annotation</li>
<li>Not an enumeration</li>
<li>Not an interface</li>
<li>Not abstract</li>
</ul>
@param clasz
Class to check.
@param classFilter
Additional filter to use.
@return If the class meets the conditions TRUE, else FALSE. | [
"Determines",
"if",
"the",
"class",
"meets",
"the",
"following",
"conditions",
".",
"<br",
">",
"<ul",
">",
"<li",
">",
"Class",
"filter",
"returns",
"TRUE<",
"/",
"li",
">",
"<li",
">",
"Not",
"an",
"annotation<",
"/",
"li",
">",
"<li",
">",
"Not",
... | train | https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/AssertCoverage.java#L218-L222 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java | BaiduMessage.withData | public BaiduMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | java | public BaiduMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | [
"public",
"BaiduMessage",
"withData",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"setData",
"(",
"data",
")",
";",
"return",
"this",
";",
"}"
] | The data payload used for a silent push. This payload is added to the notifications' data.pinpoint.jsonBody'
object
@param data
The data payload used for a silent push. This payload is added to the notifications'
data.pinpoint.jsonBody' object
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"data",
"payload",
"used",
"for",
"a",
"silent",
"push",
".",
"This",
"payload",
"is",
"added",
"to",
"the",
"notifications",
"data",
".",
"pinpoint",
".",
"jsonBody",
"object"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java#L231-L234 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/cookie/CookieHelper.java | CookieHelper.createCookie | @Nonnull
public static Cookie createCookie (@Nonnull final String sName,
@Nullable final String sValue,
final String sPath,
final boolean bExpireWhenBrowserIsClosed)
{
final Cookie aCookie = new Cookie (sName, sValue);
aCookie.setPath (sPath);
if (bExpireWhenBrowserIsClosed)
aCookie.setMaxAge (-1);
else
aCookie.setMaxAge (DEFAULT_MAX_AGE_SECONDS);
return aCookie;
} | java | @Nonnull
public static Cookie createCookie (@Nonnull final String sName,
@Nullable final String sValue,
final String sPath,
final boolean bExpireWhenBrowserIsClosed)
{
final Cookie aCookie = new Cookie (sName, sValue);
aCookie.setPath (sPath);
if (bExpireWhenBrowserIsClosed)
aCookie.setMaxAge (-1);
else
aCookie.setMaxAge (DEFAULT_MAX_AGE_SECONDS);
return aCookie;
} | [
"@",
"Nonnull",
"public",
"static",
"Cookie",
"createCookie",
"(",
"@",
"Nonnull",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sValue",
",",
"final",
"String",
"sPath",
",",
"final",
"boolean",
"bExpireWhenBrowserIsClosed",
")",
"{",
... | Create a cookie that is bound on a certain path within the local web
server.
@param sName
The cookie name.
@param sValue
The cookie value.
@param sPath
The path the cookie is valid for.
@param bExpireWhenBrowserIsClosed
<code>true</code> if this is a browser session cookie
@return The created cookie object. | [
"Create",
"a",
"cookie",
"that",
"is",
"bound",
"on",
"a",
"certain",
"path",
"within",
"the",
"local",
"web",
"server",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/cookie/CookieHelper.java#L99-L112 |
apereo/cas | support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/BaseWSFederationRequestController.java | BaseWSFederationRequestController.findAndValidateFederationRequestForRegisteredService | protected WSFederationRegisteredService findAndValidateFederationRequestForRegisteredService(final Service targetService,
final WSFederationRequest fedRequest) {
val svc = getWsFederationRegisteredService(targetService);
val idp = wsFederationRequestConfigurationContext.getCasProperties().getAuthn().getWsfedIdp().getIdp();
if (StringUtils.isBlank(fedRequest.getWtrealm()) || !StringUtils.equals(fedRequest.getWtrealm(), svc.getRealm())) {
LOGGER.warn("Realm [{}] is not authorized for matching service [{}]", fedRequest.getWtrealm(), svc);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
if (!StringUtils.equals(idp.getRealm(), svc.getRealm())) {
LOGGER.warn("Realm [{}] is not authorized for the identity provider realm [{}]", fedRequest.getWtrealm(), idp.getRealm());
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
return svc;
} | java | protected WSFederationRegisteredService findAndValidateFederationRequestForRegisteredService(final Service targetService,
final WSFederationRequest fedRequest) {
val svc = getWsFederationRegisteredService(targetService);
val idp = wsFederationRequestConfigurationContext.getCasProperties().getAuthn().getWsfedIdp().getIdp();
if (StringUtils.isBlank(fedRequest.getWtrealm()) || !StringUtils.equals(fedRequest.getWtrealm(), svc.getRealm())) {
LOGGER.warn("Realm [{}] is not authorized for matching service [{}]", fedRequest.getWtrealm(), svc);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
if (!StringUtils.equals(idp.getRealm(), svc.getRealm())) {
LOGGER.warn("Realm [{}] is not authorized for the identity provider realm [{}]", fedRequest.getWtrealm(), idp.getRealm());
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
return svc;
} | [
"protected",
"WSFederationRegisteredService",
"findAndValidateFederationRequestForRegisteredService",
"(",
"final",
"Service",
"targetService",
",",
"final",
"WSFederationRequest",
"fedRequest",
")",
"{",
"val",
"svc",
"=",
"getWsFederationRegisteredService",
"(",
"targetService"... | Gets ws federation registered service.
@param targetService the target service
@param fedRequest the fed request
@return the ws federation registered service | [
"Gets",
"ws",
"federation",
"registered",
"service",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/BaseWSFederationRequestController.java#L160-L175 |
joniles/mpxj | src/main/java/net/sf/mpxj/planner/PlannerWriter.java | PlannerWriter.writeResource | private void writeResource(Resource mpxjResource, net.sf.mpxj.planner.schema.Resource plannerResource)
{
ProjectCalendar resourceCalendar = mpxjResource.getResourceCalendar();
if (resourceCalendar != null)
{
plannerResource.setCalendar(getIntegerString(resourceCalendar.getUniqueID()));
}
plannerResource.setEmail(mpxjResource.getEmailAddress());
plannerResource.setId(getIntegerString(mpxjResource.getUniqueID()));
plannerResource.setName(getString(mpxjResource.getName()));
plannerResource.setNote(mpxjResource.getNotes());
plannerResource.setShortName(mpxjResource.getInitials());
plannerResource.setType(mpxjResource.getType() == ResourceType.MATERIAL ? "2" : "1");
//plannerResource.setStdRate();
//plannerResource.setOvtRate();
plannerResource.setUnits("0");
//plannerResource.setProperties();
m_eventManager.fireResourceWrittenEvent(mpxjResource);
} | java | private void writeResource(Resource mpxjResource, net.sf.mpxj.planner.schema.Resource plannerResource)
{
ProjectCalendar resourceCalendar = mpxjResource.getResourceCalendar();
if (resourceCalendar != null)
{
plannerResource.setCalendar(getIntegerString(resourceCalendar.getUniqueID()));
}
plannerResource.setEmail(mpxjResource.getEmailAddress());
plannerResource.setId(getIntegerString(mpxjResource.getUniqueID()));
plannerResource.setName(getString(mpxjResource.getName()));
plannerResource.setNote(mpxjResource.getNotes());
plannerResource.setShortName(mpxjResource.getInitials());
plannerResource.setType(mpxjResource.getType() == ResourceType.MATERIAL ? "2" : "1");
//plannerResource.setStdRate();
//plannerResource.setOvtRate();
plannerResource.setUnits("0");
//plannerResource.setProperties();
m_eventManager.fireResourceWrittenEvent(mpxjResource);
} | [
"private",
"void",
"writeResource",
"(",
"Resource",
"mpxjResource",
",",
"net",
".",
"sf",
".",
"mpxj",
".",
"planner",
".",
"schema",
".",
"Resource",
"plannerResource",
")",
"{",
"ProjectCalendar",
"resourceCalendar",
"=",
"mpxjResource",
".",
"getResourceCalen... | This method writes data for a single resource to a Planner file.
@param mpxjResource MPXJ Resource instance
@param plannerResource Planner Resource instance | [
"This",
"method",
"writes",
"data",
"for",
"a",
"single",
"resource",
"to",
"a",
"Planner",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerWriter.java#L394-L413 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/builder/BeanMappingFactory.java | BeanMappingFactory.buildHeaderMapper | protected <T> void buildHeaderMapper(final BeanMapping<T> beanMapping, final CsvBean beanAnno) {
final HeaderMapper headerMapper = (HeaderMapper) configuration.getBeanFactory().create(beanAnno.headerMapper());
beanMapping.setHeaderMapper(headerMapper);
beanMapping.setHeader(beanAnno.header());
beanMapping.setValidateHeader(beanAnno.validateHeader());
} | java | protected <T> void buildHeaderMapper(final BeanMapping<T> beanMapping, final CsvBean beanAnno) {
final HeaderMapper headerMapper = (HeaderMapper) configuration.getBeanFactory().create(beanAnno.headerMapper());
beanMapping.setHeaderMapper(headerMapper);
beanMapping.setHeader(beanAnno.header());
beanMapping.setValidateHeader(beanAnno.validateHeader());
} | [
"protected",
"<",
"T",
">",
"void",
"buildHeaderMapper",
"(",
"final",
"BeanMapping",
"<",
"T",
">",
"beanMapping",
",",
"final",
"CsvBean",
"beanAnno",
")",
"{",
"final",
"HeaderMapper",
"headerMapper",
"=",
"(",
"HeaderMapper",
")",
"configuration",
".",
"ge... | ヘッダーのマッピングの処理や設定を組み立てます。
@param <T> Beanのタイプ
@param beanMapping Beanのマッピング情報
@param beanAnno アノテーション{@literal @CsvBean}のインタンス | [
"ヘッダーのマッピングの処理や設定を組み立てます。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/BeanMappingFactory.java#L95-L103 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.closeKeyboard | public static void closeKeyboard(Context context, View field) {
try {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(field.getWindowToken(), 0);
} catch (Exception ex) {
Log.e("Caffeine", "Error occurred trying to hide the keyboard. Exception=" + ex);
}
} | java | public static void closeKeyboard(Context context, View field) {
try {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(field.getWindowToken(), 0);
} catch (Exception ex) {
Log.e("Caffeine", "Error occurred trying to hide the keyboard. Exception=" + ex);
}
} | [
"public",
"static",
"void",
"closeKeyboard",
"(",
"Context",
"context",
",",
"View",
"field",
")",
"{",
"try",
"{",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"INPUT_METHOD_SERVICE",
... | Go away keyboard, nobody likes you.
@param context The current Context or Activity that this method is called from.
@param field field that holds the keyboard focus. | [
"Go",
"away",
"keyboard",
"nobody",
"likes",
"you",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L141-L148 |
lucee/Lucee | core/src/main/java/lucee/commons/io/ModeUtil.java | ModeUtil.updateMode | public static String updateMode(String existing, String update) throws IOException {
return toStringMode(updateMode(toOctalMode(existing), toOctalMode(update)));
} | java | public static String updateMode(String existing, String update) throws IOException {
return toStringMode(updateMode(toOctalMode(existing), toOctalMode(update)));
} | [
"public",
"static",
"String",
"updateMode",
"(",
"String",
"existing",
",",
"String",
"update",
")",
"throws",
"IOException",
"{",
"return",
"toStringMode",
"(",
"updateMode",
"(",
"toOctalMode",
"(",
"existing",
")",
",",
"toOctalMode",
"(",
"update",
")",
")... | update a string mode with a other (111+222=333 or 333+111=333 or 113+202=313)
@param existing
@param update
@return
@throws IOException | [
"update",
"a",
"string",
"mode",
"with",
"a",
"other",
"(",
"111",
"+",
"222",
"=",
"333",
"or",
"333",
"+",
"111",
"=",
"333",
"or",
"113",
"+",
"202",
"=",
"313",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/ModeUtil.java#L90-L92 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java | SessionAttributeInitializingFilter.setAttributes | public void setAttributes(Map<String, ?> attributes) {
if (attributes == null) {
attributes = new HashMap<>();
}
this.attributes.clear();
this.attributes.putAll(attributes);
} | java | public void setAttributes(Map<String, ?> attributes) {
if (attributes == null) {
attributes = new HashMap<>();
}
this.attributes.clear();
this.attributes.putAll(attributes);
} | [
"public",
"void",
"setAttributes",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"attributes",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"{",
"attributes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"this",
".",
"attributes",
".",
"clea... | Sets the attribute map. The specified attributes are copied into the
underlying map, so modifying the specified attributes parameter after
the call won't change the internal state. | [
"Sets",
"the",
"attribute",
"map",
".",
"The",
"specified",
"attributes",
"are",
"copied",
"into",
"the",
"underlying",
"map",
"so",
"modifying",
"the",
"specified",
"attributes",
"parameter",
"after",
"the",
"call",
"won",
"t",
"change",
"the",
"internal",
"s... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java#L125-L132 |
LearnLib/learnlib | algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/learner/ADTLearner.java | ADTLearner.closeTransition | private void closeTransition(final ADTTransition<I, O> transition) {
if (!transition.needsSifting()) {
return;
}
final Word<I> accessSequence = transition.getSource().getAccessSequence();
final I symbol = transition.getInput();
this.oracle.reset();
for (final I i : accessSequence) {
this.oracle.query(i);
}
transition.setOutput(this.oracle.query(symbol));
final Word<I> longPrefix = accessSequence.append(symbol);
final ADTNode<ADTState<I, O>, I, O> finalNode =
this.adt.sift(this.oracle, longPrefix, transition.getSiftNode());
assert ADTUtil.isLeafNode(finalNode);
final ADTState<I, O> targetState;
// new state discovered while sifting
if (finalNode.getHypothesisState() == null) {
targetState = this.hypothesis.addState();
targetState.setAccessSequence(longPrefix);
finalNode.setHypothesisState(targetState);
transition.setIsSpanningTreeEdge(true);
this.observationTree.addState(targetState, longPrefix, transition.getOutput());
for (final I i : this.alphabet) {
this.openTransitions.add(this.hypothesis.createOpenTransition(targetState, i, this.adt.getRoot()));
}
} else {
targetState = finalNode.getHypothesisState();
}
transition.setTarget(targetState);
} | java | private void closeTransition(final ADTTransition<I, O> transition) {
if (!transition.needsSifting()) {
return;
}
final Word<I> accessSequence = transition.getSource().getAccessSequence();
final I symbol = transition.getInput();
this.oracle.reset();
for (final I i : accessSequence) {
this.oracle.query(i);
}
transition.setOutput(this.oracle.query(symbol));
final Word<I> longPrefix = accessSequence.append(symbol);
final ADTNode<ADTState<I, O>, I, O> finalNode =
this.adt.sift(this.oracle, longPrefix, transition.getSiftNode());
assert ADTUtil.isLeafNode(finalNode);
final ADTState<I, O> targetState;
// new state discovered while sifting
if (finalNode.getHypothesisState() == null) {
targetState = this.hypothesis.addState();
targetState.setAccessSequence(longPrefix);
finalNode.setHypothesisState(targetState);
transition.setIsSpanningTreeEdge(true);
this.observationTree.addState(targetState, longPrefix, transition.getOutput());
for (final I i : this.alphabet) {
this.openTransitions.add(this.hypothesis.createOpenTransition(targetState, i, this.adt.getRoot()));
}
} else {
targetState = finalNode.getHypothesisState();
}
transition.setTarget(targetState);
} | [
"private",
"void",
"closeTransition",
"(",
"final",
"ADTTransition",
"<",
"I",
",",
"O",
">",
"transition",
")",
"{",
"if",
"(",
"!",
"transition",
".",
"needsSifting",
"(",
")",
")",
"{",
"return",
";",
"}",
"final",
"Word",
"<",
"I",
">",
"accessSequ... | Close the given transitions by means of sifting the associated long prefix through the ADT.
@param transition
the transition to close | [
"Close",
"the",
"given",
"transitions",
"by",
"means",
"of",
"sifting",
"the",
"associated",
"long",
"prefix",
"through",
"the",
"ADT",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/learner/ADTLearner.java#L309-L351 |
lazy-koala/java-toolkit | fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java | ThreadTask.removeTaskByTaskId | public boolean removeTaskByTaskId(String taskId, boolean isInterrupt) {
ScheduledFuture<?> future = runningTask.get(taskId);
boolean flag = future.cancel(isInterrupt);
if (flag) {
runningTask.remove(taskId);
}
return flag;
} | java | public boolean removeTaskByTaskId(String taskId, boolean isInterrupt) {
ScheduledFuture<?> future = runningTask.get(taskId);
boolean flag = future.cancel(isInterrupt);
if (flag) {
runningTask.remove(taskId);
}
return flag;
} | [
"public",
"boolean",
"removeTaskByTaskId",
"(",
"String",
"taskId",
",",
"boolean",
"isInterrupt",
")",
"{",
"ScheduledFuture",
"<",
"?",
">",
"future",
"=",
"runningTask",
".",
"get",
"(",
"taskId",
")",
";",
"boolean",
"flag",
"=",
"future",
".",
"cancel",... | 通过任务id 停止某个任务
<p>Function: removeTaskByTaskId</p>
<p>Description: </p>
@param taskId
@param isInterrupt 是否要强制中断该任务(如果任务正在进行)
@author acexy@thankjava.com
@date 2016年1月12日 上午11:40:04
@version 1.0 | [
"通过任务id",
"停止某个任务",
"<p",
">",
"Function",
":",
"removeTaskByTaskId<",
"/",
"p",
">",
"<p",
">",
"Description",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java#L156-L163 |
rey5137/material | material/src/main/java/com/rey/material/widget/FloatingActionButton.java | FloatingActionButton.setIcon | public void setIcon(Drawable icon, boolean animation){
if(icon == null)
return;
if(animation) {
mSwitchIconAnimator.startAnimation(icon);
invalidate();
}
else{
if(mIcon != null){
mIcon.setCallback(null);
unscheduleDrawable(mIcon);
}
mIcon = icon;
float half = mIconSize / 2f;
mIcon.setBounds((int)(mBackground.getCenterX() - half), (int)(mBackground.getCenterY() - half), (int)(mBackground.getCenterX() + half), (int)(mBackground.getCenterY() + half));
mIcon.setCallback(this);
invalidate();
}
} | java | public void setIcon(Drawable icon, boolean animation){
if(icon == null)
return;
if(animation) {
mSwitchIconAnimator.startAnimation(icon);
invalidate();
}
else{
if(mIcon != null){
mIcon.setCallback(null);
unscheduleDrawable(mIcon);
}
mIcon = icon;
float half = mIconSize / 2f;
mIcon.setBounds((int)(mBackground.getCenterX() - half), (int)(mBackground.getCenterY() - half), (int)(mBackground.getCenterX() + half), (int)(mBackground.getCenterY() + half));
mIcon.setCallback(this);
invalidate();
}
} | [
"public",
"void",
"setIcon",
"(",
"Drawable",
"icon",
",",
"boolean",
"animation",
")",
"{",
"if",
"(",
"icon",
"==",
"null",
")",
"return",
";",
"if",
"(",
"animation",
")",
"{",
"mSwitchIconAnimator",
".",
"startAnimation",
"(",
"icon",
")",
";",
"inva... | Set the drawable that is used as this button's icon.
@param icon The drawable.
@param animation Indicate should show animation when switch drawable or not. | [
"Set",
"the",
"drawable",
"that",
"is",
"used",
"as",
"this",
"button",
"s",
"icon",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/FloatingActionButton.java#L277-L297 |
apereo/cas | support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java | OpenIdServiceResponseBuilder.getAssociation | protected Association getAssociation(final ServerManager serverManager, final ParameterList parameterList) {
try {
val authReq = AuthRequest.createAuthRequest(parameterList, serverManager.getRealmVerifier());
val parameterMap = authReq.getParameterMap();
if (parameterMap != null && !parameterMap.isEmpty()) {
val assocHandle = (String) parameterMap.get(OpenIdProtocolConstants.OPENID_ASSOCHANDLE);
if (assocHandle != null) {
return serverManager.getSharedAssociations().load(assocHandle);
}
}
} catch (final MessageException e) {
LOGGER.error("Message exception : [{}]", e.getMessage(), e);
}
return null;
} | java | protected Association getAssociation(final ServerManager serverManager, final ParameterList parameterList) {
try {
val authReq = AuthRequest.createAuthRequest(parameterList, serverManager.getRealmVerifier());
val parameterMap = authReq.getParameterMap();
if (parameterMap != null && !parameterMap.isEmpty()) {
val assocHandle = (String) parameterMap.get(OpenIdProtocolConstants.OPENID_ASSOCHANDLE);
if (assocHandle != null) {
return serverManager.getSharedAssociations().load(assocHandle);
}
}
} catch (final MessageException e) {
LOGGER.error("Message exception : [{}]", e.getMessage(), e);
}
return null;
} | [
"protected",
"Association",
"getAssociation",
"(",
"final",
"ServerManager",
"serverManager",
",",
"final",
"ParameterList",
"parameterList",
")",
"{",
"try",
"{",
"val",
"authReq",
"=",
"AuthRequest",
".",
"createAuthRequest",
"(",
"parameterList",
",",
"serverManage... | Gets association.
@param serverManager the server manager
@param parameterList the parameter list
@return the association | [
"Gets",
"association",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java#L148-L162 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java | ManagementClient.getRule | public RuleDescription getRule(String topicPath, String subscriptionName, String ruleName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.getRuleAsync(topicPath, subscriptionName, ruleName));
} | java | public RuleDescription getRule(String topicPath, String subscriptionName, String ruleName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.getRuleAsync(topicPath, subscriptionName, ruleName));
} | [
"public",
"RuleDescription",
"getRule",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
",",
"String",
"ruleName",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"this",
".",
"asy... | Retrieves a rule for a given topic and subscription from the service namespace
@param topicPath - The path of the topic relative to service bus namespace.
@param subscriptionName - The name of the subscription.
@param ruleName - The name of the rule.
@return - RuleDescription containing information about the subscription.
@throws IllegalArgumentException - Thrown if path is null, empty, or not in right format or length.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws MessagingEntityNotFoundException - Entity with this name doesn't exist.
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws InterruptedException if the current thread was interrupted | [
"Retrieves",
"a",
"rule",
"for",
"a",
"given",
"topic",
"and",
"subscription",
"from",
"the",
"service",
"namespace"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L150-L152 |
Terracotta-OSS/statistics | src/main/java/org/terracotta/context/query/Matchers.java | Matchers.hasAttribute | public static Matcher<Map<String, Object>> hasAttribute(final String key, final Object value) {
return new Matcher<Map<String, Object>>() {
@Override
protected boolean matchesSafely(Map<String, Object> object) {
return object.containsKey(key) && value.equals(object.get(key));
}
};
} | java | public static Matcher<Map<String, Object>> hasAttribute(final String key, final Object value) {
return new Matcher<Map<String, Object>>() {
@Override
protected boolean matchesSafely(Map<String, Object> object) {
return object.containsKey(key) && value.equals(object.get(key));
}
};
} | [
"public",
"static",
"Matcher",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"hasAttribute",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"new",
"Matcher",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",... | Returns a matcher that matches attribute maps that include the given
attribute entry.
@param key attribute name
@param value attribute value
@return a {@code Map<String, Object>} matcher | [
"Returns",
"a",
"matcher",
"that",
"matches",
"attribute",
"maps",
"that",
"include",
"the",
"given",
"attribute",
"entry",
"."
] | train | https://github.com/Terracotta-OSS/statistics/blob/d24e4989b8c8dbe4f5210e49c7945d51b6585881/src/main/java/org/terracotta/context/query/Matchers.java#L130-L138 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.getProcessorForUnknown | XSLTElementProcessor getProcessorForUnknown(String uri, String localName)
{
// XSLTElementProcessor lreDef = null; // return value
if (null == m_elements)
return null;
int n = m_elements.length;
for (int i = 0; i < n; i++)
{
XSLTElementDef def = m_elements[i];
if (def.m_name.equals("unknown") && uri.length() > 0)
{
return def.m_elementProcessor;
}
}
return null;
} | java | XSLTElementProcessor getProcessorForUnknown(String uri, String localName)
{
// XSLTElementProcessor lreDef = null; // return value
if (null == m_elements)
return null;
int n = m_elements.length;
for (int i = 0; i < n; i++)
{
XSLTElementDef def = m_elements[i];
if (def.m_name.equals("unknown") && uri.length() > 0)
{
return def.m_elementProcessor;
}
}
return null;
} | [
"XSLTElementProcessor",
"getProcessorForUnknown",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"// XSLTElementProcessor lreDef = null; // return value",
"if",
"(",
"null",
"==",
"m_elements",
")",
"return",
"null",
";",
"int",
"n",
"=",
"m_elements",
".... | Given an unknown element, get the processor
for the element.
@param uri The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@return normally a {@link ProcessorUnknown} reference.
@see ProcessorUnknown | [
"Given",
"an",
"unknown",
"element",
"get",
"the",
"processor",
"for",
"the",
"element",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L530-L550 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.putSerializableArrayList | public static void putSerializableArrayList(@NonNull Bundle bundle, @NonNull String key, @NonNull ArrayList<? extends Serializable> list) {
bundle.putSerializable(key, list);
} | java | public static void putSerializableArrayList(@NonNull Bundle bundle, @NonNull String key, @NonNull ArrayList<? extends Serializable> list) {
bundle.putSerializable(key, list);
} | [
"public",
"static",
"void",
"putSerializableArrayList",
"(",
"@",
"NonNull",
"Bundle",
"bundle",
",",
"@",
"NonNull",
"String",
"key",
",",
"@",
"NonNull",
"ArrayList",
"<",
"?",
"extends",
"Serializable",
">",
"list",
")",
"{",
"bundle",
".",
"putSerializable... | Convenient method to save {@link java.util.ArrayList} containing {@link java.io.Serializable} items onto {@link android.os.Bundle}.
Since it fails to save a list that containing not {@link java.io.Serializable} items with {@link android.os.Bundle#putSerializable(String, Serializable)} at runtime,
this is useful to get an information about putting non-serializable items array list at compile time.
@param bundle a bundle.
@param list to be stored on the bundle. | [
"Convenient",
"method",
"to",
"save",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L1104-L1106 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertNodeExist | public static void assertNodeExist(final Node rootNode, final String relPath) throws RepositoryException {
try {
rootNode.getNode(relPath);
} catch (final PathNotFoundException e) {
LOG.debug("Node {} does not exist in path {}", relPath, rootNode.getPath(), e);
fail(e.getMessage());
}
} | java | public static void assertNodeExist(final Node rootNode, final String relPath) throws RepositoryException {
try {
rootNode.getNode(relPath);
} catch (final PathNotFoundException e) {
LOG.debug("Node {} does not exist in path {}", relPath, rootNode.getPath(), e);
fail(e.getMessage());
}
} | [
"public",
"static",
"void",
"assertNodeExist",
"(",
"final",
"Node",
"rootNode",
",",
"final",
"String",
"relPath",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"rootNode",
".",
"getNode",
"(",
"relPath",
")",
";",
"}",
"catch",
"(",
"final",
"Path... | Asserts that a specific node exists under the root node, where the specific node is specified using its relative
path
@param rootNode
the root Node to start the search
@param relPath
the relative path of the node that is asserted to exist
@throws RepositoryException
if the repository access failed | [
"Asserts",
"that",
"a",
"specific",
"node",
"exists",
"under",
"the",
"root",
"node",
"where",
"the",
"specific",
"node",
"is",
"specified",
"using",
"its",
"relative",
"path"
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L155-L162 |
jqno/equalsverifier | src/main/java/nl/jqno/equalsverifier/ConfiguredEqualsVerifier.java | ConfiguredEqualsVerifier.withGenericPrefabValues | public <S> ConfiguredEqualsVerifier withGenericPrefabValues(Class<S> otherType, Func1<?, S> factory) {
PrefabValuesApi.addGenericPrefabValues(factoryCache, otherType, factory);
return this;
} | java | public <S> ConfiguredEqualsVerifier withGenericPrefabValues(Class<S> otherType, Func1<?, S> factory) {
PrefabValuesApi.addGenericPrefabValues(factoryCache, otherType, factory);
return this;
} | [
"public",
"<",
"S",
">",
"ConfiguredEqualsVerifier",
"withGenericPrefabValues",
"(",
"Class",
"<",
"S",
">",
"otherType",
",",
"Func1",
"<",
"?",
",",
"S",
">",
"factory",
")",
"{",
"PrefabValuesApi",
".",
"addGenericPrefabValues",
"(",
"factoryCache",
",",
"o... | Adds a factory to generate prefabricated values for instance fields of
classes with 1 generic type parameter that EqualsVerifier cannot
instantiate by itself.
@param <S> The class of the prefabricated values.
@param otherType The class of the prefabricated values.
@param factory A factory to generate an instance of {@code S}, given a
value of its generic type parameter.
@return {@code this}, for easy method chaining.
@throws NullPointerException if either {@code otherType} or
{@code factory} is null. | [
"Adds",
"a",
"factory",
"to",
"generate",
"prefabricated",
"values",
"for",
"instance",
"fields",
"of",
"classes",
"with",
"1",
"generic",
"type",
"parameter",
"that",
"EqualsVerifier",
"cannot",
"instantiate",
"by",
"itself",
"."
] | train | https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/ConfiguredEqualsVerifier.java#L60-L63 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeConnectionAsync | public static RequestAsyncTask executeConnectionAsync(HttpURLConnection connection, RequestBatch requests) {
return executeConnectionAsync(null, connection, requests);
} | java | public static RequestAsyncTask executeConnectionAsync(HttpURLConnection connection, RequestBatch requests) {
return executeConnectionAsync(null, connection, requests);
} | [
"public",
"static",
"RequestAsyncTask",
"executeConnectionAsync",
"(",
"HttpURLConnection",
"connection",
",",
"RequestBatch",
"requests",
")",
"{",
"return",
"executeConnectionAsync",
"(",
"null",
",",
"connection",
",",
"requests",
")",
";",
"}"
] | Asynchronously executes requests that have already been serialized into an HttpURLConnection. No validation is
done that the contents of the connection actually reflect the serialized requests, so it is the caller's
responsibility to ensure that it will correctly generate the desired responses. This function will return
immediately, and the requests will be processed on a separate thread. In order to process results of a request,
or determine whether a request succeeded or failed, a callback must be specified (see the
{@link #setCallback(Callback) setCallback} method).
<p/>
This should only be called from the UI thread.
@param connection
the HttpURLConnection that the requests were serialized into
@param requests
the requests represented by the HttpURLConnection
@return a RequestAsyncTask that is executing the request | [
"Asynchronously",
"executes",
"requests",
"that",
"have",
"already",
"been",
"serialized",
"into",
"an",
"HttpURLConnection",
".",
"No",
"validation",
"is",
"done",
"that",
"the",
"contents",
"of",
"the",
"connection",
"actually",
"reflect",
"the",
"serialized",
"... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1596-L1598 |
belaban/JGroups | src/org/jgroups/protocols/AUTH.java | AUTH.handleAuthHeader | protected boolean handleAuthHeader(GMS.GmsHeader gms_hdr, AuthHeader auth_hdr, Message msg) {
if(needsAuthentication(gms_hdr)) {
if(this.auth_token.authenticate(auth_hdr.getToken(), msg))
return true; // authentication passed, send message up the stack
else {
log.warn("%s: failed to validate AuthHeader (token: %s) from %s; dropping message and sending " +
"rejection message",
local_addr, auth_token.getClass().getSimpleName(), msg.src());
sendRejectionMessage(gms_hdr.getType(), msg.getSrc(), "authentication failed");
return false;
}
}
return true;
} | java | protected boolean handleAuthHeader(GMS.GmsHeader gms_hdr, AuthHeader auth_hdr, Message msg) {
if(needsAuthentication(gms_hdr)) {
if(this.auth_token.authenticate(auth_hdr.getToken(), msg))
return true; // authentication passed, send message up the stack
else {
log.warn("%s: failed to validate AuthHeader (token: %s) from %s; dropping message and sending " +
"rejection message",
local_addr, auth_token.getClass().getSimpleName(), msg.src());
sendRejectionMessage(gms_hdr.getType(), msg.getSrc(), "authentication failed");
return false;
}
}
return true;
} | [
"protected",
"boolean",
"handleAuthHeader",
"(",
"GMS",
".",
"GmsHeader",
"gms_hdr",
",",
"AuthHeader",
"auth_hdr",
",",
"Message",
"msg",
")",
"{",
"if",
"(",
"needsAuthentication",
"(",
"gms_hdr",
")",
")",
"{",
"if",
"(",
"this",
".",
"auth_token",
".",
... | Handles a GMS header
@param gms_hdr
@param msg
@return true if the message should be passed up, or else false | [
"Handles",
"a",
"GMS",
"header"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/AUTH.java#L214-L227 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.replicateLastBlock | private void replicateLastBlock(String src, INodeFileUnderConstruction file) {
BlockInfo[] blks = file.getBlocks();
if (blks == null || blks.length == 0)
return;
BlockInfo block = blks[blks.length-1];
DatanodeDescriptor[] targets = file.getValidTargets();
final int numOfTargets = targets == null ? 0 : targets.length;
NumberReplicas status = countNodes(block);
int totalReplicas = status.getTotal();
if (numOfTargets > totalReplicas) {
pendingReplications.add(block, numOfTargets-totalReplicas);
}
int expectedReplicas = file.getReplication();
if (numOfTargets < expectedReplicas ||
status.decommissionedReplicas != 0 ||
status.corruptReplicas != 0) {
LOG.info("Add " + block + " of " + src + " to needReplication queue: " +
" numOfTargets = " + numOfTargets +
" decomissionedReplicas = " + status.decommissionedReplicas +
" corruptReplicas = " + status.corruptReplicas);
neededReplications.add(block, status.liveReplicas,
status.decommissionedReplicas, expectedReplicas);
}
// update metrics
if (numOfTargets < expectedReplicas) {
if (numOfTargets == 1) {
myFSMetrics.numNewBlocksWithOneReplica.inc();
}
} else {
myFSMetrics.numNewBlocksWithoutFailure.inc();
}
myFSMetrics.numNewBlocks.inc();
} | java | private void replicateLastBlock(String src, INodeFileUnderConstruction file) {
BlockInfo[] blks = file.getBlocks();
if (blks == null || blks.length == 0)
return;
BlockInfo block = blks[blks.length-1];
DatanodeDescriptor[] targets = file.getValidTargets();
final int numOfTargets = targets == null ? 0 : targets.length;
NumberReplicas status = countNodes(block);
int totalReplicas = status.getTotal();
if (numOfTargets > totalReplicas) {
pendingReplications.add(block, numOfTargets-totalReplicas);
}
int expectedReplicas = file.getReplication();
if (numOfTargets < expectedReplicas ||
status.decommissionedReplicas != 0 ||
status.corruptReplicas != 0) {
LOG.info("Add " + block + " of " + src + " to needReplication queue: " +
" numOfTargets = " + numOfTargets +
" decomissionedReplicas = " + status.decommissionedReplicas +
" corruptReplicas = " + status.corruptReplicas);
neededReplications.add(block, status.liveReplicas,
status.decommissionedReplicas, expectedReplicas);
}
// update metrics
if (numOfTargets < expectedReplicas) {
if (numOfTargets == 1) {
myFSMetrics.numNewBlocksWithOneReplica.inc();
}
} else {
myFSMetrics.numNewBlocksWithoutFailure.inc();
}
myFSMetrics.numNewBlocks.inc();
} | [
"private",
"void",
"replicateLastBlock",
"(",
"String",
"src",
",",
"INodeFileUnderConstruction",
"file",
")",
"{",
"BlockInfo",
"[",
"]",
"blks",
"=",
"file",
".",
"getBlocks",
"(",
")",
";",
"if",
"(",
"blks",
"==",
"null",
"||",
"blks",
".",
"length",
... | Check last block of the file under construction
Replicate it if it is under replicated
@param src the file name
@param file the file's inode | [
"Check",
"last",
"block",
"of",
"the",
"file",
"under",
"construction",
"Replicate",
"it",
"if",
"it",
"is",
"under",
"replicated"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2890-L2923 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/download/ImageDownloader.java | ImageDownloader.shutDown | public void shutDown() {
downloadExecutor.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!downloadExecutor.awaitTermination(60, TimeUnit.SECONDS)) {
downloadExecutor.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!downloadExecutor.awaitTermination(60, TimeUnit.SECONDS))
System.err.println("Pool did not terminate");
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
downloadExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} | java | public void shutDown() {
downloadExecutor.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!downloadExecutor.awaitTermination(60, TimeUnit.SECONDS)) {
downloadExecutor.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!downloadExecutor.awaitTermination(60, TimeUnit.SECONDS))
System.err.println("Pool did not terminate");
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
downloadExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} | [
"public",
"void",
"shutDown",
"(",
")",
"{",
"downloadExecutor",
".",
"shutdown",
"(",
")",
";",
"// Disable new tasks from being submitted\r",
"try",
"{",
"// Wait a while for existing tasks to terminate\r",
"if",
"(",
"!",
"downloadExecutor",
".",
"awaitTermination",
"(... | Shuts the download executor down, waiting for up to 60 seconds for the remaining tasks to complete. See
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html | [
"Shuts",
"the",
"download",
"executor",
"down",
"waiting",
"for",
"up",
"to",
"60",
"seconds",
"for",
"the",
"remaining",
"tasks",
"to",
"complete",
".",
"See",
"http",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"7",
"/",
"docs",... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/download/ImageDownloader.java#L179-L195 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/Util.java | Util.ensureNotNull | static <T> T ensureNotNull(String msg, T t) throws ClassLoadingConfigurationException {
ensure(msg, t != null);
return t;
} | java | static <T> T ensureNotNull(String msg, T t) throws ClassLoadingConfigurationException {
ensure(msg, t != null);
return t;
} | [
"static",
"<",
"T",
">",
"T",
"ensureNotNull",
"(",
"String",
"msg",
",",
"T",
"t",
")",
"throws",
"ClassLoadingConfigurationException",
"{",
"ensure",
"(",
"msg",
",",
"t",
"!=",
"null",
")",
";",
"return",
"t",
";",
"}"
] | Check that the parameter is not null.
@param msg the exception message to use if the parameter is null
@return the parameter if it isn't null
@throws ClassLoadingConfigurationException if the parameter is null | [
"Check",
"that",
"the",
"parameter",
"is",
"not",
"null",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/Util.java#L45-L48 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.forSite | public DB forSite(final long siteId) {
return siteId == this.siteId ? this : new DB(this.connectionSupplier, siteId, this.taxonomyTermCaches.keySet(), this.taxonomyCacheTimeout,
this.userCache, this.usernameCache, this.metrics);
} | java | public DB forSite(final long siteId) {
return siteId == this.siteId ? this : new DB(this.connectionSupplier, siteId, this.taxonomyTermCaches.keySet(), this.taxonomyCacheTimeout,
this.userCache, this.usernameCache, this.metrics);
} | [
"public",
"DB",
"forSite",
"(",
"final",
"long",
"siteId",
")",
"{",
"return",
"siteId",
"==",
"this",
".",
"siteId",
"?",
"this",
":",
"new",
"DB",
"(",
"this",
".",
"connectionSupplier",
",",
"siteId",
",",
"this",
".",
"taxonomyTermCaches",
".",
"keyS... | Creates a database for another site with shared user caches, metrics and taxonomy terms.
@param siteId The site id.
@return The site-specific database. | [
"Creates",
"a",
"database",
"for",
"another",
"site",
"with",
"shared",
"user",
"caches",
"metrics",
"and",
"taxonomy",
"terms",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L85-L88 |
app55/app55-java | src/main/java/com/app55/util/Base64.java | Base64.encodeFromFile | public static String encodeFromFile(String filename)
{
String encodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File(filename);
byte[] buffer = new byte[Math.max((int) (file.length() * 1.4), 40)]; // Need max() for math on small files (v2.2.1)
int length = 0;
int numBytes = 0;
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)), Base64.ENCODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
length += numBytes;
// Save in a variable to return
encodedData = new String(buffer, 0, length, Base64.PREFERRED_ENCODING);
} // end try
catch (java.io.IOException e)
{
} // end catch: IOException
finally
{
try
{
bis.close();
}
catch (Exception e)
{
}
} // end finally
return encodedData;
} | java | public static String encodeFromFile(String filename)
{
String encodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File(filename);
byte[] buffer = new byte[Math.max((int) (file.length() * 1.4), 40)]; // Need max() for math on small files (v2.2.1)
int length = 0;
int numBytes = 0;
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)), Base64.ENCODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
length += numBytes;
// Save in a variable to return
encodedData = new String(buffer, 0, length, Base64.PREFERRED_ENCODING);
} // end try
catch (java.io.IOException e)
{
} // end catch: IOException
finally
{
try
{
bis.close();
}
catch (Exception e)
{
}
} // end finally
return encodedData;
} | [
"public",
"static",
"String",
"encodeFromFile",
"(",
"String",
"filename",
")",
"{",
"String",
"encodedData",
"=",
"null",
";",
"Base64",
".",
"InputStream",
"bis",
"=",
"null",
";",
"try",
"{",
"// Set up some useful variables",
"java",
".",
"io",
".",
"File"... | Convenience method for reading a binary file and base64-encoding it.
@param filename
Filename for reading binary data
@return base64-encoded string or null if unsuccessful
@since 2.1 | [
"Convenience",
"method",
"for",
"reading",
"a",
"binary",
"file",
"and",
"base64",
"-",
"encoding",
"it",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/main/java/com/app55/util/Base64.java#L1243-L1281 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java | MotionEventUtils.getVerticalMotionDirection | public static MotionDirection getVerticalMotionDirection(MotionEvent e1, MotionEvent e2) {
return getVerticalMotionDirection(e1, e2, DEFAULT_THRESHOLD);
} | java | public static MotionDirection getVerticalMotionDirection(MotionEvent e1, MotionEvent e2) {
return getVerticalMotionDirection(e1, e2, DEFAULT_THRESHOLD);
} | [
"public",
"static",
"MotionDirection",
"getVerticalMotionDirection",
"(",
"MotionEvent",
"e1",
",",
"MotionEvent",
"e2",
")",
"{",
"return",
"getVerticalMotionDirection",
"(",
"e1",
",",
"e2",
",",
"DEFAULT_THRESHOLD",
")",
";",
"}"
] | Calculate the vertical move motion direction.
@param e1 start point of the motion.
@param e2 end point of the motion.
@return the motion direction for the vertical axis. | [
"Calculate",
"the",
"vertical",
"move",
"motion",
"direction",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java#L85-L87 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java | Blob.copyTo | public CopyWriter copyTo(String targetBucket, String targetBlob, BlobSourceOption... options) {
return copyTo(BlobId.of(targetBucket, targetBlob), options);
} | java | public CopyWriter copyTo(String targetBucket, String targetBlob, BlobSourceOption... options) {
return copyTo(BlobId.of(targetBucket, targetBlob), options);
} | [
"public",
"CopyWriter",
"copyTo",
"(",
"String",
"targetBucket",
",",
"String",
"targetBlob",
",",
"BlobSourceOption",
"...",
"options",
")",
"{",
"return",
"copyTo",
"(",
"BlobId",
".",
"of",
"(",
"targetBucket",
",",
"targetBlob",
")",
",",
"options",
")",
... | Sends a copy request for the current blob to the target blob. Possibly also some of the
metadata are copied (e.g. content-type).
<p>Example of copying the blob to a different bucket with a different name.
<pre>{@code
String bucketName = "my_unique_bucket";
String blobName = "copy_blob_name";
CopyWriter copyWriter = blob.copyTo(bucketName, blobName);
Blob copiedBlob = copyWriter.getResult();
}</pre>
<p>Example of moving a blob to a different bucket with a different name.
<pre>{@code
String destBucket = "my_unique_bucket";
String destBlob = "move_blob_name";
CopyWriter copyWriter = blob.copyTo(destBucket, destBlob);
Blob copiedBlob = copyWriter.getResult();
boolean deleted = blob.delete();
}</pre>
@param targetBucket target bucket's name
@param targetBlob target blob's name
@param options source blob options
@return a {@link CopyWriter} object that can be used to get information on the newly created
blob or to complete the copy if more than one RPC request is needed
@throws StorageException upon failure | [
"Sends",
"a",
"copy",
"request",
"for",
"the",
"current",
"blob",
"to",
"the",
"target",
"blob",
".",
"Possibly",
"also",
"some",
"of",
"the",
"metadata",
"are",
"copied",
"(",
"e",
".",
"g",
".",
"content",
"-",
"type",
")",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java#L640-L642 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java | JBBPNamedNumericFieldMap.getExternalFieldValue | public int getExternalFieldValue(final String externalFieldName, final JBBPCompiledBlock compiledBlock, final JBBPIntegerValueEvaluator evaluator) {
final String normalizedName = JBBPUtils.normalizeFieldNameOrPath(externalFieldName);
if (this.externalValueProvider == null) {
throw new JBBPEvalException("Request for '" + externalFieldName + "' but there is not any value provider", evaluator);
} else {
return this.externalValueProvider.provideArraySize(normalizedName, this, compiledBlock);
}
} | java | public int getExternalFieldValue(final String externalFieldName, final JBBPCompiledBlock compiledBlock, final JBBPIntegerValueEvaluator evaluator) {
final String normalizedName = JBBPUtils.normalizeFieldNameOrPath(externalFieldName);
if (this.externalValueProvider == null) {
throw new JBBPEvalException("Request for '" + externalFieldName + "' but there is not any value provider", evaluator);
} else {
return this.externalValueProvider.provideArraySize(normalizedName, this, compiledBlock);
}
} | [
"public",
"int",
"getExternalFieldValue",
"(",
"final",
"String",
"externalFieldName",
",",
"final",
"JBBPCompiledBlock",
"compiledBlock",
",",
"final",
"JBBPIntegerValueEvaluator",
"evaluator",
")",
"{",
"final",
"String",
"normalizedName",
"=",
"JBBPUtils",
".",
"norm... | Ask the registered external value provider for a field value.
@param externalFieldName the name of a field, it must not be null
@param compiledBlock the compiled block, it must not be null
@param evaluator an evaluator which is calling the method, it can be null
@return integer value for the field
@throws JBBPException if there is not any external value provider | [
"Ask",
"the",
"registered",
"external",
"value",
"provider",
"for",
"a",
"field",
"value",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java#L296-L303 |
Polidea/RxAndroidBle | sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/advanced/Presenter.java | Presenter.transformToPresenterEvent | @NonNull
private static ObservableTransformer<byte[], PresenterEvent> transformToPresenterEvent(Type type) {
return observable -> observable.map(writtenBytes -> ((PresenterEvent) new ResultEvent(writtenBytes, type)))
.onErrorReturn(throwable -> new ErrorEvent(throwable, type));
} | java | @NonNull
private static ObservableTransformer<byte[], PresenterEvent> transformToPresenterEvent(Type type) {
return observable -> observable.map(writtenBytes -> ((PresenterEvent) new ResultEvent(writtenBytes, type)))
.onErrorReturn(throwable -> new ErrorEvent(throwable, type));
} | [
"@",
"NonNull",
"private",
"static",
"ObservableTransformer",
"<",
"byte",
"[",
"]",
",",
"PresenterEvent",
">",
"transformToPresenterEvent",
"(",
"Type",
"type",
")",
"{",
"return",
"observable",
"->",
"observable",
".",
"map",
"(",
"writtenBytes",
"->",
"(",
... | A convenience function creating a transformer that will wrap the emissions in either {@link ResultEvent} or {@link ErrorEvent}
with a given {@link Type}
@param type the type to wrap with
@return transformer that will emit an observable that will be emitting ResultEvent or ErrorEvent with a given type | [
"A",
"convenience",
"function",
"creating",
"a",
"transformer",
"that",
"will",
"wrap",
"the",
"emissions",
"in",
"either",
"{",
"@link",
"ResultEvent",
"}",
"or",
"{",
"@link",
"ErrorEvent",
"}",
"with",
"a",
"given",
"{",
"@link",
"Type",
"}"
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/advanced/Presenter.java#L233-L237 |
voldemort/voldemort | src/java/voldemort/store/stats/StoreStats.java | StoreStats.recordGetTime | public void recordGetTime(long timeNS, boolean emptyResponse, long totalBytes, long keyBytes) {
recordTime(Tracked.GET, timeNS, emptyResponse ? 1 : 0, totalBytes, keyBytes, 0);
} | java | public void recordGetTime(long timeNS, boolean emptyResponse, long totalBytes, long keyBytes) {
recordTime(Tracked.GET, timeNS, emptyResponse ? 1 : 0, totalBytes, keyBytes, 0);
} | [
"public",
"void",
"recordGetTime",
"(",
"long",
"timeNS",
",",
"boolean",
"emptyResponse",
",",
"long",
"totalBytes",
",",
"long",
"keyBytes",
")",
"{",
"recordTime",
"(",
"Tracked",
".",
"GET",
",",
"timeNS",
",",
"emptyResponse",
"?",
"1",
":",
"0",
",",... | Record the duration of a get operation, along with whether or not an
empty response (ie no values matched) and the size of the values
returned. | [
"Record",
"the",
"duration",
"of",
"a",
"get",
"operation",
"along",
"with",
"whether",
"or",
"not",
"an",
"empty",
"response",
"(",
"ie",
"no",
"values",
"matched",
")",
"and",
"the",
"size",
"of",
"the",
"values",
"returned",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/StoreStats.java#L113-L115 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java | ReferenceImpl.referencedElementRemoved | public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) {
removeReference(referenceSourceElement, referenceTargetElement);
}
}
} | java | public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) {
removeReference(referenceSourceElement, referenceTargetElement);
}
}
} | [
"public",
"void",
"referencedElementRemoved",
"(",
"ModelElementInstance",
"referenceTargetElement",
",",
"Object",
"referenceIdentifier",
")",
"{",
"for",
"(",
"ModelElementInstance",
"referenceSourceElement",
":",
"findReferenceSourceElements",
"(",
"referenceTargetElement",
... | Remove the reference if the target element is removed
@param referenceTargetElement the reference target model element instance, which is removed
@param referenceIdentifier the identifier of the reference to filter reference source elements | [
"Remove",
"the",
"reference",
"if",
"the",
"target",
"element",
"is",
"removed"
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L167-L173 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/TranslateExprNodeVisitor.java | TranslateExprNodeVisitor.genCodeForParamAccess | Expression genCodeForParamAccess(String paramName, VarDefn varDefn) {
Expression source = OPT_DATA;
if (varDefn.isInjected()) {
// Special case for csp_nonce. It is created by the compiler itself, and users should not need
// to set it. So, instead of generating opt_ij_data.csp_nonce, we generate opt_ij_data &&
// opt_ij_data.csp_nonce.
// TODO(lukes): we only need to generate this logic if there aren't any other ij params
if (paramName.equals(CSP_NONCE_VARIABLE_NAME)) {
return OPT_IJ_DATA.and(OPT_IJ_DATA.dotAccess(paramName), codeGenerator);
}
source = OPT_IJ_DATA;
} else if (varDefn.kind() == VarDefn.Kind.STATE) {
return genCodeForStateAccess(paramName, (TemplateStateVar) varDefn);
}
return source.dotAccess(paramName);
} | java | Expression genCodeForParamAccess(String paramName, VarDefn varDefn) {
Expression source = OPT_DATA;
if (varDefn.isInjected()) {
// Special case for csp_nonce. It is created by the compiler itself, and users should not need
// to set it. So, instead of generating opt_ij_data.csp_nonce, we generate opt_ij_data &&
// opt_ij_data.csp_nonce.
// TODO(lukes): we only need to generate this logic if there aren't any other ij params
if (paramName.equals(CSP_NONCE_VARIABLE_NAME)) {
return OPT_IJ_DATA.and(OPT_IJ_DATA.dotAccess(paramName), codeGenerator);
}
source = OPT_IJ_DATA;
} else if (varDefn.kind() == VarDefn.Kind.STATE) {
return genCodeForStateAccess(paramName, (TemplateStateVar) varDefn);
}
return source.dotAccess(paramName);
} | [
"Expression",
"genCodeForParamAccess",
"(",
"String",
"paramName",
",",
"VarDefn",
"varDefn",
")",
"{",
"Expression",
"source",
"=",
"OPT_DATA",
";",
"if",
"(",
"varDefn",
".",
"isInjected",
"(",
")",
")",
"{",
"// Special case for csp_nonce. It is created by the comp... | Method that returns code to access a named parameter.
@param paramName the name of the parameter.
@param varDefn The variable definition of the parameter
@return The code to access the value of that parameter. | [
"Method",
"that",
"returns",
"code",
"to",
"access",
"a",
"named",
"parameter",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/TranslateExprNodeVisitor.java#L198-L213 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/ModelDiff.java | ModelDiff.createModelDiff | public static ModelDiff createModelDiff(OpenEngSBModel updated, String completeModelId,
EngineeringDatabaseService edbService, EDBConverter edbConverter) {
EDBObject queryResult = edbService.getObject(completeModelId);
OpenEngSBModel old = edbConverter.convertEDBObjectToModel(updated.getClass(), queryResult);
ModelDiff diff = new ModelDiff(old, updated);
calculateDifferences(diff);
return diff;
} | java | public static ModelDiff createModelDiff(OpenEngSBModel updated, String completeModelId,
EngineeringDatabaseService edbService, EDBConverter edbConverter) {
EDBObject queryResult = edbService.getObject(completeModelId);
OpenEngSBModel old = edbConverter.convertEDBObjectToModel(updated.getClass(), queryResult);
ModelDiff diff = new ModelDiff(old, updated);
calculateDifferences(diff);
return diff;
} | [
"public",
"static",
"ModelDiff",
"createModelDiff",
"(",
"OpenEngSBModel",
"updated",
",",
"String",
"completeModelId",
",",
"EngineeringDatabaseService",
"edbService",
",",
"EDBConverter",
"edbConverter",
")",
"{",
"EDBObject",
"queryResult",
"=",
"edbService",
".",
"g... | Creates an instance of the ModelDiff class based on the given model. It loads the old status of the model and
calculates the differences of this two models. | [
"Creates",
"an",
"instance",
"of",
"the",
"ModelDiff",
"class",
"based",
"on",
"the",
"given",
"model",
".",
"It",
"loads",
"the",
"old",
"status",
"of",
"the",
"model",
"and",
"calculates",
"the",
"differences",
"of",
"this",
"two",
"models",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/ModelDiff.java#L60-L67 |
sirensolutions/siren-join | src/main/java/solutions/siren/join/index/query/FieldDataTermsQuery.java | FieldDataTermsQuery.newLongs | public static FieldDataTermsQuery newLongs(final byte[] encodedTerms, final IndexNumericFieldData fieldData, final long cacheKey) {
return new LongsFieldDataTermsQuery(encodedTerms, fieldData, cacheKey);
} | java | public static FieldDataTermsQuery newLongs(final byte[] encodedTerms, final IndexNumericFieldData fieldData, final long cacheKey) {
return new LongsFieldDataTermsQuery(encodedTerms, fieldData, cacheKey);
} | [
"public",
"static",
"FieldDataTermsQuery",
"newLongs",
"(",
"final",
"byte",
"[",
"]",
"encodedTerms",
",",
"final",
"IndexNumericFieldData",
"fieldData",
",",
"final",
"long",
"cacheKey",
")",
"{",
"return",
"new",
"LongsFieldDataTermsQuery",
"(",
"encodedTerms",
"... | Get a {@link FieldDataTermsQuery} that filters on non-floating point numeric terms found in a hppc
{@link LongHashSet}.
@param encodedTerms An encoded set of terms.
@param fieldData The fielddata for the field.
@param cacheKey A unique key to use for caching this query.
@return the query. | [
"Get",
"a",
"{",
"@link",
"FieldDataTermsQuery",
"}",
"that",
"filters",
"on",
"non",
"-",
"floating",
"point",
"numeric",
"terms",
"found",
"in",
"a",
"hppc",
"{",
"@link",
"LongHashSet",
"}",
"."
] | train | https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/index/query/FieldDataTermsQuery.java#L81-L83 |
google/closure-compiler | src/com/google/javascript/jscomp/JSError.java | JSError.make | public static JSError make(CheckLevel level, DiagnosticType type, String... arguments) {
return new JSError(null, null, -1, -1, type, level, arguments);
} | java | public static JSError make(CheckLevel level, DiagnosticType type, String... arguments) {
return new JSError(null, null, -1, -1, type, level, arguments);
} | [
"public",
"static",
"JSError",
"make",
"(",
"CheckLevel",
"level",
",",
"DiagnosticType",
"type",
",",
"String",
"...",
"arguments",
")",
"{",
"return",
"new",
"JSError",
"(",
"null",
",",
"null",
",",
"-",
"1",
",",
"-",
"1",
",",
"type",
",",
"level"... | Creates a JSError with no source information and a non-default level.
@param level
@param type The DiagnosticType
@param arguments Arguments to be incorporated into the message | [
"Creates",
"a",
"JSError",
"with",
"no",
"source",
"information",
"and",
"a",
"non",
"-",
"default",
"level",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L79-L81 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java | CWF2XML.isExcluded | private boolean isExcluded(String name, String cmpname, String value) {
return exclude.contains(excludeKey(name, null, value)) || exclude.contains(excludeKey(name, cmpname, value));
} | java | private boolean isExcluded(String name, String cmpname, String value) {
return exclude.contains(excludeKey(name, null, value)) || exclude.contains(excludeKey(name, cmpname, value));
} | [
"private",
"boolean",
"isExcluded",
"(",
"String",
"name",
",",
"String",
"cmpname",
",",
"String",
"value",
")",
"{",
"return",
"exclude",
".",
"contains",
"(",
"excludeKey",
"(",
"name",
",",
"null",
",",
"value",
")",
")",
"||",
"exclude",
".",
"conta... | Returns true if the property is to be excluded.
@param name The property name.
@param cmpname The component name (may be null).
@param value The property value (may be null).
@return True if the property should be excluded. | [
"Returns",
"true",
"if",
"the",
"property",
"is",
"to",
"be",
"excluded",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L179-L181 |
bmelnychuk/AndroidTreeView | library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java | TwoDScrollView.smoothScrollBy | public final void smoothScrollBy(int dx, int dy) {
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
mScroller.startScroll(getScrollX(), getScrollY(), dx, dy);
awakenScrollBars(mScroller.getDuration());
invalidate();
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | java | public final void smoothScrollBy(int dx, int dy) {
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
mScroller.startScroll(getScrollX(), getScrollY(), dx, dy);
awakenScrollBars(mScroller.getDuration());
invalidate();
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | [
"public",
"final",
"void",
"smoothScrollBy",
"(",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"long",
"duration",
"=",
"AnimationUtils",
".",
"currentAnimationTimeMillis",
"(",
")",
"-",
"mLastScroll",
";",
"if",
"(",
"duration",
">",
"ANIMATED_SCROLL_GAP",
")",
... | Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
@param dx the number of pixels to scroll by on the X axis
@param dy the number of pixels to scroll by on the Y axis | [
"Like",
"{",
"@link",
"View#scrollBy",
"}",
"but",
"scroll",
"smoothly",
"instead",
"of",
"immediately",
"."
] | train | https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L734-L747 |
NessComputing/components-ness-jmx | src/main/java/com/nesscomputing/jmx/starter/JmxExporterConfig.java | JmxExporterConfig.defaultJmxExporterConfig | public static JmxExporterConfig defaultJmxExporterConfig(final InetAddress hostname, final Integer rmiRegistryPort, final Integer rmiServerPort, final boolean useRandomIds)
throws IOException
{
return new JmxExporterConfig(
(hostname != null) ? hostname : InetAddress.getByName(null),
(rmiRegistryPort != null) ? rmiRegistryPort : NetUtils.findUnusedPort(),
(rmiServerPort != null) ? rmiServerPort : NetUtils.findUnusedPort(),
useRandomIds);
} | java | public static JmxExporterConfig defaultJmxExporterConfig(final InetAddress hostname, final Integer rmiRegistryPort, final Integer rmiServerPort, final boolean useRandomIds)
throws IOException
{
return new JmxExporterConfig(
(hostname != null) ? hostname : InetAddress.getByName(null),
(rmiRegistryPort != null) ? rmiRegistryPort : NetUtils.findUnusedPort(),
(rmiServerPort != null) ? rmiServerPort : NetUtils.findUnusedPort(),
useRandomIds);
} | [
"public",
"static",
"JmxExporterConfig",
"defaultJmxExporterConfig",
"(",
"final",
"InetAddress",
"hostname",
",",
"final",
"Integer",
"rmiRegistryPort",
",",
"final",
"Integer",
"rmiServerPort",
",",
"final",
"boolean",
"useRandomIds",
")",
"throws",
"IOException",
"{"... | Creates a default configuration object.
@param hostname The hostname to use. If null, the localhost is used.
@param rmiRegistryPort The port for the JMX registry. This is where remote clients will connect to the MBean server.
@param rmiServerPort The port for the JMX Server. If null, a random port is used.
@param useRandomIds If true, use random ids for RMI.
@return A JmxExportConfig object.
@throws IOException | [
"Creates",
"a",
"default",
"configuration",
"object",
"."
] | train | https://github.com/NessComputing/components-ness-jmx/blob/694e0f117e1579019df835528a150257b57330b4/src/main/java/com/nesscomputing/jmx/starter/JmxExporterConfig.java#L43-L51 |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.groupBy | public <K> Stream<Grouped<K, T>> groupBy(final Func1<? super T, ? extends K> groupSelector) {
return groupBy(groupSelector, new Func1<T, T>() {
@Override
public T call(T value) {
return value;
}
});
} | java | public <K> Stream<Grouped<K, T>> groupBy(final Func1<? super T, ? extends K> groupSelector) {
return groupBy(groupSelector, new Func1<T, T>() {
@Override
public T call(T value) {
return value;
}
});
} | [
"public",
"<",
"K",
">",
"Stream",
"<",
"Grouped",
"<",
"K",
",",
"T",
">",
">",
"groupBy",
"(",
"final",
"Func1",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"groupSelector",
")",
"{",
"return",
"groupBy",
"(",
"groupSelector",
",",
"ne... | Returns a new stream of {@link Grouped} that is composed from keys that has been
extracted from each source stream item.
@param groupSelector a function that extracts a key from a given item.
@param <K> a type of key value.
@return a new stream of {@link Grouped} that is grouped by a key extracted from each source stream item. | [
"Returns",
"a",
"new",
"stream",
"of",
"{",
"@link",
"Grouped",
"}",
"that",
"is",
"composed",
"from",
"keys",
"that",
"has",
"been",
"extracted",
"from",
"each",
"source",
"stream",
"item",
"."
] | train | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L616-L623 |
klarna/HiveRunner | src/main/java/com/klarna/hiverunner/data/InsertIntoTable.java | InsertIntoTable.newInstance | public static InsertIntoTable newInstance(String databaseName, String tableName, HiveConf conf) {
TableDataBuilder builder = new TableDataBuilder(getHCatTable(databaseName, tableName, conf));
TableDataInserter inserter = new TableDataInserter(databaseName, tableName, conf);
return new InsertIntoTable(builder, inserter);
} | java | public static InsertIntoTable newInstance(String databaseName, String tableName, HiveConf conf) {
TableDataBuilder builder = new TableDataBuilder(getHCatTable(databaseName, tableName, conf));
TableDataInserter inserter = new TableDataInserter(databaseName, tableName, conf);
return new InsertIntoTable(builder, inserter);
} | [
"public",
"static",
"InsertIntoTable",
"newInstance",
"(",
"String",
"databaseName",
",",
"String",
"tableName",
",",
"HiveConf",
"conf",
")",
"{",
"TableDataBuilder",
"builder",
"=",
"new",
"TableDataBuilder",
"(",
"getHCatTable",
"(",
"databaseName",
",",
"tableNa... | Factory method for creating an {@link InsertIntoTable}.
<p>
This method is intended to be called via {@link HiveShell#insertInto(String, String)}.
</p>
@param databaseName The database name.
@param tableName The table name.
@param conf The {@link HiveConf}.
@return InsertIntoTable | [
"Factory",
"method",
"for",
"creating",
"an",
"{",
"@link",
"InsertIntoTable",
"}",
".",
"<p",
">",
"This",
"method",
"is",
"intended",
"to",
"be",
"called",
"via",
"{",
"@link",
"HiveShell#insertInto",
"(",
"String",
"String",
")",
"}",
".",
"<",
"/",
"... | train | https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/data/InsertIntoTable.java#L46-L50 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java | JobTargetExecutionsInner.listByStepAsync | public Observable<Page<JobExecutionInner>> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) {
return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName)
.map(new Func1<ServiceResponse<Page<JobExecutionInner>>, Page<JobExecutionInner>>() {
@Override
public Page<JobExecutionInner> call(ServiceResponse<Page<JobExecutionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<JobExecutionInner>> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) {
return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName)
.map(new Func1<ServiceResponse<Page<JobExecutionInner>>, Page<JobExecutionInner>>() {
@Override
public Page<JobExecutionInner> call(ServiceResponse<Page<JobExecutionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
"listByStepAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"jobAgentName",
",",
"final",
"String",
"jobName",
",",
"final",
... | Lists the target executions of a job step execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The id of the job execution
@param stepName The name of the step.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object | [
"Lists",
"the",
"target",
"executions",
"of",
"a",
"job",
"step",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java#L474-L482 |
js-lib-com/commons | src/main/java/js/util/Types.java | Types.typeToClass | private static Class<?> typeToClass(Type t)
{
if(t instanceof Class<?>) {
return (Class<?>)t;
}
if(t instanceof ParameterizedType) {
return (Class<?>)((ParameterizedType)t).getRawType();
}
throw new BugError("Unknown type %s to convert to class.", t);
} | java | private static Class<?> typeToClass(Type t)
{
if(t instanceof Class<?>) {
return (Class<?>)t;
}
if(t instanceof ParameterizedType) {
return (Class<?>)((ParameterizedType)t).getRawType();
}
throw new BugError("Unknown type %s to convert to class.", t);
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"typeToClass",
"(",
"Type",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"t",
";",
"}",
"if",
"(",
"t",
"instanceof",
"Pa... | Cast Java reflective type to language class. If <code>type</code> is instance of {@link Class} just return it. If
is parameterized type returns the raw class.
@param t Java reflective type.
@return the class described by given <code>type</code>. | [
"Cast",
"Java",
"reflective",
"type",
"to",
"language",
"class",
".",
"If",
"<code",
">",
"type<",
"/",
"code",
">",
"is",
"instance",
"of",
"{",
"@link",
"Class",
"}",
"just",
"return",
"it",
".",
"If",
"is",
"parameterized",
"type",
"returns",
"the",
... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Types.java#L627-L636 |
cdk/cdk | base/valencycheck/src/main/java/org/openscience/cdk/tools/SaturationChecker.java | SaturationChecker.calculateNumberOfImplicitHydrogens | public int calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container) throws CDKException {
return this.calculateNumberOfImplicitHydrogens(atom, container, false);
} | java | public int calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container) throws CDKException {
return this.calculateNumberOfImplicitHydrogens(atom, container, false);
} | [
"public",
"int",
"calculateNumberOfImplicitHydrogens",
"(",
"IAtom",
"atom",
",",
"IAtomContainer",
"container",
")",
"throws",
"CDKException",
"{",
"return",
"this",
".",
"calculateNumberOfImplicitHydrogens",
"(",
"atom",
",",
"container",
",",
"false",
")",
";",
"... | Calculate the number of missing hydrogens by subtracting the number of
bonds for the atom from the expected number of bonds. Charges are included
in the calculation. The number of expected bonds is defined by the AtomType
generated with the AtomTypeFactory.
@param atom Description of the Parameter
@param container Description of the Parameter
@return Description of the Return Value
@see AtomTypeFactory | [
"Calculate",
"the",
"number",
"of",
"missing",
"hydrogens",
"by",
"subtracting",
"the",
"number",
"of",
"bonds",
"for",
"the",
"atom",
"from",
"the",
"expected",
"number",
"of",
"bonds",
".",
"Charges",
"are",
"included",
"in",
"the",
"calculation",
".",
"Th... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SaturationChecker.java#L582-L584 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRulePersistenceImpl.java | CommerceDiscountRulePersistenceImpl.findAll | @Override
public List<CommerceDiscountRule> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceDiscountRule> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountRule",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce discount rules.
@return the commerce discount rules | [
"Returns",
"all",
"the",
"commerce",
"discount",
"rules",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRulePersistenceImpl.java#L1142-L1145 |
junit-team/junit4 | src/main/java/org/junit/runner/Request.java | Request.errorReport | public static Request errorReport(Class<?> klass, Throwable cause) {
return runner(new ErrorReportingRunner(klass, cause));
} | java | public static Request errorReport(Class<?> klass, Throwable cause) {
return runner(new ErrorReportingRunner(klass, cause));
} | [
"public",
"static",
"Request",
"errorReport",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"Throwable",
"cause",
")",
"{",
"return",
"runner",
"(",
"new",
"ErrorReportingRunner",
"(",
"klass",
",",
"cause",
")",
")",
";",
"}"
] | Creates a {@link Request} that, when processed, will report an error for the given
test class with the given cause. | [
"Creates",
"a",
"{"
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Request.java#L100-L102 |
auth0/auth0-java | src/main/java/com/auth0/client/mgmt/filter/ConnectionFilter.java | ConnectionFilter.withPage | public ConnectionFilter withPage(int pageNumber, int amountPerPage) {
parameters.put("page", pageNumber);
parameters.put("per_page", amountPerPage);
return this;
} | java | public ConnectionFilter withPage(int pageNumber, int amountPerPage) {
parameters.put("page", pageNumber);
parameters.put("per_page", amountPerPage);
return this;
} | [
"public",
"ConnectionFilter",
"withPage",
"(",
"int",
"pageNumber",
",",
"int",
"amountPerPage",
")",
"{",
"parameters",
".",
"put",
"(",
"\"page\"",
",",
"pageNumber",
")",
";",
"parameters",
".",
"put",
"(",
"\"per_page\"",
",",
"amountPerPage",
")",
";",
... | Filter by page
@param pageNumber the page number to retrieve.
@param amountPerPage the amount of items per page to retrieve.
@return this filter instance | [
"Filter",
"by",
"page"
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/ConnectionFilter.java#L37-L41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.