repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Stratio/stratio-cassandra | src/java/org/apache/cassandra/dht/AbstractByteOrderedPartitioner.java | AbstractByteOrderedPartitioner.bigForBytes | private BigInteger bigForBytes(byte[] bytes, int sigbytes) {
"""
Convert a byte array containing the most significant of 'sigbytes' bytes
representing a big-endian magnitude into a BigInteger.
"""
byte[] b;
if (sigbytes != bytes.length)
{
b = new byte[sigbytes];
System.arraycopy(bytes, 0, b, 0, bytes.length);
} else
b = bytes;
return new BigInteger(1, b);
} | java | private BigInteger bigForBytes(byte[] bytes, int sigbytes)
{
byte[] b;
if (sigbytes != bytes.length)
{
b = new byte[sigbytes];
System.arraycopy(bytes, 0, b, 0, bytes.length);
} else
b = bytes;
return new BigInteger(1, b);
} | [
"private",
"BigInteger",
"bigForBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"sigbytes",
")",
"{",
"byte",
"[",
"]",
"b",
";",
"if",
"(",
"sigbytes",
"!=",
"bytes",
".",
"length",
")",
"{",
"b",
"=",
"new",
"byte",
"[",
"sigbytes",
"]",
";",... | Convert a byte array containing the most significant of 'sigbytes' bytes
representing a big-endian magnitude into a BigInteger. | [
"Convert",
"a",
"byte",
"array",
"containing",
"the",
"most",
"significant",
"of",
"sigbytes",
"bytes",
"representing",
"a",
"big",
"-",
"endian",
"magnitude",
"into",
"a",
"BigInteger",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/dht/AbstractByteOrderedPartitioner.java#L65-L75 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java | CollisionFormulaConfig.exports | public static void exports(Xml root, CollisionFormula formula) {
"""
Export the current formula data to the formula node.
@param root The root node (must not be <code>null</code>).
@param formula The formula reference (must not be <code>null</code>).
@throws LionEngineException If error on writing.
"""
Check.notNull(root);
Check.notNull(formula);
final Xml node = root.createChild(NODE_FORMULA);
node.writeString(ATT_NAME, formula.getName());
CollisionRangeConfig.exports(node, formula.getRange());
CollisionFunctionConfig.exports(node, formula.getFunction());
CollisionConstraintConfig.exports(node, formula.getConstraint());
} | java | public static void exports(Xml root, CollisionFormula formula)
{
Check.notNull(root);
Check.notNull(formula);
final Xml node = root.createChild(NODE_FORMULA);
node.writeString(ATT_NAME, formula.getName());
CollisionRangeConfig.exports(node, formula.getRange());
CollisionFunctionConfig.exports(node, formula.getFunction());
CollisionConstraintConfig.exports(node, formula.getConstraint());
} | [
"public",
"static",
"void",
"exports",
"(",
"Xml",
"root",
",",
"CollisionFormula",
"formula",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"Check",
".",
"notNull",
"(",
"formula",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"creat... | Export the current formula data to the formula node.
@param root The root node (must not be <code>null</code>).
@param formula The formula reference (must not be <code>null</code>).
@throws LionEngineException If error on writing. | [
"Export",
"the",
"current",
"formula",
"data",
"to",
"the",
"formula",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java#L78-L89 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java | DeterministicHierarchy.deriveChild | public DeterministicKey deriveChild(List<ChildNumber> parentPath, boolean relative, boolean createParent, ChildNumber createChildNumber) {
"""
Extends the tree by calculating the requested child for the given path. For example, to get the key at position
1/2/3 you would pass 1/2 as the parent path and 3 as the child number.
@param parentPath the path to the parent
@param relative whether the path is relative to the root path
@param createParent whether the parent corresponding to path should be created (with any necessary ancestors) if it doesn't exist already
@return the requested key.
@throws IllegalArgumentException if the parent doesn't exist and createParent is false.
"""
return deriveChild(get(parentPath, relative, createParent), createChildNumber);
} | java | public DeterministicKey deriveChild(List<ChildNumber> parentPath, boolean relative, boolean createParent, ChildNumber createChildNumber) {
return deriveChild(get(parentPath, relative, createParent), createChildNumber);
} | [
"public",
"DeterministicKey",
"deriveChild",
"(",
"List",
"<",
"ChildNumber",
">",
"parentPath",
",",
"boolean",
"relative",
",",
"boolean",
"createParent",
",",
"ChildNumber",
"createChildNumber",
")",
"{",
"return",
"deriveChild",
"(",
"get",
"(",
"parentPath",
... | Extends the tree by calculating the requested child for the given path. For example, to get the key at position
1/2/3 you would pass 1/2 as the parent path and 3 as the child number.
@param parentPath the path to the parent
@param relative whether the path is relative to the root path
@param createParent whether the parent corresponding to path should be created (with any necessary ancestors) if it doesn't exist already
@return the requested key.
@throws IllegalArgumentException if the parent doesn't exist and createParent is false. | [
"Extends",
"the",
"tree",
"by",
"calculating",
"the",
"requested",
"child",
"for",
"the",
"given",
"path",
".",
"For",
"example",
"to",
"get",
"the",
"key",
"at",
"position",
"1",
"/",
"2",
"/",
"3",
"you",
"would",
"pass",
"1",
"/",
"2",
"as",
"the"... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java#L146-L148 |
softindex/datakernel | core-codegen/src/main/java/io/datakernel/codegen/ClassBuilder.java | ClassBuilder.withMethod | public ClassBuilder<T> withMethod(String methodName, Class<?> returnClass, List<? extends Class<?>> argumentTypes, Expression expression) {
"""
Creates a new method for a dynamic class
@param methodName name of method
@param returnClass type which returns this method
@param argumentTypes list of types of arguments
@param expression function which will be processed
@return changed AsmFunctionFactory
"""
Type[] types = new Type[argumentTypes.size()];
for (int i = 0; i < argumentTypes.size(); i++) {
types[i] = getType(argumentTypes.get(i));
}
return withMethod(new Method(methodName, getType(returnClass), types), expression);
} | java | public ClassBuilder<T> withMethod(String methodName, Class<?> returnClass, List<? extends Class<?>> argumentTypes, Expression expression) {
Type[] types = new Type[argumentTypes.size()];
for (int i = 0; i < argumentTypes.size(); i++) {
types[i] = getType(argumentTypes.get(i));
}
return withMethod(new Method(methodName, getType(returnClass), types), expression);
} | [
"public",
"ClassBuilder",
"<",
"T",
">",
"withMethod",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"returnClass",
",",
"List",
"<",
"?",
"extends",
"Class",
"<",
"?",
">",
">",
"argumentTypes",
",",
"Expression",
"expression",
")",
"{",
"Ty... | Creates a new method for a dynamic class
@param methodName name of method
@param returnClass type which returns this method
@param argumentTypes list of types of arguments
@param expression function which will be processed
@return changed AsmFunctionFactory | [
"Creates",
"a",
"new",
"method",
"for",
"a",
"dynamic",
"class"
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-codegen/src/main/java/io/datakernel/codegen/ClassBuilder.java#L200-L206 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.iterate | @NotNull
public static <T> Stream<T> iterate(
@Nullable final T seed,
@NotNull final Predicate<? super T> predicate,
@NotNull final UnaryOperator<T> op) {
"""
Creates a {@code Stream} by iterative application {@code UnaryOperator} function
to an initial element {@code seed}, conditioned on satisfying the supplied predicate.
<p>Example:
<pre>
seed: 0
predicate: (a) -> a < 20
op: (a) -> a + 5
result: [0, 5, 10, 15]
</pre>
@param <T> the type of the stream elements
@param seed the initial value
@param predicate a predicate to determine when the stream must terminate
@param op operator to produce new element by previous one
@return the new stream
@throws NullPointerException if {@code op} is null
@since 1.1.5
"""
Objects.requireNonNull(predicate);
return iterate(seed, op).takeWhile(predicate);
} | java | @NotNull
public static <T> Stream<T> iterate(
@Nullable final T seed,
@NotNull final Predicate<? super T> predicate,
@NotNull final UnaryOperator<T> op) {
Objects.requireNonNull(predicate);
return iterate(seed, op).takeWhile(predicate);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"iterate",
"(",
"@",
"Nullable",
"final",
"T",
"seed",
",",
"@",
"NotNull",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
",",
"@",
"NotNull",
"final",
"Una... | Creates a {@code Stream} by iterative application {@code UnaryOperator} function
to an initial element {@code seed}, conditioned on satisfying the supplied predicate.
<p>Example:
<pre>
seed: 0
predicate: (a) -> a < 20
op: (a) -> a + 5
result: [0, 5, 10, 15]
</pre>
@param <T> the type of the stream elements
@param seed the initial value
@param predicate a predicate to determine when the stream must terminate
@param op operator to produce new element by previous one
@return the new stream
@throws NullPointerException if {@code op} is null
@since 1.1.5 | [
"Creates",
"a",
"{",
"@code",
"Stream",
"}",
"by",
"iterative",
"application",
"{",
"@code",
"UnaryOperator",
"}",
"function",
"to",
"an",
"initial",
"element",
"{",
"@code",
"seed",
"}",
"conditioned",
"on",
"satisfying",
"the",
"supplied",
"predicate",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L286-L293 |
ACINQ/bitcoin-lib | src/main/java/fr/acinq/Secp256k1Loader.java | Secp256k1Loader.cleanup | static void cleanup() {
"""
Deleted old native libraries e.g. on Windows the DLL file is not removed
on VM-Exit (bug #80)
"""
String tempFolder = getTempDir().getAbsolutePath();
File dir = new File(tempFolder);
File[] nativeLibFiles = dir.listFiles(new FilenameFilter() {
private final String searchPattern = "secp256k1-";
public boolean accept(File dir, String name) {
return name.startsWith(searchPattern) && !name.endsWith(".lck");
}
});
if(nativeLibFiles != null) {
for(File nativeLibFile : nativeLibFiles) {
File lckFile = new File(nativeLibFile.getAbsolutePath() + ".lck");
if(!lckFile.exists()) {
try {
nativeLibFile.delete();
}
catch(SecurityException e) {
System.err.println("Failed to delete old native lib" + e.getMessage());
}
}
}
}
} | java | static void cleanup() {
String tempFolder = getTempDir().getAbsolutePath();
File dir = new File(tempFolder);
File[] nativeLibFiles = dir.listFiles(new FilenameFilter() {
private final String searchPattern = "secp256k1-";
public boolean accept(File dir, String name) {
return name.startsWith(searchPattern) && !name.endsWith(".lck");
}
});
if(nativeLibFiles != null) {
for(File nativeLibFile : nativeLibFiles) {
File lckFile = new File(nativeLibFile.getAbsolutePath() + ".lck");
if(!lckFile.exists()) {
try {
nativeLibFile.delete();
}
catch(SecurityException e) {
System.err.println("Failed to delete old native lib" + e.getMessage());
}
}
}
}
} | [
"static",
"void",
"cleanup",
"(",
")",
"{",
"String",
"tempFolder",
"=",
"getTempDir",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"File",
"dir",
"=",
"new",
"File",
"(",
"tempFolder",
")",
";",
"File",
"[",
"]",
"nativeLibFiles",
"=",
"dir",
".",... | Deleted old native libraries e.g. on Windows the DLL file is not removed
on VM-Exit (bug #80) | [
"Deleted",
"old",
"native",
"libraries",
"e",
".",
"g",
".",
"on",
"Windows",
"the",
"DLL",
"file",
"is",
"not",
"removed",
"on",
"VM",
"-",
"Exit",
"(",
"bug",
"#80",
")"
] | train | https://github.com/ACINQ/bitcoin-lib/blob/74a30b28b1001672359b19890ffa3d3951362d65/src/main/java/fr/acinq/Secp256k1Loader.java#L72-L95 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/util/TimeIntervalFormatUtil.java | TimeIntervalFormatUtil.generateDatumTime | public static long generateDatumTime(long initializeTime, TimeUnit unit) throws ParseException {
"""
指定した初期化時刻と切替単位を基に、整時用の基準時刻(long値)を取得する。
@param initializeTime 初期化時刻
@param unit 切替単位
@return 整時用の基準時刻(long値)
@throws ParseException パース失敗時
"""
// 初期に生成するファイル名称を基準となる値にするため、ファイル切替インターバル(単位)より1つ大きな単位を取得し
// 1つ大きな単位をベースに時刻を算出する。
// 例:10分間隔であれば「0.10.20....」というのが基準となる値。
SimpleDateFormat parentDateFormat = new SimpleDateFormat(
TimeUnitUtil.getDatePattern(TimeUnitUtil.getParentUnit(unit)));
// 1つ大きな単位をベースに基準時刻を取得し、初期生成ファイル名称用の日時を算出する。
// 例:10分間隔をインターバルとし、8:35を起動時刻とした場合、8:00を基準時刻とする。
String datumTimeString = parentDateFormat.format(new Date(initializeTime));
long datumTime = parentDateFormat.parse(datumTimeString).getTime();
return datumTime;
} | java | public static long generateDatumTime(long initializeTime, TimeUnit unit) throws ParseException
{
// 初期に生成するファイル名称を基準となる値にするため、ファイル切替インターバル(単位)より1つ大きな単位を取得し
// 1つ大きな単位をベースに時刻を算出する。
// 例:10分間隔であれば「0.10.20....」というのが基準となる値。
SimpleDateFormat parentDateFormat = new SimpleDateFormat(
TimeUnitUtil.getDatePattern(TimeUnitUtil.getParentUnit(unit)));
// 1つ大きな単位をベースに基準時刻を取得し、初期生成ファイル名称用の日時を算出する。
// 例:10分間隔をインターバルとし、8:35を起動時刻とした場合、8:00を基準時刻とする。
String datumTimeString = parentDateFormat.format(new Date(initializeTime));
long datumTime = parentDateFormat.parse(datumTimeString).getTime();
return datumTime;
} | [
"public",
"static",
"long",
"generateDatumTime",
"(",
"long",
"initializeTime",
",",
"TimeUnit",
"unit",
")",
"throws",
"ParseException",
"{",
"// 初期に生成するファイル名称を基準となる値にするため、ファイル切替インターバル(単位)より1つ大きな単位を取得し\r",
"// 1つ大きな単位をベースに時刻を算出する。\r",
"// 例:10分間隔であれば「0.10.20....」というのが基準となる値。\r",
"... | 指定した初期化時刻と切替単位を基に、整時用の基準時刻(long値)を取得する。
@param initializeTime 初期化時刻
@param unit 切替単位
@return 整時用の基準時刻(long値)
@throws ParseException パース失敗時 | [
"指定した初期化時刻と切替単位を基に、整時用の基準時刻",
"(",
"long値",
")",
"を取得する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/util/TimeIntervalFormatUtil.java#L104-L118 |
tweea/matrixjavalib-main-common | src/main/java/net/matrix/text/DateFormatHelper.java | DateFormatHelper.toDisplayString | public static String toDisplayString(final Calendar date, final String year, final String month, final String day) {
"""
转换日期到字符串。
@param date
日期。
@param year
年。
@param month
月。
@param day
日。
@return 目标字符串,形式为 yyyy(year)MM(month)dd(date)。
"""
return format(date, "yyyy") + year + format(date, "MM") + month + format(date, "dd") + day;
} | java | public static String toDisplayString(final Calendar date, final String year, final String month, final String day) {
return format(date, "yyyy") + year + format(date, "MM") + month + format(date, "dd") + day;
} | [
"public",
"static",
"String",
"toDisplayString",
"(",
"final",
"Calendar",
"date",
",",
"final",
"String",
"year",
",",
"final",
"String",
"month",
",",
"final",
"String",
"day",
")",
"{",
"return",
"format",
"(",
"date",
",",
"\"yyyy\"",
")",
"+",
"year",... | 转换日期到字符串。
@param date
日期。
@param year
年。
@param month
月。
@param day
日。
@return 目标字符串,形式为 yyyy(year)MM(month)dd(date)。 | [
"转换日期到字符串。"
] | train | https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/text/DateFormatHelper.java#L150-L152 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExtractJobConfiguration.java | ExtractJobConfiguration.newBuilder | public static Builder newBuilder(TableId sourceTable, List<String> destinationUris) {
"""
Creates a builder for a BigQuery Extract Job configuration given source table and destination
URIs.
"""
return new Builder().setSourceTable(sourceTable).setDestinationUris(destinationUris);
} | java | public static Builder newBuilder(TableId sourceTable, List<String> destinationUris) {
return new Builder().setSourceTable(sourceTable).setDestinationUris(destinationUris);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"TableId",
"sourceTable",
",",
"List",
"<",
"String",
">",
"destinationUris",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"setSourceTable",
"(",
"sourceTable",
")",
".",
"setDestinationUris",
"(",
"des... | Creates a builder for a BigQuery Extract Job configuration given source table and destination
URIs. | [
"Creates",
"a",
"builder",
"for",
"a",
"BigQuery",
"Extract",
"Job",
"configuration",
"given",
"source",
"table",
"and",
"destination",
"URIs",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExtractJobConfiguration.java#L250-L252 |
Berico-Technologies/CLAVIN | src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java | DamerauLevenshtein.damerauLevenshteinDistanceCaseInsensitive | public static int damerauLevenshteinDistanceCaseInsensitive(String str1, String str2) {
"""
Convenience method for calling {@link #damerauLevenshteinDistance(String str1, String str2)}
when you don't care about case sensitivity.
@param str1 First string being compared
@param str2 Second string being compared
@return Case-insensitive edit distance between strings
"""
return damerauLevenshteinDistance(str1.toLowerCase(), str2.toLowerCase());
} | java | public static int damerauLevenshteinDistanceCaseInsensitive(String str1, String str2) {
return damerauLevenshteinDistance(str1.toLowerCase(), str2.toLowerCase());
} | [
"public",
"static",
"int",
"damerauLevenshteinDistanceCaseInsensitive",
"(",
"String",
"str1",
",",
"String",
"str2",
")",
"{",
"return",
"damerauLevenshteinDistance",
"(",
"str1",
".",
"toLowerCase",
"(",
")",
",",
"str2",
".",
"toLowerCase",
"(",
")",
")",
";"... | Convenience method for calling {@link #damerauLevenshteinDistance(String str1, String str2)}
when you don't care about case sensitivity.
@param str1 First string being compared
@param str2 Second string being compared
@return Case-insensitive edit distance between strings | [
"Convenience",
"method",
"for",
"calling",
"{",
"@link",
"#damerauLevenshteinDistance",
"(",
"String",
"str1",
"String",
"str2",
")",
"}",
"when",
"you",
"don",
"t",
"care",
"about",
"case",
"sensitivity",
"."
] | train | https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java#L125-L127 |
netty/netty | buffer/src/main/java/io/netty/buffer/PoolArena.java | PoolArena.allocateNormal | private void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
"""
Method must be called inside synchronized(this) { ... } block
"""
if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) ||
q000.allocate(buf, reqCapacity, normCapacity) || qInit.allocate(buf, reqCapacity, normCapacity) ||
q075.allocate(buf, reqCapacity, normCapacity)) {
return;
}
// Add a new chunk.
PoolChunk<T> c = newChunk(pageSize, maxOrder, pageShifts, chunkSize);
boolean success = c.allocate(buf, reqCapacity, normCapacity);
assert success;
qInit.add(c);
} | java | private void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) ||
q000.allocate(buf, reqCapacity, normCapacity) || qInit.allocate(buf, reqCapacity, normCapacity) ||
q075.allocate(buf, reqCapacity, normCapacity)) {
return;
}
// Add a new chunk.
PoolChunk<T> c = newChunk(pageSize, maxOrder, pageShifts, chunkSize);
boolean success = c.allocate(buf, reqCapacity, normCapacity);
assert success;
qInit.add(c);
} | [
"private",
"void",
"allocateNormal",
"(",
"PooledByteBuf",
"<",
"T",
">",
"buf",
",",
"int",
"reqCapacity",
",",
"int",
"normCapacity",
")",
"{",
"if",
"(",
"q050",
".",
"allocate",
"(",
"buf",
",",
"reqCapacity",
",",
"normCapacity",
")",
"||",
"q025",
... | Method must be called inside synchronized(this) { ... } block | [
"Method",
"must",
"be",
"called",
"inside",
"synchronized",
"(",
"this",
")",
"{",
"...",
"}",
"block"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolArena.java#L237-L249 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java | BaseFunction.subtract | protected static DoubleVector subtract(DoubleVector c, DoubleVector v) {
"""
Returns a {@link DoubleVector} that is equal to {@code c - v}. This
method is used instead of the one in {@link VectorMath} so that a {@link
DenseDynamicMagnitudeVector} can be used to represent the difference.
This vector type is optimized for when many calls to magnitude are
interleaved with updates to a few dimensions in the vector.
"""
DoubleVector newCentroid = new DenseDynamicMagnitudeVector(c.length());
// Special case sparse double vectors so that we don't incure a possibly
// log n get operation for each zero value, as that's the common case
// for CompactSparseVector.
if (v instanceof SparseDoubleVector) {
SparseDoubleVector sv = (SparseDoubleVector) v;
int[] nonZeros = sv.getNonZeroIndices();
int sparseIndex = 0;
for (int i = 0; i < c.length(); ++i) {
double value = c.get(i);
if (sparseIndex < nonZeros.length &&
i == nonZeros[sparseIndex])
value -= sv.get(nonZeros[sparseIndex++]);
newCentroid.set(i, value);
}
} else
for (int i = 0; i < c.length(); ++i)
newCentroid.set(i, c.get(i) - v.get(i));
return newCentroid;
} | java | protected static DoubleVector subtract(DoubleVector c, DoubleVector v) {
DoubleVector newCentroid = new DenseDynamicMagnitudeVector(c.length());
// Special case sparse double vectors so that we don't incure a possibly
// log n get operation for each zero value, as that's the common case
// for CompactSparseVector.
if (v instanceof SparseDoubleVector) {
SparseDoubleVector sv = (SparseDoubleVector) v;
int[] nonZeros = sv.getNonZeroIndices();
int sparseIndex = 0;
for (int i = 0; i < c.length(); ++i) {
double value = c.get(i);
if (sparseIndex < nonZeros.length &&
i == nonZeros[sparseIndex])
value -= sv.get(nonZeros[sparseIndex++]);
newCentroid.set(i, value);
}
} else
for (int i = 0; i < c.length(); ++i)
newCentroid.set(i, c.get(i) - v.get(i));
return newCentroid;
} | [
"protected",
"static",
"DoubleVector",
"subtract",
"(",
"DoubleVector",
"c",
",",
"DoubleVector",
"v",
")",
"{",
"DoubleVector",
"newCentroid",
"=",
"new",
"DenseDynamicMagnitudeVector",
"(",
"c",
".",
"length",
"(",
")",
")",
";",
"// Special case sparse double vec... | Returns a {@link DoubleVector} that is equal to {@code c - v}. This
method is used instead of the one in {@link VectorMath} so that a {@link
DenseDynamicMagnitudeVector} can be used to represent the difference.
This vector type is optimized for when many calls to magnitude are
interleaved with updates to a few dimensions in the vector. | [
"Returns",
"a",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java#L291-L313 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/StringUtils.java | StringUtils.byteToHexString | public static String byteToHexString(final byte[] bytes, final int start, final int end) {
"""
Given an array of bytes it will convert the bytes to a hex string
representation of the bytes.
@param bytes
the bytes to convert in a hex string
@param start
start index, inclusively
@param end
end index, exclusively
@return hex string representation of the byte array
"""
if (bytes == null) {
throw new IllegalArgumentException("bytes == null");
}
int length = end - start;
char[] out = new char[length * 2];
for (int i = start, j = 0; i < end; i++) {
out[j++] = HEX_CHARS[(0xF0 & bytes[i]) >>> 4];
out[j++] = HEX_CHARS[0x0F & bytes[i]];
}
return new String(out);
} | java | public static String byteToHexString(final byte[] bytes, final int start, final int end) {
if (bytes == null) {
throw new IllegalArgumentException("bytes == null");
}
int length = end - start;
char[] out = new char[length * 2];
for (int i = start, j = 0; i < end; i++) {
out[j++] = HEX_CHARS[(0xF0 & bytes[i]) >>> 4];
out[j++] = HEX_CHARS[0x0F & bytes[i]];
}
return new String(out);
} | [
"public",
"static",
"String",
"byteToHexString",
"(",
"final",
"byte",
"[",
"]",
"bytes",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"... | Given an array of bytes it will convert the bytes to a hex string
representation of the bytes.
@param bytes
the bytes to convert in a hex string
@param start
start index, inclusively
@param end
end index, exclusively
@return hex string representation of the byte array | [
"Given",
"an",
"array",
"of",
"bytes",
"it",
"will",
"convert",
"the",
"bytes",
"to",
"a",
"hex",
"string",
"representation",
"of",
"the",
"bytes",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L58-L72 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java | CmsSitemapToolbar.setNewEnabled | public void setNewEnabled(boolean enabled, String disabledReason) {
"""
Enables/disables the new menu button.<p>
@param enabled <code>true</code> to enable the button
@param disabledReason the reason, why the button is disabled
"""
if (enabled) {
m_newMenuButton.enable();
} else {
m_newMenuButton.disable(disabledReason);
}
} | java | public void setNewEnabled(boolean enabled, String disabledReason) {
if (enabled) {
m_newMenuButton.enable();
} else {
m_newMenuButton.disable(disabledReason);
}
} | [
"public",
"void",
"setNewEnabled",
"(",
"boolean",
"enabled",
",",
"String",
"disabledReason",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"m_newMenuButton",
".",
"enable",
"(",
")",
";",
"}",
"else",
"{",
"m_newMenuButton",
".",
"disable",
"(",
"disabledReaso... | Enables/disables the new menu button.<p>
@param enabled <code>true</code> to enable the button
@param disabledReason the reason, why the button is disabled | [
"Enables",
"/",
"disables",
"the",
"new",
"menu",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java#L243-L250 |
mapsforge/mapsforge | mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java | AbstractPoiPersistenceManager.stringToTags | protected static Set<Tag> stringToTags(String data) {
"""
Convert tags string representation with '\r' delimiter to collection.
"""
Set<Tag> tags = new HashSet<>();
String[] split = data.split("\r");
for (String s : split) {
if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) {
String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR));
if (keyValue.length == 2) {
tags.add(new Tag(keyValue[0], keyValue[1]));
}
}
}
return tags;
} | java | protected static Set<Tag> stringToTags(String data) {
Set<Tag> tags = new HashSet<>();
String[] split = data.split("\r");
for (String s : split) {
if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) {
String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR));
if (keyValue.length == 2) {
tags.add(new Tag(keyValue[0], keyValue[1]));
}
}
}
return tags;
} | [
"protected",
"static",
"Set",
"<",
"Tag",
">",
"stringToTags",
"(",
"String",
"data",
")",
"{",
"Set",
"<",
"Tag",
">",
"tags",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"split",
"=",
"data",
".",
"split",
"(",
"\"\\r\"",
")",... | Convert tags string representation with '\r' delimiter to collection. | [
"Convert",
"tags",
"string",
"representation",
"with",
"\\",
"r",
"delimiter",
"to",
"collection",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java#L124-L136 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/spelling/suggestions/SuggestionsOrdererFeatureExtractor.java | SuggestionsOrdererFeatureExtractor.computeFeatures | public Pair<List<SuggestedReplacement>, SortedMap<String, Float>> computeFeatures(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos) {
"""
compute features for training or prediction of a ranking model for suggestions
@param suggestions
@param word
@param sentence
@param startPos
@return correction candidates, features for the match in general, features specific to candidates
"""
if (suggestions.isEmpty()) {
return Pair.of(Collections.emptyList(), Collections.emptySortedMap());
}
if (topN <= 0) {
topN = suggestions.size();
}
List<String> topSuggestions = suggestions.subList(0, Math.min(suggestions.size(), topN));
//EditDistance<Integer> levenshteinDistance = new LevenshteinDistance(4);
EditDistance levenstheinDistance = new EditDistance(word, EditDistance.DistanceAlgorithm.Damerau);
SimilarityScore<Double> jaroWrinklerDistance = new JaroWinklerDistance();
List<Feature> features = new ArrayList<>(topSuggestions.size());
for (String candidate : topSuggestions) {
double prob1 = languageModel.getPseudoProbability(Collections.singletonList(candidate)).getProb();
double prob3 = LanguageModelUtils.get3gramProbabilityFor(language, languageModel, startPos, sentence, candidate);
//double prob4 = LanguageModelUtils.get4gramProbabilityFor(language, languageModel, startPos, sentence, candidate);
long wordCount = ((BaseLanguageModel) languageModel).getCount(candidate);
int levenstheinDist = levenstheinDistance.compare(candidate, 3);
double jaroWrinklerDist = jaroWrinklerDistance.apply(word, candidate);
DetailedDamerauLevenstheinDistance.Distance detailedDistance = DetailedDamerauLevenstheinDistance.compare(word, candidate);
features.add(new Feature(prob1, prob3, wordCount, levenstheinDist, detailedDistance, jaroWrinklerDist, candidate));
}
if (!"noop".equals(score)) {
features.sort(Feature::compareTo);
}
//logger.trace("Features for '%s' in '%s': %n", word, sentence.getText());
//features.stream().map(Feature::toString).forEach(logger::trace);
List<String> words = features.stream().map(Feature::getWord).collect(Collectors.toList());
// compute general features, not tied to candidates
SortedMap<String, Float> matchData = new TreeMap<>();
matchData.put("candidateCount", (float) words.size());
List<SuggestedReplacement> suggestionsData = features.stream().map(f -> {
SuggestedReplacement s = new SuggestedReplacement(f.getWord());
s.setFeatures(f.getData());
return s;
}).collect(Collectors.toList());
return Pair.of(suggestionsData, matchData);
} | java | public Pair<List<SuggestedReplacement>, SortedMap<String, Float>> computeFeatures(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos) {
if (suggestions.isEmpty()) {
return Pair.of(Collections.emptyList(), Collections.emptySortedMap());
}
if (topN <= 0) {
topN = suggestions.size();
}
List<String> topSuggestions = suggestions.subList(0, Math.min(suggestions.size(), topN));
//EditDistance<Integer> levenshteinDistance = new LevenshteinDistance(4);
EditDistance levenstheinDistance = new EditDistance(word, EditDistance.DistanceAlgorithm.Damerau);
SimilarityScore<Double> jaroWrinklerDistance = new JaroWinklerDistance();
List<Feature> features = new ArrayList<>(topSuggestions.size());
for (String candidate : topSuggestions) {
double prob1 = languageModel.getPseudoProbability(Collections.singletonList(candidate)).getProb();
double prob3 = LanguageModelUtils.get3gramProbabilityFor(language, languageModel, startPos, sentence, candidate);
//double prob4 = LanguageModelUtils.get4gramProbabilityFor(language, languageModel, startPos, sentence, candidate);
long wordCount = ((BaseLanguageModel) languageModel).getCount(candidate);
int levenstheinDist = levenstheinDistance.compare(candidate, 3);
double jaroWrinklerDist = jaroWrinklerDistance.apply(word, candidate);
DetailedDamerauLevenstheinDistance.Distance detailedDistance = DetailedDamerauLevenstheinDistance.compare(word, candidate);
features.add(new Feature(prob1, prob3, wordCount, levenstheinDist, detailedDistance, jaroWrinklerDist, candidate));
}
if (!"noop".equals(score)) {
features.sort(Feature::compareTo);
}
//logger.trace("Features for '%s' in '%s': %n", word, sentence.getText());
//features.stream().map(Feature::toString).forEach(logger::trace);
List<String> words = features.stream().map(Feature::getWord).collect(Collectors.toList());
// compute general features, not tied to candidates
SortedMap<String, Float> matchData = new TreeMap<>();
matchData.put("candidateCount", (float) words.size());
List<SuggestedReplacement> suggestionsData = features.stream().map(f -> {
SuggestedReplacement s = new SuggestedReplacement(f.getWord());
s.setFeatures(f.getData());
return s;
}).collect(Collectors.toList());
return Pair.of(suggestionsData, matchData);
} | [
"public",
"Pair",
"<",
"List",
"<",
"SuggestedReplacement",
">",
",",
"SortedMap",
"<",
"String",
",",
"Float",
">",
">",
"computeFeatures",
"(",
"List",
"<",
"String",
">",
"suggestions",
",",
"String",
"word",
",",
"AnalyzedSentence",
"sentence",
",",
"int... | compute features for training or prediction of a ranking model for suggestions
@param suggestions
@param word
@param sentence
@param startPos
@return correction candidates, features for the match in general, features specific to candidates | [
"compute",
"features",
"for",
"training",
"or",
"prediction",
"of",
"a",
"ranking",
"model",
"for",
"suggestions"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/suggestions/SuggestionsOrdererFeatureExtractor.java#L92-L133 |
moleculer-java/moleculer-java | src/main/java/services/moleculer/cacher/Cacher.java | Cacher.getCacheKey | public String getCacheKey(String name, Tree params, String... keys) {
"""
Creates a cacher-specific key by name and params. Concatenates the name
and params.
@param name
qualified name of the action
@param params
input (key) structure (~JSON)
@param keys
optional array of keys (eg. "id")
@return generated cache key
"""
if (params == null) {
return name;
}
StringBuilder key = new StringBuilder(128);
key.append(name);
key.append(':');
serializeKey(key, params, keys);
return key.toString();
} | java | public String getCacheKey(String name, Tree params, String... keys) {
if (params == null) {
return name;
}
StringBuilder key = new StringBuilder(128);
key.append(name);
key.append(':');
serializeKey(key, params, keys);
return key.toString();
} | [
"public",
"String",
"getCacheKey",
"(",
"String",
"name",
",",
"Tree",
"params",
",",
"String",
"...",
"keys",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"return",
"name",
";",
"}",
"StringBuilder",
"key",
"=",
"new",
"StringBuilder",
"(",
... | Creates a cacher-specific key by name and params. Concatenates the name
and params.
@param name
qualified name of the action
@param params
input (key) structure (~JSON)
@param keys
optional array of keys (eg. "id")
@return generated cache key | [
"Creates",
"a",
"cacher",
"-",
"specific",
"key",
"by",
"name",
"and",
"params",
".",
"Concatenates",
"the",
"name",
"and",
"params",
"."
] | train | https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/cacher/Cacher.java#L123-L132 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitTypeSpecifier | public T visitTypeSpecifier(TypeSpecifier elm, C context) {
"""
Visit a TypeSpecifier. This method will be called for every
node in the tree that is a descendant of the TypeSpecifier type.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result
"""
if (elm instanceof NamedTypeSpecifier) return visitNamedTypeSpecifier((NamedTypeSpecifier)elm, context);
else if (elm instanceof IntervalTypeSpecifier) return visitIntervalTypeSpecifier((IntervalTypeSpecifier)elm, context);
else if (elm instanceof ListTypeSpecifier) return visitListTypeSpecifier((ListTypeSpecifier)elm, context);
else if (elm instanceof TupleTypeSpecifier) return visitTupleTypeSpecifier((TupleTypeSpecifier)elm, context);
else return null;
} | java | public T visitTypeSpecifier(TypeSpecifier elm, C context) {
if (elm instanceof NamedTypeSpecifier) return visitNamedTypeSpecifier((NamedTypeSpecifier)elm, context);
else if (elm instanceof IntervalTypeSpecifier) return visitIntervalTypeSpecifier((IntervalTypeSpecifier)elm, context);
else if (elm instanceof ListTypeSpecifier) return visitListTypeSpecifier((ListTypeSpecifier)elm, context);
else if (elm instanceof TupleTypeSpecifier) return visitTupleTypeSpecifier((TupleTypeSpecifier)elm, context);
else return null;
} | [
"public",
"T",
"visitTypeSpecifier",
"(",
"TypeSpecifier",
"elm",
",",
"C",
"context",
")",
"{",
"if",
"(",
"elm",
"instanceof",
"NamedTypeSpecifier",
")",
"return",
"visitNamedTypeSpecifier",
"(",
"(",
"NamedTypeSpecifier",
")",
"elm",
",",
"context",
")",
";",... | Visit a TypeSpecifier. This method will be called for every
node in the tree that is a descendant of the TypeSpecifier type.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"TypeSpecifier",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"descendant",
"of",
"the",
"TypeSpecifier",
"type",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L43-L49 |
graknlabs/grakn | server/src/graql/exception/GraqlQueryException.java | GraqlQueryException.insertUnexpectedProperty | public static GraqlQueryException insertUnexpectedProperty(String property, Object value, Concept concept) {
"""
Thrown when a property is inserted on a concept that doesn't support that property.
<p>
For example, an entity with a value: {@code insert $x isa movie, val "The Godfather";}
</p>
"""
return create("unexpected property `%s %s` for concept `%s`", property, value, concept);
} | java | public static GraqlQueryException insertUnexpectedProperty(String property, Object value, Concept concept) {
return create("unexpected property `%s %s` for concept `%s`", property, value, concept);
} | [
"public",
"static",
"GraqlQueryException",
"insertUnexpectedProperty",
"(",
"String",
"property",
",",
"Object",
"value",
",",
"Concept",
"concept",
")",
"{",
"return",
"create",
"(",
"\"unexpected property `%s %s` for concept `%s`\"",
",",
"property",
",",
"value",
","... | Thrown when a property is inserted on a concept that doesn't support that property.
<p>
For example, an entity with a value: {@code insert $x isa movie, val "The Godfather";}
</p> | [
"Thrown",
"when",
"a",
"property",
"is",
"inserted",
"on",
"a",
"concept",
"that",
"doesn",
"t",
"support",
"that",
"property",
".",
"<p",
">",
"For",
"example",
"an",
"entity",
"with",
"a",
"value",
":",
"{"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/exception/GraqlQueryException.java#L167-L169 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.getTableColumn | public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) {
"""
return NULL of col is out of bound.
@param col the col
@param visibleIndex the visible index
@return the table column
"""
int actualIndex;
if (visibleIndex) {
actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col);
} else {
actualIndex = col;
}
return this.tableColumns.get(actualIndex);
} | java | public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) {
int actualIndex;
if (visibleIndex) {
actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col);
} else {
actualIndex = col;
}
return this.tableColumns.get(actualIndex);
} | [
"public",
"JKTableColumn",
"getTableColumn",
"(",
"final",
"int",
"col",
",",
"final",
"boolean",
"visibleIndex",
")",
"{",
"int",
"actualIndex",
";",
"if",
"(",
"visibleIndex",
")",
"{",
"actualIndex",
"=",
"this",
".",
"visibilityManager",
".",
"getActualIndex... | return NULL of col is out of bound.
@param col the col
@param visibleIndex the visible index
@return the table column | [
"return",
"NULL",
"of",
"col",
"is",
"out",
"of",
"bound",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L574-L582 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.binaryOperator | public static <T> BinaryOperator<T> binaryOperator(CheckedBinaryOperator<T> operator, Consumer<Throwable> handler) {
"""
Wrap a {@link CheckedBinaryOperator} in a {@link BinaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
Stream.of("a", "b", "c").reduce(Unchecked.binaryOperator(
(s1, s2) -> {
if (s2.length() > 10)
throw new Exception("Only short strings allowed");
return s1 + s2;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code>
"""
return (t1, t2) -> {
try {
return operator.apply(t1, t2);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static <T> BinaryOperator<T> binaryOperator(CheckedBinaryOperator<T> operator, Consumer<Throwable> handler) {
return (t1, t2) -> {
try {
return operator.apply(t1, t2);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"BinaryOperator",
"<",
"T",
">",
"binaryOperator",
"(",
"CheckedBinaryOperator",
"<",
"T",
">",
"operator",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
"t1",
",",
"t2",
")",
"->",
"{",
... | Wrap a {@link CheckedBinaryOperator} in a {@link BinaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
Stream.of("a", "b", "c").reduce(Unchecked.binaryOperator(
(s1, s2) -> {
if (s2.length() > 10)
throw new Exception("Only short strings allowed");
return s1 + s2;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedBinaryOperator",
"}",
"in",
"a",
"{",
"@link",
"BinaryOperator",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"Stream",
".",
"of",
"("... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L499-L510 |
bazaarvoice/emodb | event/src/main/java/com/bazaarvoice/emodb/sortedq/core/PersistentSortedQueue.java | PersistentSortedQueue.moveRecords | private void moveRecords(Segment seg, ByteBuffer max, boolean deleteFromSource) {
"""
Move/copy segment records from a segment that isn't in segmentMap to the segments that are.
"""
checkWritesAllowed();
ByteBuffer from = seg.getMin();
ByteBuffer toExclusive = successor(max);
int batchSize = scanBatchSize();
Iterator<List<ByteBuffer>> batchIter = Iterators.partition(
_dao.scanRecords(seg.getDataId(), from, toExclusive, batchSize, Integer.MAX_VALUE),
batchSize);
while (batchIter.hasNext()) {
List<ByteBuffer> records = batchIter.next();
// Write to the destination. Go through addAll() to update stats, do splitting, etc.
addAll(records);
// Delete individual records from the source.
if (deleteFromSource) {
_dao.prepareUpdate(_name).deleteRecords(seg.getDataId(), records).execute();
}
}
seg.setMin(toExclusive);
} | java | private void moveRecords(Segment seg, ByteBuffer max, boolean deleteFromSource) {
checkWritesAllowed();
ByteBuffer from = seg.getMin();
ByteBuffer toExclusive = successor(max);
int batchSize = scanBatchSize();
Iterator<List<ByteBuffer>> batchIter = Iterators.partition(
_dao.scanRecords(seg.getDataId(), from, toExclusive, batchSize, Integer.MAX_VALUE),
batchSize);
while (batchIter.hasNext()) {
List<ByteBuffer> records = batchIter.next();
// Write to the destination. Go through addAll() to update stats, do splitting, etc.
addAll(records);
// Delete individual records from the source.
if (deleteFromSource) {
_dao.prepareUpdate(_name).deleteRecords(seg.getDataId(), records).execute();
}
}
seg.setMin(toExclusive);
} | [
"private",
"void",
"moveRecords",
"(",
"Segment",
"seg",
",",
"ByteBuffer",
"max",
",",
"boolean",
"deleteFromSource",
")",
"{",
"checkWritesAllowed",
"(",
")",
";",
"ByteBuffer",
"from",
"=",
"seg",
".",
"getMin",
"(",
")",
";",
"ByteBuffer",
"toExclusive",
... | Move/copy segment records from a segment that isn't in segmentMap to the segments that are. | [
"Move",
"/",
"copy",
"segment",
"records",
"from",
"a",
"segment",
"that",
"isn",
"t",
"in",
"segmentMap",
"to",
"the",
"segments",
"that",
"are",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/sortedq/core/PersistentSortedQueue.java#L588-L610 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java | DFAs.acceptsEmptyLanguage | public static <S> boolean acceptsEmptyLanguage(DFA<S, ?> dfa) {
"""
Computes whether the given {@link DFA} accepts the empty language.
Assumes all states in the given {@link DFA} are reachable from the initial state.
@param dfa the {@link DFA} to check.
@param <S> the state type.
@return whether the given {@link DFA} accepts the empty language.
"""
return dfa.getStates().stream().noneMatch(dfa::isAccepting);
} | java | public static <S> boolean acceptsEmptyLanguage(DFA<S, ?> dfa) {
return dfa.getStates().stream().noneMatch(dfa::isAccepting);
} | [
"public",
"static",
"<",
"S",
">",
"boolean",
"acceptsEmptyLanguage",
"(",
"DFA",
"<",
"S",
",",
"?",
">",
"dfa",
")",
"{",
"return",
"dfa",
".",
"getStates",
"(",
")",
".",
"stream",
"(",
")",
".",
"noneMatch",
"(",
"dfa",
"::",
"isAccepting",
")",
... | Computes whether the given {@link DFA} accepts the empty language.
Assumes all states in the given {@link DFA} are reachable from the initial state.
@param dfa the {@link DFA} to check.
@param <S> the state type.
@return whether the given {@link DFA} accepts the empty language. | [
"Computes",
"whether",
"the",
"given",
"{",
"@link",
"DFA",
"}",
"accepts",
"the",
"empty",
"language",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java#L401-L403 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotationUtil.java | AnnotationUtil.findDeclared | static <T extends Annotation> List<T> findDeclared(
AnnotatedElement element, Class<T> annotationType) {
"""
Returns all annotations of the {@code annotationType} which are found from the specified
{@code element}.
<p>Note that this method will <em>not</em> find annotations from both the super classes
of the {@code element} and the meta-annotations.
@param element the {@link AnnotatedElement} to find annotations
@param annotationType the type of the annotation to find
"""
return find(element, annotationType, EnumSet.noneOf(FindOption.class));
} | java | static <T extends Annotation> List<T> findDeclared(
AnnotatedElement element, Class<T> annotationType) {
return find(element, annotationType, EnumSet.noneOf(FindOption.class));
} | [
"static",
"<",
"T",
"extends",
"Annotation",
">",
"List",
"<",
"T",
">",
"findDeclared",
"(",
"AnnotatedElement",
"element",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"return",
"find",
"(",
"element",
",",
"annotationType",
",",
"EnumSet",
"... | Returns all annotations of the {@code annotationType} which are found from the specified
{@code element}.
<p>Note that this method will <em>not</em> find annotations from both the super classes
of the {@code element} and the meta-annotations.
@param element the {@link AnnotatedElement} to find annotations
@param annotationType the type of the annotation to find | [
"Returns",
"all",
"annotations",
"of",
"the",
"{",
"@code",
"annotationType",
"}",
"which",
"are",
"found",
"from",
"the",
"specified",
"{",
"@code",
"element",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotationUtil.java#L170-L173 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Searcher.java | Searcher.getNumberOfUniqueViews | public <T extends View> int getNumberOfUniqueViews(Set<T>uniqueViews, ArrayList<T> views) {
"""
Returns the number of unique views.
@param uniqueViews the set of unique views
@param views the list of all views
@return number of unique views
"""
for(int i = 0; i < views.size(); i++){
uniqueViews.add(views.get(i));
}
numberOfUniqueViews = uniqueViews.size();
return numberOfUniqueViews;
} | java | public <T extends View> int getNumberOfUniqueViews(Set<T>uniqueViews, ArrayList<T> views){
for(int i = 0; i < views.size(); i++){
uniqueViews.add(views.get(i));
}
numberOfUniqueViews = uniqueViews.size();
return numberOfUniqueViews;
} | [
"public",
"<",
"T",
"extends",
"View",
">",
"int",
"getNumberOfUniqueViews",
"(",
"Set",
"<",
"T",
">",
"uniqueViews",
",",
"ArrayList",
"<",
"T",
">",
"views",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"views",
".",
"size",
"(",
... | Returns the number of unique views.
@param uniqueViews the set of unique views
@param views the list of all views
@return number of unique views | [
"Returns",
"the",
"number",
"of",
"unique",
"views",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L306-L312 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/DocumentLoader.java | DocumentLoader.main | public static void main(String[] args) throws Exception {
"""
Converts a zip file into a serialized compress resource.
@param args The ZIP file
@throws Exception if an error occurs
"""
String input = args[0];
File outputFile = new File(input.replace(".zip", "") + ".serialized.xz");
// Get the base name
FileOutputStream fos = new FileOutputStream(outputFile);
LZMA2Options options = new LZMA2Options(9);
XZOutputStream xzo = new XZOutputStream(fos, options);
ObjectOutputStream oos = new ObjectOutputStream(xzo);
BundleSerializer ml = new BundleSerializer();
ml.loadDocuments(input);
oos.writeObject(ml.toStore);
oos.flush();
oos.close();
} | java | public static void main(String[] args) throws Exception {
String input = args[0];
File outputFile = new File(input.replace(".zip", "") + ".serialized.xz");
// Get the base name
FileOutputStream fos = new FileOutputStream(outputFile);
LZMA2Options options = new LZMA2Options(9);
XZOutputStream xzo = new XZOutputStream(fos, options);
ObjectOutputStream oos = new ObjectOutputStream(xzo);
BundleSerializer ml = new BundleSerializer();
ml.loadDocuments(input);
oos.writeObject(ml.toStore);
oos.flush();
oos.close();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"String",
"input",
"=",
"args",
"[",
"0",
"]",
";",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"input",
".",
"replace",
"(",
"\".zip\"",
",",
"\... | Converts a zip file into a serialized compress resource.
@param args The ZIP file
@throws Exception if an error occurs | [
"Converts",
"a",
"zip",
"file",
"into",
"a",
"serialized",
"compress",
"resource",
"."
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/DocumentLoader.java#L186-L202 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java | Drawable.loadSpriteFont | public static SpriteFont loadSpriteFont(Media media, Media data, int letterWidth, int letterHeight) {
"""
Load a font based on an image.
<p>
Once created, sprite must call {@link SpriteFont#load()} before any other operations.
</p>
@param media The font sprite media (must not be <code>null</code>).
@param data The font data media (must not be <code>null</code>).
@param letterWidth The font image letter width (must be strictly positive).
@param letterHeight The font image letter height (must be strictly positive).
@return The created font sprite.
@throws LionEngineException If an error occurred when creating the font.
"""
return new SpriteFontImpl(getMediaDpi(media), data, letterWidth, letterHeight);
} | java | public static SpriteFont loadSpriteFont(Media media, Media data, int letterWidth, int letterHeight)
{
return new SpriteFontImpl(getMediaDpi(media), data, letterWidth, letterHeight);
} | [
"public",
"static",
"SpriteFont",
"loadSpriteFont",
"(",
"Media",
"media",
",",
"Media",
"data",
",",
"int",
"letterWidth",
",",
"int",
"letterHeight",
")",
"{",
"return",
"new",
"SpriteFontImpl",
"(",
"getMediaDpi",
"(",
"media",
")",
",",
"data",
",",
"let... | Load a font based on an image.
<p>
Once created, sprite must call {@link SpriteFont#load()} before any other operations.
</p>
@param media The font sprite media (must not be <code>null</code>).
@param data The font data media (must not be <code>null</code>).
@param letterWidth The font image letter width (must be strictly positive).
@param letterHeight The font image letter height (must be strictly positive).
@return The created font sprite.
@throws LionEngineException If an error occurred when creating the font. | [
"Load",
"a",
"font",
"based",
"on",
"an",
"image",
".",
"<p",
">",
"Once",
"created",
"sprite",
"must",
"call",
"{",
"@link",
"SpriteFont#load",
"()",
"}",
"before",
"any",
"other",
"operations",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L268-L271 |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileIncrementalWriter.java | MatFileIncrementalWriter.writeDimensions | private void writeDimensions(DataOutputStream os, MLArray array) throws IOException {
"""
Writes MATRIX dimensions into <code>OutputStream</code>.
@param os - <code>OutputStream</code>
@param array - a <code>MLArray</code>
@throws IOException
"""
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream bufferDOS = new DataOutputStream(buffer);
int[] dims = array.getDimensions();
for ( int i = 0; i < dims.length; i++ )
{
bufferDOS.writeInt(dims[i]);
}
OSArrayTag tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() );
tag.writeTo( os );
} | java | private void writeDimensions(DataOutputStream os, MLArray array) throws IOException
{
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream bufferDOS = new DataOutputStream(buffer);
int[] dims = array.getDimensions();
for ( int i = 0; i < dims.length; i++ )
{
bufferDOS.writeInt(dims[i]);
}
OSArrayTag tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() );
tag.writeTo( os );
} | [
"private",
"void",
"writeDimensions",
"(",
"DataOutputStream",
"os",
",",
"MLArray",
"array",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"DataOutputStream",
"bufferDOS",
"=",
"new",
"Data... | Writes MATRIX dimensions into <code>OutputStream</code>.
@param os - <code>OutputStream</code>
@param array - a <code>MLArray</code>
@throws IOException | [
"Writes",
"MATRIX",
"dimensions",
"into",
"<code",
">",
"OutputStream<",
"/",
"code",
">",
"."
] | train | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileIncrementalWriter.java#L477-L490 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Jenkins.java | Jenkins.createProject | public synchronized <T extends TopLevelItem> T createProject( Class<T> type, String name ) throws IOException {
"""
Creates a new job.
<p>
This version infers the descriptor from the type of the top-level item.
@throws IllegalArgumentException
if the project of the given name already exists.
"""
return type.cast(createProject((TopLevelItemDescriptor)getDescriptor(type),name));
} | java | public synchronized <T extends TopLevelItem> T createProject( Class<T> type, String name ) throws IOException {
return type.cast(createProject((TopLevelItemDescriptor)getDescriptor(type),name));
} | [
"public",
"synchronized",
"<",
"T",
"extends",
"TopLevelItem",
">",
"T",
"createProject",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"return",
"type",
".",
"cast",
"(",
"createProject",
"(",
"(",
"TopLeve... | Creates a new job.
<p>
This version infers the descriptor from the type of the top-level item.
@throws IllegalArgumentException
if the project of the given name already exists. | [
"Creates",
"a",
"new",
"job",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L2928-L2930 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.mediaSwicthToMonitor | public ApiSuccessResponse mediaSwicthToMonitor(String mediatype, String id, MediaSwicthToCoachData2 mediaSwicthToCoachData) throws ApiException {
"""
Switch to monitor
Switch to the monitor mode for the specified chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat.
@param mediatype The media channel. (required)
@param id The ID of the chat interaction. (required)
@param mediaSwicthToCoachData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = mediaSwicthToMonitorWithHttpInfo(mediatype, id, mediaSwicthToCoachData);
return resp.getData();
} | java | public ApiSuccessResponse mediaSwicthToMonitor(String mediatype, String id, MediaSwicthToCoachData2 mediaSwicthToCoachData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = mediaSwicthToMonitorWithHttpInfo(mediatype, id, mediaSwicthToCoachData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"mediaSwicthToMonitor",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"MediaSwicthToCoachData2",
"mediaSwicthToCoachData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"mediaSwicthT... | Switch to monitor
Switch to the monitor mode for the specified chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat.
@param mediatype The media channel. (required)
@param id The ID of the chat interaction. (required)
@param mediaSwicthToCoachData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Switch",
"to",
"monitor",
"Switch",
"to",
"the",
"monitor",
"mode",
"for",
"the",
"specified",
"chat",
".",
"The",
"supervisor",
"can'",
";",
"t",
"send",
"messages",
"in",
"this",
"mode",
"and",
"only",
"another",
"supervisor",
"can",
"see",
"that",
"... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L2722-L2725 |
tobykurien/Xtendroid | Xtendroid/src/asia/sonix/android/orm/AbatisService.java | AbatisService.executeForBean | @SuppressWarnings( {
"""
指定したSQLIDにparameterをmappingして、クエリする。結果beanで返却。
<p>
mappingの時、parameterが足りない場合はnullを返す。 また、結果がない場合nullを返す。
</p>
@param sqlId
SQLID
@param bindParams
sql parameter
@param bean
bean class of result
@return List<Map<String, Object>> result
""" "rawtypes" })
public <T> T executeForBean(int sqlId, Map<String, ? extends Object> bindParams, Class bean) {
String sql = context.getResources().getString(sqlId);
return executeForBean(sql, bindParams, bean);
} | java | @SuppressWarnings({ "rawtypes" })
public <T> T executeForBean(int sqlId, Map<String, ? extends Object> bindParams, Class bean) {
String sql = context.getResources().getString(sqlId);
return executeForBean(sql, bindParams, bean);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
"}",
")",
"public",
"<",
"T",
">",
"T",
"executeForBean",
"(",
"int",
"sqlId",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"bindParams",
",",
"Class",
"bean",
")",
"{",
"String",
"sq... | 指定したSQLIDにparameterをmappingして、クエリする。結果beanで返却。
<p>
mappingの時、parameterが足りない場合はnullを返す。 また、結果がない場合nullを返す。
</p>
@param sqlId
SQLID
@param bindParams
sql parameter
@param bean
bean class of result
@return List<Map<String, Object>> result | [
"指定したSQLIDにparameterをmappingして、クエリする。結果beanで返却。"
] | train | https://github.com/tobykurien/Xtendroid/blob/758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4/Xtendroid/src/asia/sonix/android/orm/AbatisService.java#L305-L309 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getSpecializationInfo | public void getSpecializationInfo(int[] ids, Callback<List<Specialization>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on specializations API go <a href="https://wiki.guildwars2.com/wiki/API:2/specializations">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of specialization id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Specialization specialization info
"""
isParamValid(new ParamChecker(ids));
gw2API.getSpecializationInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getSpecializationInfo(int[] ids, Callback<List<Specialization>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getSpecializationInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getSpecializationInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Specialization",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
... | For more info on specializations API go <a href="https://wiki.guildwars2.com/wiki/API:2/specializations">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of specialization id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Specialization specialization info | [
"For",
"more",
"info",
"on",
"specializations",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"specializations",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Giv... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2408-L2411 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/Img.java | Img.cut | public Img cut(int x, int y, int radius) {
"""
图像切割为圆形(按指定起点坐标和半径切割)
@param x 原图的x坐标起始位置
@param y 原图的y坐标起始位置
@param radius 半径,小于0表示填充满整个图片(直径取长宽最小值)
@return this
@since 4.1.15
"""
final BufferedImage srcImage = getValidSrcImg();
final int width = srcImage.getWidth();
final int height = srcImage.getHeight();
// 计算直径
final int diameter = radius > 0 ? radius * 2 : Math.min(width, height);
final BufferedImage targetImage = new BufferedImage(diameter, diameter, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = targetImage.createGraphics();
g.setClip(new Ellipse2D.Double(0, 0, diameter, diameter));
if (this.positionBaseCentre) {
x = x - width / 2 + diameter / 2;
y = y - height / 2 + diameter / 2;
}
g.drawImage(srcImage, x, y, null);
g.dispose();
this.targetImage = targetImage;
return this;
} | java | public Img cut(int x, int y, int radius) {
final BufferedImage srcImage = getValidSrcImg();
final int width = srcImage.getWidth();
final int height = srcImage.getHeight();
// 计算直径
final int diameter = radius > 0 ? radius * 2 : Math.min(width, height);
final BufferedImage targetImage = new BufferedImage(diameter, diameter, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = targetImage.createGraphics();
g.setClip(new Ellipse2D.Double(0, 0, diameter, diameter));
if (this.positionBaseCentre) {
x = x - width / 2 + diameter / 2;
y = y - height / 2 + diameter / 2;
}
g.drawImage(srcImage, x, y, null);
g.dispose();
this.targetImage = targetImage;
return this;
} | [
"public",
"Img",
"cut",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"radius",
")",
"{",
"final",
"BufferedImage",
"srcImage",
"=",
"getValidSrcImg",
"(",
")",
";",
"final",
"int",
"width",
"=",
"srcImage",
".",
"getWidth",
"(",
")",
";",
"final",
"... | 图像切割为圆形(按指定起点坐标和半径切割)
@param x 原图的x坐标起始位置
@param y 原图的y坐标起始位置
@param radius 半径,小于0表示填充满整个图片(直径取长宽最小值)
@return this
@since 4.1.15 | [
"图像切割为圆形",
"(",
"按指定起点坐标和半径切割",
")"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L316-L335 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT | public void billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingScreenListsConditions body) throws IOException {
"""
Alter this object properties
REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required]
"""
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingScreenListsConditions body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"conditionId",
",",
"OvhEasyHuntingScreenListsConditions",
"body",
")",
"throws",
"IOException",
... | Alter this object properties
REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3269-L3273 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedTextWithServiceResponseAsync | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) {
"""
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param url Publicly reachable URL of an image
@param recognizePrintedTextOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (url == null) {
throw new IllegalArgumentException("Parameter url is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextOptionalParameter != null ? recognizePrintedTextOptionalParameter.language() : null;
return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language);
} | java | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (url == null) {
throw new IllegalArgumentException("Parameter url is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextOptionalParameter != null ? recognizePrintedTextOptionalParameter.language() : null;
return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OcrResult",
">",
">",
"recognizePrintedTextWithServiceResponseAsync",
"(",
"boolean",
"detectOrientation",
",",
"String",
"url",
",",
"RecognizePrintedTextOptionalParameter",
"recognizePrintedTextOptionalParameter",
")",
"{"... | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param url Publicly reachable URL of an image
@param recognizePrintedTextOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1945-L1955 |
kiegroup/drools | kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNResourceDependenciesSorter.java | DMNResourceDependenciesSorter.dfVisit | private static void dfVisit(DMNResource node, List<DMNResource> allNodes, Collection<DMNResource> visited, List<DMNResource> dfv) {
"""
Performs a depth first visit, but keeping a separate reference of visited/visiting nodes, _also_ to avoid potential issues of circularities.
"""
if (visited.contains(node)) {
throw new RuntimeException("Circular dependency detected: " + visited + " , and again to: " + node);
}
visited.add(node);
List<DMNResource> neighbours = node.getDependencies().stream()
.flatMap(dep -> allNodes.stream().filter(r -> r.getModelID().equals(dep)))
.collect(Collectors.toList());
for (DMNResource n : neighbours) {
if (!visited.contains(n)) {
dfVisit(n, allNodes, visited, dfv);
}
}
dfv.add(node);
} | java | private static void dfVisit(DMNResource node, List<DMNResource> allNodes, Collection<DMNResource> visited, List<DMNResource> dfv) {
if (visited.contains(node)) {
throw new RuntimeException("Circular dependency detected: " + visited + " , and again to: " + node);
}
visited.add(node);
List<DMNResource> neighbours = node.getDependencies().stream()
.flatMap(dep -> allNodes.stream().filter(r -> r.getModelID().equals(dep)))
.collect(Collectors.toList());
for (DMNResource n : neighbours) {
if (!visited.contains(n)) {
dfVisit(n, allNodes, visited, dfv);
}
}
dfv.add(node);
} | [
"private",
"static",
"void",
"dfVisit",
"(",
"DMNResource",
"node",
",",
"List",
"<",
"DMNResource",
">",
"allNodes",
",",
"Collection",
"<",
"DMNResource",
">",
"visited",
",",
"List",
"<",
"DMNResource",
">",
"dfv",
")",
"{",
"if",
"(",
"visited",
".",
... | Performs a depth first visit, but keeping a separate reference of visited/visiting nodes, _also_ to avoid potential issues of circularities. | [
"Performs",
"a",
"depth",
"first",
"visit",
"but",
"keeping",
"a",
"separate",
"reference",
"of",
"visited",
"/",
"visiting",
"nodes",
"_also_",
"to",
"avoid",
"potential",
"issues",
"of",
"circularities",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNResourceDependenciesSorter.java#L32-L48 |
facebookarchive/swift | swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java | ThriftClientManager.getNiftyChannel | public NiftyClientChannel getNiftyChannel(Object client) {
"""
Returns the {@link NiftyClientChannel} backing a Swift client
@throws IllegalArgumentException if the client is not using a {@link com.facebook.nifty.client.NiftyClientChannel}
@deprecated Use {@link #getRequestChannel} instead, and cast the result to a {@link NiftyClientChannel} if necessary
"""
try {
return NiftyClientChannel.class.cast(getRequestChannel(client));
}
catch (ClassCastException e) {
throw new IllegalArgumentException("The swift client uses a channel that is not a NiftyClientChannel", e);
}
} | java | public NiftyClientChannel getNiftyChannel(Object client)
{
try {
return NiftyClientChannel.class.cast(getRequestChannel(client));
}
catch (ClassCastException e) {
throw new IllegalArgumentException("The swift client uses a channel that is not a NiftyClientChannel", e);
}
} | [
"public",
"NiftyClientChannel",
"getNiftyChannel",
"(",
"Object",
"client",
")",
"{",
"try",
"{",
"return",
"NiftyClientChannel",
".",
"class",
".",
"cast",
"(",
"getRequestChannel",
"(",
"client",
")",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
"... | Returns the {@link NiftyClientChannel} backing a Swift client
@throws IllegalArgumentException if the client is not using a {@link com.facebook.nifty.client.NiftyClientChannel}
@deprecated Use {@link #getRequestChannel} instead, and cast the result to a {@link NiftyClientChannel} if necessary | [
"Returns",
"the",
"{",
"@link",
"NiftyClientChannel",
"}",
"backing",
"a",
"Swift",
"client"
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java#L319-L327 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/coffheader/COFFFileHeader.java | COFFFileHeader.newInstance | public static COFFFileHeader newInstance(byte[] headerbytes, long offset) {
"""
Creates an instance of the COFF File Header based on headerbytes and
offset.
@param headerbytes
the bytes that make up the COFF File Header
@param offset
the file offset to the beginning of the header
@return COFFFileHeader instance
"""
COFFFileHeader header = new COFFFileHeader(headerbytes, offset);
header.read();
return header;
} | java | public static COFFFileHeader newInstance(byte[] headerbytes, long offset) {
COFFFileHeader header = new COFFFileHeader(headerbytes, offset);
header.read();
return header;
} | [
"public",
"static",
"COFFFileHeader",
"newInstance",
"(",
"byte",
"[",
"]",
"headerbytes",
",",
"long",
"offset",
")",
"{",
"COFFFileHeader",
"header",
"=",
"new",
"COFFFileHeader",
"(",
"headerbytes",
",",
"offset",
")",
";",
"header",
".",
"read",
"(",
")"... | Creates an instance of the COFF File Header based on headerbytes and
offset.
@param headerbytes
the bytes that make up the COFF File Header
@param offset
the file offset to the beginning of the header
@return COFFFileHeader instance | [
"Creates",
"an",
"instance",
"of",
"the",
"COFF",
"File",
"Header",
"based",
"on",
"headerbytes",
"and",
"offset",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/coffheader/COFFFileHeader.java#L280-L284 |
soulwarelabs/jParley-Utility | src/main/java/com/soulwarelabs/jparley/utility/Manager.java | Manager.parseAll | public void parseAll(Connection connection, Statement statement)
throws SQLException {
"""
Reads all registered output parameters from specified statement.
@param connection an SQL database connection.
@param statement an SQL callable statement.
@throws SQLException if error occurs while setting up parameters.
@see Connection
@see Statement
@since v1.0
"""
for (Object key : mappings.keySet()) {
Parameter parameter = mappings.get(key);
if (parameter.getOutput() != null) {
Object output = statement.read(key);
Converter decoder = parameter.getDecoder();
if (decoder != null) {
output = decoder.perform(connection, output);
}
parameter.getOutput().setValue(output);
}
}
} | java | public void parseAll(Connection connection, Statement statement)
throws SQLException {
for (Object key : mappings.keySet()) {
Parameter parameter = mappings.get(key);
if (parameter.getOutput() != null) {
Object output = statement.read(key);
Converter decoder = parameter.getDecoder();
if (decoder != null) {
output = decoder.perform(connection, output);
}
parameter.getOutput().setValue(output);
}
}
} | [
"public",
"void",
"parseAll",
"(",
"Connection",
"connection",
",",
"Statement",
"statement",
")",
"throws",
"SQLException",
"{",
"for",
"(",
"Object",
"key",
":",
"mappings",
".",
"keySet",
"(",
")",
")",
"{",
"Parameter",
"parameter",
"=",
"mappings",
".",... | Reads all registered output parameters from specified statement.
@param connection an SQL database connection.
@param statement an SQL callable statement.
@throws SQLException if error occurs while setting up parameters.
@see Connection
@see Statement
@since v1.0 | [
"Reads",
"all",
"registered",
"output",
"parameters",
"from",
"specified",
"statement",
"."
] | train | https://github.com/soulwarelabs/jParley-Utility/blob/825d139b9d294ef4cf71dbce349be5cb3da1b3a9/src/main/java/com/soulwarelabs/jparley/utility/Manager.java#L153-L166 |
bwkimmel/jdcp | jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java | FileClassManager.moveClass | private void moveClass(File fromDirectory, String name, File toDirectory) {
"""
Moves a class definition from the specified directory tree to another
specified directory tree.
@param fromDirectory The root of the directory tree from which to move
the class definition.
@param name The fully qualified name of the class to move.
@param toDirectory The root of the directory tree to move the class
definition to.
"""
String baseName = getBaseFileName(name);
File fromClassFile = new File(fromDirectory, baseName + CLASS_EXTENSION);
File toClassFile = new File(toDirectory, baseName + CLASS_EXTENSION);
File fromDigestFile = new File(fromDirectory, baseName + DIGEST_EXTENSION);
File toDigestFile = new File(toDirectory, baseName + DIGEST_EXTENSION);
File toClassDirectory = toClassFile.getParentFile();
toClassDirectory.mkdirs();
fromClassFile.renameTo(toClassFile);
fromDigestFile.renameTo(toDigestFile);
} | java | private void moveClass(File fromDirectory, String name, File toDirectory) {
String baseName = getBaseFileName(name);
File fromClassFile = new File(fromDirectory, baseName + CLASS_EXTENSION);
File toClassFile = new File(toDirectory, baseName + CLASS_EXTENSION);
File fromDigestFile = new File(fromDirectory, baseName + DIGEST_EXTENSION);
File toDigestFile = new File(toDirectory, baseName + DIGEST_EXTENSION);
File toClassDirectory = toClassFile.getParentFile();
toClassDirectory.mkdirs();
fromClassFile.renameTo(toClassFile);
fromDigestFile.renameTo(toDigestFile);
} | [
"private",
"void",
"moveClass",
"(",
"File",
"fromDirectory",
",",
"String",
"name",
",",
"File",
"toDirectory",
")",
"{",
"String",
"baseName",
"=",
"getBaseFileName",
"(",
"name",
")",
";",
"File",
"fromClassFile",
"=",
"new",
"File",
"(",
"fromDirectory",
... | Moves a class definition from the specified directory tree to another
specified directory tree.
@param fromDirectory The root of the directory tree from which to move
the class definition.
@param name The fully qualified name of the class to move.
@param toDirectory The root of the directory tree to move the class
definition to. | [
"Moves",
"a",
"class",
"definition",
"from",
"the",
"specified",
"directory",
"tree",
"to",
"another",
"specified",
"directory",
"tree",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L202-L213 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.setProperty | private static void setProperty( Object bean, String key, Object value, JsonConfig jsonConfig )
throws Exception {
"""
Sets a property on the target bean.<br>
Bean may be a Map or a POJO.
"""
PropertySetStrategy propertySetStrategy = jsonConfig.getPropertySetStrategy() != null ? jsonConfig.getPropertySetStrategy()
: PropertySetStrategy.DEFAULT;
propertySetStrategy.setProperty( bean, key, value, jsonConfig );
} | java | private static void setProperty( Object bean, String key, Object value, JsonConfig jsonConfig )
throws Exception {
PropertySetStrategy propertySetStrategy = jsonConfig.getPropertySetStrategy() != null ? jsonConfig.getPropertySetStrategy()
: PropertySetStrategy.DEFAULT;
propertySetStrategy.setProperty( bean, key, value, jsonConfig );
} | [
"private",
"static",
"void",
"setProperty",
"(",
"Object",
"bean",
",",
"String",
"key",
",",
"Object",
"value",
",",
"JsonConfig",
"jsonConfig",
")",
"throws",
"Exception",
"{",
"PropertySetStrategy",
"propertySetStrategy",
"=",
"jsonConfig",
".",
"getPropertySetSt... | Sets a property on the target bean.<br>
Bean may be a Map or a POJO. | [
"Sets",
"a",
"property",
"on",
"the",
"target",
"bean",
".",
"<br",
">",
"Bean",
"may",
"be",
"a",
"Map",
"or",
"a",
"POJO",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1315-L1320 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java | RESTClient.sendRequest | public RESTResponse sendRequest(HttpMethod method, String uri) throws IOException {
"""
Send a REST command with the given method and URI (but no entityt) to the
server and return the response in a {@link RESTResponse} object.
@param method HTTP method such as "GET" or "POST".
@param uri URI such as "/foo/bar?baz"
@return {@link RESTResponse} containing response from server.
@throws IOException If an I/O error occurs on the socket.
"""
Map<String, String> headers = new HashMap<>();
return sendRequest(method, uri, headers, null);
} | java | public RESTResponse sendRequest(HttpMethod method, String uri) throws IOException {
Map<String, String> headers = new HashMap<>();
return sendRequest(method, uri, headers, null);
} | [
"public",
"RESTResponse",
"sendRequest",
"(",
"HttpMethod",
"method",
",",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"return",
"sendRequest",
"(",
"m... | Send a REST command with the given method and URI (but no entityt) to the
server and return the response in a {@link RESTResponse} object.
@param method HTTP method such as "GET" or "POST".
@param uri URI such as "/foo/bar?baz"
@return {@link RESTResponse} containing response from server.
@throws IOException If an I/O error occurs on the socket. | [
"Send",
"a",
"REST",
"command",
"with",
"the",
"given",
"method",
"and",
"URI",
"(",
"but",
"no",
"entityt",
")",
"to",
"the",
"server",
"and",
"return",
"the",
"response",
"in",
"a",
"{",
"@link",
"RESTResponse",
"}",
"object",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java#L244-L247 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateBinaryStream | public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException {
"""
Updates a column with a binary stream value. The updateXXX methods are used to update column values
in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnName - the name of the column
x - the new column value
length - of the stream
@throws SQLException if a database access error occurs.
"""
try {
rsetImpl.updateBinaryStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException {
try {
rsetImpl.updateBinaryStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateBinaryStream",
"(",
"String",
"arg0",
",",
"InputStream",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateBinaryStream",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"cat... | Updates a column with a binary stream value. The updateXXX methods are used to update column values
in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnName - the name of the column
x - the new column value
length - of the stream
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"a",
"binary",
"stream",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2824-L2834 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractSEPAGV.java | AbstractSEPAGV.determinePainVersion | private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) {
"""
Diese Methode schaut in den BPD nach den unterstützen pain Versionen
(bei LastSEPA pain.008.xxx.xx) und vergleicht diese mit den von HBCI4Java
unterstützen pain Versionen. Der größte gemeinsamme Nenner wird
zurueckgeliefert.
@param passport
@param gvName der Geschaeftsvorfall fuer den in den BPD nach dem PAIN-Versionen
gesucht werden soll.
@return die ermittelte PAIN-Version.
"""
// Schritt 1: Wir holen uns die globale maximale PAIN-Version
SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName());
// Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank
// dort weitere Einschraenkungen hinterlegt hat
SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName);
// Wir haben gar keine PAIN-Version gefunden
if (globalVersion == null && jobVersion == null) {
SepaVersion def = this.getDefaultPainVersion();
log.warn("unable to determine matching pain version, using default: " + def);
return def;
}
// Wenn wir keine GV-spezifische haben, dann nehmen wir die globale
if (jobVersion == null) {
log.debug("have no job-specific pain version, using global pain version: " + globalVersion);
return globalVersion;
}
// Ansonsten hat die vom Job Vorrang:
log.debug("using job-specific pain version: " + jobVersion);
return jobVersion;
} | java | private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) {
// Schritt 1: Wir holen uns die globale maximale PAIN-Version
SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName());
// Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank
// dort weitere Einschraenkungen hinterlegt hat
SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName);
// Wir haben gar keine PAIN-Version gefunden
if (globalVersion == null && jobVersion == null) {
SepaVersion def = this.getDefaultPainVersion();
log.warn("unable to determine matching pain version, using default: " + def);
return def;
}
// Wenn wir keine GV-spezifische haben, dann nehmen wir die globale
if (jobVersion == null) {
log.debug("have no job-specific pain version, using global pain version: " + globalVersion);
return globalVersion;
}
// Ansonsten hat die vom Job Vorrang:
log.debug("using job-specific pain version: " + jobVersion);
return jobVersion;
} | [
"private",
"SepaVersion",
"determinePainVersion",
"(",
"HBCIPassportInternal",
"passport",
",",
"String",
"gvName",
")",
"{",
"// Schritt 1: Wir holen uns die globale maximale PAIN-Version",
"SepaVersion",
"globalVersion",
"=",
"this",
".",
"determinePainVersionInternal",
"(",
... | Diese Methode schaut in den BPD nach den unterstützen pain Versionen
(bei LastSEPA pain.008.xxx.xx) und vergleicht diese mit den von HBCI4Java
unterstützen pain Versionen. Der größte gemeinsamme Nenner wird
zurueckgeliefert.
@param passport
@param gvName der Geschaeftsvorfall fuer den in den BPD nach dem PAIN-Versionen
gesucht werden soll.
@return die ermittelte PAIN-Version. | [
"Diese",
"Methode",
"schaut",
"in",
"den",
"BPD",
"nach",
"den",
"unterstützen",
"pain",
"Versionen",
"(",
"bei",
"LastSEPA",
"pain",
".",
"008",
".",
"xxx",
".",
"xx",
")",
"und",
"vergleicht",
"diese",
"mit",
"den",
"von",
"HBCI4Java",
"unterstützen",
"p... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractSEPAGV.java#L71-L95 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java | IOUtils.copyReader | public static void copyReader(Reader from, Writer to) throws IOException {
"""
Copy the given Reader to the given Writer.
This method is basically the same as copyStream; however Reader and Writer
objects are cognizant of character encoding, whereas InputStream and OutputStreams
objects deal only with bytes.
Note: the Reader is closed when the copy is complete. The Writer
is left open. The Write is flushed when the copy is complete.
"""
char buffer[] = new char[2048];
int charsRead;
while ((charsRead = from.read(buffer)) != -1) {
to.write(buffer, 0, charsRead);
}
from.close();
to.flush();
} | java | public static void copyReader(Reader from, Writer to) throws IOException {
char buffer[] = new char[2048];
int charsRead;
while ((charsRead = from.read(buffer)) != -1) {
to.write(buffer, 0, charsRead);
}
from.close();
to.flush();
} | [
"public",
"static",
"void",
"copyReader",
"(",
"Reader",
"from",
",",
"Writer",
"to",
")",
"throws",
"IOException",
"{",
"char",
"buffer",
"[",
"]",
"=",
"new",
"char",
"[",
"2048",
"]",
";",
"int",
"charsRead",
";",
"while",
"(",
"(",
"charsRead",
"="... | Copy the given Reader to the given Writer.
This method is basically the same as copyStream; however Reader and Writer
objects are cognizant of character encoding, whereas InputStream and OutputStreams
objects deal only with bytes.
Note: the Reader is closed when the copy is complete. The Writer
is left open. The Write is flushed when the copy is complete. | [
"Copy",
"the",
"given",
"Reader",
"to",
"the",
"given",
"Writer",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java#L46-L55 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/layout/Layout.java | Layout.getGeneration | public Layout getGeneration(int generation) throws FetchNoneException, FetchException {
"""
Returns the layout for a particular generation of this layout's type.
@throws FetchNoneException if generation not found
"""
try {
Storage<StoredLayoutEquivalence> equivStorage =
mLayoutFactory.mRepository.storageFor(StoredLayoutEquivalence.class);
StoredLayoutEquivalence equiv = equivStorage.prepare();
equiv.setStorableTypeName(getStorableTypeName());
equiv.setGeneration(generation);
if (equiv.tryLoad()) {
generation = equiv.getMatchedGeneration();
}
} catch (RepositoryException e) {
throw e.toFetchException();
}
return new Layout(mLayoutFactory, getStoredLayoutByGeneration(generation));
} | java | public Layout getGeneration(int generation) throws FetchNoneException, FetchException {
try {
Storage<StoredLayoutEquivalence> equivStorage =
mLayoutFactory.mRepository.storageFor(StoredLayoutEquivalence.class);
StoredLayoutEquivalence equiv = equivStorage.prepare();
equiv.setStorableTypeName(getStorableTypeName());
equiv.setGeneration(generation);
if (equiv.tryLoad()) {
generation = equiv.getMatchedGeneration();
}
} catch (RepositoryException e) {
throw e.toFetchException();
}
return new Layout(mLayoutFactory, getStoredLayoutByGeneration(generation));
} | [
"public",
"Layout",
"getGeneration",
"(",
"int",
"generation",
")",
"throws",
"FetchNoneException",
",",
"FetchException",
"{",
"try",
"{",
"Storage",
"<",
"StoredLayoutEquivalence",
">",
"equivStorage",
"=",
"mLayoutFactory",
".",
"mRepository",
".",
"storageFor",
... | Returns the layout for a particular generation of this layout's type.
@throws FetchNoneException if generation not found | [
"Returns",
"the",
"layout",
"for",
"a",
"particular",
"generation",
"of",
"this",
"layout",
"s",
"type",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/layout/Layout.java#L325-L340 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/ArrayContext.java | ArrayContext.setArrayElement | public void setArrayElement(Object array, int index, Object value) {
"""
Set the element at the given index in the given array. This is a helper
method for {@link Array#set(Object, int, Object)}. If the given array is
not an array, then {@link IllegalArgumentException} is thrown. If the
given index is out of bounds, then {@link ArrayIndexOutOfBoundsException}
is thrown. Note that if the component type of the array is a primitive,
then the value will be unwrapped. This may result in a
{@link NullPointerException} being thrown.
@param array The array to set the element to
@param index The index of the array to set
@param value The value of the array to set
"""
Array.set(array, index, value);
} | java | public void setArrayElement(Object array, int index, Object value) {
Array.set(array, index, value);
} | [
"public",
"void",
"setArrayElement",
"(",
"Object",
"array",
",",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"Array",
".",
"set",
"(",
"array",
",",
"index",
",",
"value",
")",
";",
"}"
] | Set the element at the given index in the given array. This is a helper
method for {@link Array#set(Object, int, Object)}. If the given array is
not an array, then {@link IllegalArgumentException} is thrown. If the
given index is out of bounds, then {@link ArrayIndexOutOfBoundsException}
is thrown. Note that if the component type of the array is a primitive,
then the value will be unwrapped. This may result in a
{@link NullPointerException} being thrown.
@param array The array to set the element to
@param index The index of the array to set
@param value The value of the array to set | [
"Set",
"the",
"element",
"at",
"the",
"given",
"index",
"in",
"the",
"given",
"array",
".",
"This",
"is",
"a",
"helper",
"method",
"for",
"{",
"@link",
"Array#set",
"(",
"Object",
"int",
"Object",
")",
"}",
".",
"If",
"the",
"given",
"array",
"is",
"... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/ArrayContext.java#L204-L206 |
ArpNetworking/metrics-jvm-extra | src/main/java/com/arpnetworking/metrics/jvm/collectors/PoolMemoryMetricsCollector.java | PoolMemoryMetricsCollector.recordMetricsForPool | protected void recordMetricsForPool(final MemoryPoolMXBean pool, final Metrics metrics) {
"""
Records the metrics for a given pool. Useful if a deriving class filters the list of pools to collect.
@param pool {@link MemoryPoolMXBean} to record
@param metrics {@link Metrics} to record into
"""
final MemoryUsage usage = pool.getUsage();
metrics.setGauge(
String.join(
"/",
ROOT_NAMESPACE,
memoryTypeSegment(pool.getType()),
MetricsUtil.convertToSnakeCase(pool.getName()),
MEMORY_USED),
usage.getUsed(),
Units.BYTE
);
final long memoryMax = usage.getMax();
if (memoryMax != -1) {
metrics.setGauge(
String.join(
"/",
ROOT_NAMESPACE,
memoryTypeSegment(pool.getType()),
MetricsUtil.convertToSnakeCase(pool.getName()),
MEMORY_MAX),
memoryMax,
Units.BYTE
);
}
} | java | protected void recordMetricsForPool(final MemoryPoolMXBean pool, final Metrics metrics) {
final MemoryUsage usage = pool.getUsage();
metrics.setGauge(
String.join(
"/",
ROOT_NAMESPACE,
memoryTypeSegment(pool.getType()),
MetricsUtil.convertToSnakeCase(pool.getName()),
MEMORY_USED),
usage.getUsed(),
Units.BYTE
);
final long memoryMax = usage.getMax();
if (memoryMax != -1) {
metrics.setGauge(
String.join(
"/",
ROOT_NAMESPACE,
memoryTypeSegment(pool.getType()),
MetricsUtil.convertToSnakeCase(pool.getName()),
MEMORY_MAX),
memoryMax,
Units.BYTE
);
}
} | [
"protected",
"void",
"recordMetricsForPool",
"(",
"final",
"MemoryPoolMXBean",
"pool",
",",
"final",
"Metrics",
"metrics",
")",
"{",
"final",
"MemoryUsage",
"usage",
"=",
"pool",
".",
"getUsage",
"(",
")",
";",
"metrics",
".",
"setGauge",
"(",
"String",
".",
... | Records the metrics for a given pool. Useful if a deriving class filters the list of pools to collect.
@param pool {@link MemoryPoolMXBean} to record
@param metrics {@link Metrics} to record into | [
"Records",
"the",
"metrics",
"for",
"a",
"given",
"pool",
".",
"Useful",
"if",
"a",
"deriving",
"class",
"filters",
"the",
"list",
"of",
"pools",
"to",
"collect",
"."
] | train | https://github.com/ArpNetworking/metrics-jvm-extra/blob/2a931240afc611b73b6bcb647fb042f42f158047/src/main/java/com/arpnetworking/metrics/jvm/collectors/PoolMemoryMetricsCollector.java#L60-L85 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedBarrier.java | DistributedBarrier.waitOnBarrier | public synchronized boolean waitOnBarrier(long maxWait, TimeUnit unit) throws Exception {
"""
Blocks until the barrier no longer exists or the timeout elapses
@param maxWait max time to block
@param unit time unit
@return true if the wait was successful, false if the timeout elapsed first
@throws Exception errors
"""
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
boolean result;
for(;;)
{
result = (client.checkExists().usingWatcher(watcher).forPath(barrierPath) == null);
if ( result )
{
break;
}
if ( hasMaxWait )
{
long elapsed = System.currentTimeMillis() - startMs;
long thisWaitMs = maxWaitMs - elapsed;
if ( thisWaitMs <= 0 )
{
break;
}
wait(thisWaitMs);
}
else
{
wait();
}
}
return result;
} | java | public synchronized boolean waitOnBarrier(long maxWait, TimeUnit unit) throws Exception
{
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
boolean result;
for(;;)
{
result = (client.checkExists().usingWatcher(watcher).forPath(barrierPath) == null);
if ( result )
{
break;
}
if ( hasMaxWait )
{
long elapsed = System.currentTimeMillis() - startMs;
long thisWaitMs = maxWaitMs - elapsed;
if ( thisWaitMs <= 0 )
{
break;
}
wait(thisWaitMs);
}
else
{
wait();
}
}
return result;
} | [
"public",
"synchronized",
"boolean",
"waitOnBarrier",
"(",
"long",
"maxWait",
",",
"TimeUnit",
"unit",
")",
"throws",
"Exception",
"{",
"long",
"startMs",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"hasMaxWait",
"=",
"(",
"unit",
"!=",
... | Blocks until the barrier no longer exists or the timeout elapses
@param maxWait max time to block
@param unit time unit
@return true if the wait was successful, false if the timeout elapsed first
@throws Exception errors | [
"Blocks",
"until",
"the",
"barrier",
"no",
"longer",
"exists",
"or",
"the",
"timeout",
"elapses"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedBarrier.java#L113-L144 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbooksInner.java | RunbooksInner.listByAutomationAccountAsync | public Observable<Page<RunbookInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) {
"""
Retrieve a list of runbooks.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RunbookInner> object
"""
return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName)
.map(new Func1<ServiceResponse<Page<RunbookInner>>, Page<RunbookInner>>() {
@Override
public Page<RunbookInner> call(ServiceResponse<Page<RunbookInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RunbookInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) {
return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName)
.map(new Func1<ServiceResponse<Page<RunbookInner>>, Page<RunbookInner>>() {
@Override
public Page<RunbookInner> call(ServiceResponse<Page<RunbookInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RunbookInner",
">",
">",
"listByAutomationAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
")",
"{",
"return",
"listByAutomationAccountWithServiceResponseAsync",
"(",
"r... | Retrieve a list of runbooks.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RunbookInner> object | [
"Retrieve",
"a",
"list",
"of",
"runbooks",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbooksInner.java#L620-L628 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Bugsnag.java | Bugsnag.addThreadMetaData | public static void addThreadMetaData(String tabName, String key, Object value) {
"""
Add a key value pair to a metadata tab just for this thread.
@param tabName the name of the tab to add the key value pair to
@param key the key of the metadata to add
@param value the metadata value to add
"""
THREAD_METADATA.get().addToTab(tabName, key, value);
} | java | public static void addThreadMetaData(String tabName, String key, Object value) {
THREAD_METADATA.get().addToTab(tabName, key, value);
} | [
"public",
"static",
"void",
"addThreadMetaData",
"(",
"String",
"tabName",
",",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"THREAD_METADATA",
".",
"get",
"(",
")",
".",
"addToTab",
"(",
"tabName",
",",
"key",
",",
"value",
")",
";",
"}"
] | Add a key value pair to a metadata tab just for this thread.
@param tabName the name of the tab to add the key value pair to
@param key the key of the metadata to add
@param value the metadata value to add | [
"Add",
"a",
"key",
"value",
"pair",
"to",
"a",
"metadata",
"tab",
"just",
"for",
"this",
"thread",
"."
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Bugsnag.java#L616-L618 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toTimeZone | public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) {
"""
casts a string to a TimeZone
@param strTimeZone
@param defaultValue
@return TimeZone from String
"""
return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue);
} | java | public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) {
return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue);
} | [
"public",
"static",
"TimeZone",
"toTimeZone",
"(",
"String",
"strTimeZone",
",",
"TimeZone",
"defaultValue",
")",
"{",
"return",
"TimeZoneUtil",
".",
"toTimeZone",
"(",
"strTimeZone",
",",
"defaultValue",
")",
";",
"}"
] | casts a string to a TimeZone
@param strTimeZone
@param defaultValue
@return TimeZone from String | [
"casts",
"a",
"string",
"to",
"a",
"TimeZone"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4255-L4257 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java | QuorumJournalManager.journalIdBytesToString | public static String journalIdBytesToString(byte[] jid) {
"""
Translates byte[] journal id into String. This will be done only the first
time we are accessing a journal.
"""
char[] charArray = new char[jid.length];
for (int i = 0; i < jid.length; i++) {
charArray[i] = (char) jid[i];
}
return new String(charArray, 0, charArray.length);
} | java | public static String journalIdBytesToString(byte[] jid) {
char[] charArray = new char[jid.length];
for (int i = 0; i < jid.length; i++) {
charArray[i] = (char) jid[i];
}
return new String(charArray, 0, charArray.length);
} | [
"public",
"static",
"String",
"journalIdBytesToString",
"(",
"byte",
"[",
"]",
"jid",
")",
"{",
"char",
"[",
"]",
"charArray",
"=",
"new",
"char",
"[",
"jid",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jid",
".",
"... | Translates byte[] journal id into String. This will be done only the first
time we are accessing a journal. | [
"Translates",
"byte",
"[]",
"journal",
"id",
"into",
"String",
".",
"This",
"will",
"be",
"done",
"only",
"the",
"first",
"time",
"we",
"are",
"accessing",
"a",
"journal",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L612-L618 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java | SpellingCheckRule.ignoreToken | protected boolean ignoreToken(AnalyzedTokenReadings[] tokens, int idx) throws IOException {
"""
Returns true iff the token at the given position should be ignored by the spell checker.
"""
List<String> words = new ArrayList<>();
for (AnalyzedTokenReadings token : tokens) {
words.add(token.getToken());
}
return ignoreWord(words, idx);
} | java | protected boolean ignoreToken(AnalyzedTokenReadings[] tokens, int idx) throws IOException {
List<String> words = new ArrayList<>();
for (AnalyzedTokenReadings token : tokens) {
words.add(token.getToken());
}
return ignoreWord(words, idx);
} | [
"protected",
"boolean",
"ignoreToken",
"(",
"AnalyzedTokenReadings",
"[",
"]",
"tokens",
",",
"int",
"idx",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"words",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"AnalyzedTokenReadin... | Returns true iff the token at the given position should be ignored by the spell checker. | [
"Returns",
"true",
"iff",
"the",
"token",
"at",
"the",
"given",
"position",
"should",
"be",
"ignored",
"by",
"the",
"spell",
"checker",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java#L258-L264 |
aws/aws-sdk-java | aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/HttpInstanceSummary.java | HttpInstanceSummary.withAttributes | public HttpInstanceSummary withAttributes(java.util.Map<String, String> attributes) {
"""
<p>
If you included any attributes when you registered the instance, the values of those attributes.
</p>
@param attributes
If you included any attributes when you registered the instance, the values of those attributes.
@return Returns a reference to this object so that method calls can be chained together.
"""
setAttributes(attributes);
return this;
} | java | public HttpInstanceSummary withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"HttpInstanceSummary",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
If you included any attributes when you registered the instance, the values of those attributes.
</p>
@param attributes
If you included any attributes when you registered the instance, the values of those attributes.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"If",
"you",
"included",
"any",
"attributes",
"when",
"you",
"registered",
"the",
"instance",
"the",
"values",
"of",
"those",
"attributes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/HttpInstanceSummary.java#L277-L280 |
Alluxio/alluxio | core/common/src/main/java/alluxio/extensions/ExtensionFactoryRegistry.java | ExtensionFactoryRegistry.scan | private void scan(List<File> files, List<T> factories) {
"""
Class-loads jar files that have not been loaded.
@param files jar files to class-load
@param factories list of factories to add to
"""
for (File jar : files) {
try {
URL extensionURL = jar.toURI().toURL();
String jarPath = extensionURL.toString();
ClassLoader extensionsClassLoader = new ExtensionsClassLoader(new URL[] {extensionURL},
ClassLoader.getSystemClassLoader());
ServiceLoader<T> extensionServiceLoader =
ServiceLoader.load(mFactoryClass, extensionsClassLoader);
for (T factory : extensionServiceLoader) {
LOG.debug("Discovered a factory implementation {} - {} in jar {}", factory.getClass(),
factory, jarPath);
register(factory, factories);
}
} catch (Throwable t) {
LOG.warn("Failed to load jar {}: {}", jar, t.toString());
}
}
} | java | private void scan(List<File> files, List<T> factories) {
for (File jar : files) {
try {
URL extensionURL = jar.toURI().toURL();
String jarPath = extensionURL.toString();
ClassLoader extensionsClassLoader = new ExtensionsClassLoader(new URL[] {extensionURL},
ClassLoader.getSystemClassLoader());
ServiceLoader<T> extensionServiceLoader =
ServiceLoader.load(mFactoryClass, extensionsClassLoader);
for (T factory : extensionServiceLoader) {
LOG.debug("Discovered a factory implementation {} - {} in jar {}", factory.getClass(),
factory, jarPath);
register(factory, factories);
}
} catch (Throwable t) {
LOG.warn("Failed to load jar {}: {}", jar, t.toString());
}
}
} | [
"private",
"void",
"scan",
"(",
"List",
"<",
"File",
">",
"files",
",",
"List",
"<",
"T",
">",
"factories",
")",
"{",
"for",
"(",
"File",
"jar",
":",
"files",
")",
"{",
"try",
"{",
"URL",
"extensionURL",
"=",
"jar",
".",
"toURI",
"(",
")",
".",
... | Class-loads jar files that have not been loaded.
@param files jar files to class-load
@param factories list of factories to add to | [
"Class",
"-",
"loads",
"jar",
"files",
"that",
"have",
"not",
"been",
"loaded",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/extensions/ExtensionFactoryRegistry.java#L191-L210 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDate | @Deprecated
public static Date getDate(HttpMessage message) throws ParseException {
"""
@deprecated Use {@link #getTimeMillis(CharSequence)} instead.
Returns the value of the {@code "Date"} header.
@throws ParseException
if there is no such header or the header value is not a formatted date
"""
return getDateHeader(message, HttpHeaderNames.DATE);
} | java | @Deprecated
public static Date getDate(HttpMessage message) throws ParseException {
return getDateHeader(message, HttpHeaderNames.DATE);
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDate",
"(",
"HttpMessage",
"message",
")",
"throws",
"ParseException",
"{",
"return",
"getDateHeader",
"(",
"message",
",",
"HttpHeaderNames",
".",
"DATE",
")",
";",
"}"
] | @deprecated Use {@link #getTimeMillis(CharSequence)} instead.
Returns the value of the {@code "Date"} header.
@throws ParseException
if there is no such header or the header value is not a formatted date | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1047-L1050 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/markup/AbstractImageMediaMarkupBuilder.java | AbstractImageMediaMarkupBuilder.applyWcmMarkup | protected void applyWcmMarkup(@Nullable HtmlElement<?> mediaElement, @NotNull Media media) {
"""
Apply Markup for Drag&Drop mode and Diff decoration in WCM edit/preview mode.
@param mediaElement Media element
@param media Media
"""
// further processing in edit or preview mode
Resource resource = media.getMediaRequest().getResource();
if (mediaElement != null && resource != null && wcmMode != null) {
switch (wcmMode) {
case EDIT:
// enable drag&drop from content finder
media.getMediaSource().enableMediaDrop(mediaElement, media.getMediaRequest());
// set custom IPE crop ratios
media.getMediaSource().setCustomIPECropRatios(mediaElement, media.getMediaRequest());
break;
case PREVIEW:
// enable drag&drop from content finder
media.getMediaSource().enableMediaDrop(mediaElement, media.getMediaRequest());
// add diff decoration
if (request != null) {
String refProperty = StringUtils.defaultString(media.getMediaRequest().getRefProperty(),
mediaHandlerConfig.getMediaRefProperty());
MediaMarkupBuilderUtil.addDiffDecoration(mediaElement, resource, refProperty, request, mediaHandlerConfig);
}
// set custom IPE crop ratios
media.getMediaSource().setCustomIPECropRatios(mediaElement, media.getMediaRequest());
break;
default:
// do nothing
}
}
} | java | protected void applyWcmMarkup(@Nullable HtmlElement<?> mediaElement, @NotNull Media media) {
// further processing in edit or preview mode
Resource resource = media.getMediaRequest().getResource();
if (mediaElement != null && resource != null && wcmMode != null) {
switch (wcmMode) {
case EDIT:
// enable drag&drop from content finder
media.getMediaSource().enableMediaDrop(mediaElement, media.getMediaRequest());
// set custom IPE crop ratios
media.getMediaSource().setCustomIPECropRatios(mediaElement, media.getMediaRequest());
break;
case PREVIEW:
// enable drag&drop from content finder
media.getMediaSource().enableMediaDrop(mediaElement, media.getMediaRequest());
// add diff decoration
if (request != null) {
String refProperty = StringUtils.defaultString(media.getMediaRequest().getRefProperty(),
mediaHandlerConfig.getMediaRefProperty());
MediaMarkupBuilderUtil.addDiffDecoration(mediaElement, resource, refProperty, request, mediaHandlerConfig);
}
// set custom IPE crop ratios
media.getMediaSource().setCustomIPECropRatios(mediaElement, media.getMediaRequest());
break;
default:
// do nothing
}
}
} | [
"protected",
"void",
"applyWcmMarkup",
"(",
"@",
"Nullable",
"HtmlElement",
"<",
"?",
">",
"mediaElement",
",",
"@",
"NotNull",
"Media",
"media",
")",
"{",
"// further processing in edit or preview mode",
"Resource",
"resource",
"=",
"media",
".",
"getMediaRequest",
... | Apply Markup for Drag&Drop mode and Diff decoration in WCM edit/preview mode.
@param mediaElement Media element
@param media Media | [
"Apply",
"Markup",
"for",
"Drag&",
";",
"Drop",
"mode",
"and",
"Diff",
"decoration",
"in",
"WCM",
"edit",
"/",
"preview",
"mode",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/AbstractImageMediaMarkupBuilder.java#L64-L95 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java | PooledHttpTransportFactory.getOrCreateTransportPool | private TransportPool getOrCreateTransportPool(String hostInfo, Settings settings, SecureSettings secureSettings) {
"""
Gets the transport pool for the given host info, or creates one if it is absent.
@param hostInfo To get a pool for
@param settings For creating the pool if it does not exist
@param secureSettings For providing secure settings to the connections within the pool once created
@return A transport pool for the given host
"""
TransportPool pool;
pool = hostPools.get(hostInfo); // Check again in case it was added while waiting for the lock
if (pool == null) {
pool = new TransportPool(jobKey, hostInfo, settings, secureSettings);
hostPools.put(hostInfo, pool);
if (log.isDebugEnabled()) {
log.debug("Creating new TransportPool for job ["+jobKey+"] for host ["+hostInfo+"]");
}
}
return pool;
} | java | private TransportPool getOrCreateTransportPool(String hostInfo, Settings settings, SecureSettings secureSettings) {
TransportPool pool;
pool = hostPools.get(hostInfo); // Check again in case it was added while waiting for the lock
if (pool == null) {
pool = new TransportPool(jobKey, hostInfo, settings, secureSettings);
hostPools.put(hostInfo, pool);
if (log.isDebugEnabled()) {
log.debug("Creating new TransportPool for job ["+jobKey+"] for host ["+hostInfo+"]");
}
}
return pool;
} | [
"private",
"TransportPool",
"getOrCreateTransportPool",
"(",
"String",
"hostInfo",
",",
"Settings",
"settings",
",",
"SecureSettings",
"secureSettings",
")",
"{",
"TransportPool",
"pool",
";",
"pool",
"=",
"hostPools",
".",
"get",
"(",
"hostInfo",
")",
";",
"// Ch... | Gets the transport pool for the given host info, or creates one if it is absent.
@param hostInfo To get a pool for
@param settings For creating the pool if it does not exist
@param secureSettings For providing secure settings to the connections within the pool once created
@return A transport pool for the given host | [
"Gets",
"the",
"transport",
"pool",
"for",
"the",
"given",
"host",
"info",
"or",
"creates",
"one",
"if",
"it",
"is",
"absent",
"."
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java#L82-L93 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/table/RtfRow.java | RtfRow.importRow | private void importRow(Row row) {
"""
Imports a Row and copies all settings
@param row The Row to import
"""
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
for(int i = 0; i < row.getColumns(); i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
cellRight = cellRight + cellWidth;
Cell cell = (Cell) row.getCell(i);
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight);
rtfCell.setCellWidth(cellWidth);
this.cells.add(rtfCell);
}
} | java | private void importRow(Row row) {
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
for(int i = 0; i < row.getColumns(); i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
cellRight = cellRight + cellWidth;
Cell cell = (Cell) row.getCell(i);
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight);
rtfCell.setCellWidth(cellWidth);
this.cells.add(rtfCell);
}
} | [
"private",
"void",
"importRow",
"(",
"Row",
"row",
")",
"{",
"this",
".",
"cells",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"width",
"=",
"this",
".",
"document",
".",
"getDocumentHeader",
"(",
")",
".",
"getPageSetting",
"(",
")",
".",
"... | Imports a Row and copies all settings
@param row The Row to import | [
"Imports",
"a",
"Row",
"and",
"copies",
"all",
"settings"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfRow.java#L225-L242 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/invalidation/Invalidator.java | Invalidator.invalidateAllKeys | public final void invalidateAllKeys(String dataStructureName, String sourceUuid) {
"""
Invalidates all keys from Near Caches of supplied data structure name.
@param dataStructureName name of the data structure to be cleared
"""
checkNotNull(sourceUuid, "sourceUuid cannot be null");
int orderKey = getPartitionId(dataStructureName);
Invalidation invalidation = newClearInvalidation(dataStructureName, sourceUuid);
sendImmediately(invalidation, orderKey);
} | java | public final void invalidateAllKeys(String dataStructureName, String sourceUuid) {
checkNotNull(sourceUuid, "sourceUuid cannot be null");
int orderKey = getPartitionId(dataStructureName);
Invalidation invalidation = newClearInvalidation(dataStructureName, sourceUuid);
sendImmediately(invalidation, orderKey);
} | [
"public",
"final",
"void",
"invalidateAllKeys",
"(",
"String",
"dataStructureName",
",",
"String",
"sourceUuid",
")",
"{",
"checkNotNull",
"(",
"sourceUuid",
",",
"\"sourceUuid cannot be null\"",
")",
";",
"int",
"orderKey",
"=",
"getPartitionId",
"(",
"dataStructureN... | Invalidates all keys from Near Caches of supplied data structure name.
@param dataStructureName name of the data structure to be cleared | [
"Invalidates",
"all",
"keys",
"from",
"Near",
"Caches",
"of",
"supplied",
"data",
"structure",
"name",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/invalidation/Invalidator.java#L80-L86 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMInputStream.java | JMInputStream.consumeInputStream | public static void consumeInputStream(InputStream inputStream,
String charsetName, Consumer<String> consumer) {
"""
Consume input stream.
@param inputStream the input stream
@param charsetName the charset name
@param consumer the consumer
"""
try (BufferedReader br = new BufferedReader(
new InputStreamReader(inputStream, charsetName))) {
for (String line = br.readLine(); line != null;
line = br.readLine())
consumer.accept(line);
} catch (IOException e) {
JMExceptionManager.handleExceptionAndThrowRuntimeEx(log, e,
"consumeInputStream", inputStream, charsetName, consumer);
}
} | java | public static void consumeInputStream(InputStream inputStream,
String charsetName, Consumer<String> consumer) {
try (BufferedReader br = new BufferedReader(
new InputStreamReader(inputStream, charsetName))) {
for (String line = br.readLine(); line != null;
line = br.readLine())
consumer.accept(line);
} catch (IOException e) {
JMExceptionManager.handleExceptionAndThrowRuntimeEx(log, e,
"consumeInputStream", inputStream, charsetName, consumer);
}
} | [
"public",
"static",
"void",
"consumeInputStream",
"(",
"InputStream",
"inputStream",
",",
"String",
"charsetName",
",",
"Consumer",
"<",
"String",
">",
"consumer",
")",
"{",
"try",
"(",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStre... | Consume input stream.
@param inputStream the input stream
@param charsetName the charset name
@param consumer the consumer | [
"Consume",
"input",
"stream",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMInputStream.java#L100-L111 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java | SDValidation.validateFloatingPoint | protected static void validateFloatingPoint(String opName, SDVariable v) {
"""
Validate that the operation is being applied on an floating point type SDVariable
@param opName Operation name to print in the exception
@param v Variable to validate datatype for (input to operation)
"""
if (v == null)
return;
if (!v.dataType().isFPType())
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-floating point data type " + v.dataType());
} | java | protected static void validateFloatingPoint(String opName, SDVariable v) {
if (v == null)
return;
if (!v.dataType().isFPType())
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-floating point data type " + v.dataType());
} | [
"protected",
"static",
"void",
"validateFloatingPoint",
"(",
"String",
"opName",
",",
"SDVariable",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"return",
";",
"if",
"(",
"!",
"v",
".",
"dataType",
"(",
")",
".",
"isFPType",
"(",
")",
")",
"thro... | Validate that the operation is being applied on an floating point type SDVariable
@param opName Operation name to print in the exception
@param v Variable to validate datatype for (input to operation) | [
"Validate",
"that",
"the",
"operation",
"is",
"being",
"applied",
"on",
"an",
"floating",
"point",
"type",
"SDVariable"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L90-L95 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaBindTextureToArray | public static int cudaBindTextureToArray(textureReference texref, cudaArray array, cudaChannelFormatDesc desc) {
"""
[C++ API] Binds an array to a texture
<pre>
template < class T, int dim, enum cudaTextureReadMode readMode >
cudaError_t cudaBindTextureToArray (
const texture < T,
dim,
readMode > & tex,
cudaArray_const_t array,
const cudaChannelFormatDesc& desc ) [inline]
</pre>
<div>
<p>[C++ API] Binds an array to a texture
Binds the CUDA array <tt>array</tt> to the texture reference <tt>tex</tt>. <tt>desc</tt> describes how the memory is interpreted when
fetching values from the texture. Any CUDA array previously bound to
<tt>tex</tt> is unbound.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param texref Texture to bind
@param array Memory array on device
@param desc Channel format
@param tex Texture to bind
@param array Memory array on device
@param tex Texture to bind
@param array Memory array on device
@param desc Channel format
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer,
cudaErrorInvalidTexture
@see JCuda#cudaCreateChannelDesc
@see JCuda#cudaGetChannelDesc
@see JCuda#cudaGetTextureReference
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaUnbindTexture
@see JCuda#cudaGetTextureAlignmentOffset
"""
return checkResult(cudaBindTextureToArrayNative(texref, array, desc));
} | java | public static int cudaBindTextureToArray(textureReference texref, cudaArray array, cudaChannelFormatDesc desc)
{
return checkResult(cudaBindTextureToArrayNative(texref, array, desc));
} | [
"public",
"static",
"int",
"cudaBindTextureToArray",
"(",
"textureReference",
"texref",
",",
"cudaArray",
"array",
",",
"cudaChannelFormatDesc",
"desc",
")",
"{",
"return",
"checkResult",
"(",
"cudaBindTextureToArrayNative",
"(",
"texref",
",",
"array",
",",
"desc",
... | [C++ API] Binds an array to a texture
<pre>
template < class T, int dim, enum cudaTextureReadMode readMode >
cudaError_t cudaBindTextureToArray (
const texture < T,
dim,
readMode > & tex,
cudaArray_const_t array,
const cudaChannelFormatDesc& desc ) [inline]
</pre>
<div>
<p>[C++ API] Binds an array to a texture
Binds the CUDA array <tt>array</tt> to the texture reference <tt>tex</tt>. <tt>desc</tt> describes how the memory is interpreted when
fetching values from the texture. Any CUDA array previously bound to
<tt>tex</tt> is unbound.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param texref Texture to bind
@param array Memory array on device
@param desc Channel format
@param tex Texture to bind
@param array Memory array on device
@param tex Texture to bind
@param array Memory array on device
@param desc Channel format
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer,
cudaErrorInvalidTexture
@see JCuda#cudaCreateChannelDesc
@see JCuda#cudaGetChannelDesc
@see JCuda#cudaGetTextureReference
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTexture2D
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaBindTextureToArray
@see JCuda#cudaUnbindTexture
@see JCuda#cudaGetTextureAlignmentOffset | [
"[",
"C",
"++",
"API",
"]",
"Binds",
"an",
"array",
"to",
"a",
"texture"
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L9209-L9212 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java | ZipInputStream.get32 | private static final long get32(byte b[], int off) {
"""
/*
Fetches unsigned 32-bit value from byte array at specified offset.
The bytes are assumed to be in Intel (little-endian) byte order.
"""
return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL;
} | java | private static final long get32(byte b[], int off) {
return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL;
} | [
"private",
"static",
"final",
"long",
"get32",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
")",
"{",
"return",
"(",
"get16",
"(",
"b",
",",
"off",
")",
"|",
"(",
"(",
"long",
")",
"get16",
"(",
"b",
",",
"off",
"+",
"2",
")",
"<<",
"16",
... | /*
Fetches unsigned 32-bit value from byte array at specified offset.
The bytes are assumed to be in Intel (little-endian) byte order. | [
"/",
"*",
"Fetches",
"unsigned",
"32",
"-",
"bit",
"value",
"from",
"byte",
"array",
"at",
"specified",
"offset",
".",
"The",
"bytes",
"are",
"assumed",
"to",
"be",
"in",
"Intel",
"(",
"little",
"-",
"endian",
")",
"byte",
"order",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java#L454-L456 |
Red5/red5-server-common | src/main/java/org/red5/server/so/SharedObjectScope.java | SharedObjectScope.isWriteAllowed | protected boolean isWriteAllowed(String key, Object value) {
"""
Call handlers and check if writing to the SO is allowed.
@param key
key
@param value
value
@return is write allowed
"""
// check internal handlers first
for (ISharedObjectSecurity handler : securityHandlers) {
if (!handler.isWriteAllowed(this, key, value)) {
return false;
}
}
// check global SO handlers next
final Set<ISharedObjectSecurity> handlers = getSecurityHandlers();
if (handlers == null) {
return true;
}
for (ISharedObjectSecurity handler : handlers) {
if (!handler.isWriteAllowed(this, key, value)) {
return false;
}
}
return true;
} | java | protected boolean isWriteAllowed(String key, Object value) {
// check internal handlers first
for (ISharedObjectSecurity handler : securityHandlers) {
if (!handler.isWriteAllowed(this, key, value)) {
return false;
}
}
// check global SO handlers next
final Set<ISharedObjectSecurity> handlers = getSecurityHandlers();
if (handlers == null) {
return true;
}
for (ISharedObjectSecurity handler : handlers) {
if (!handler.isWriteAllowed(this, key, value)) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"isWriteAllowed",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"// check internal handlers first\r",
"for",
"(",
"ISharedObjectSecurity",
"handler",
":",
"securityHandlers",
")",
"{",
"if",
"(",
"!",
"handler",
".",
"isWriteAllowed... | Call handlers and check if writing to the SO is allowed.
@param key
key
@param value
value
@return is write allowed | [
"Call",
"handlers",
"and",
"check",
"if",
"writing",
"to",
"the",
"SO",
"is",
"allowed",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/SharedObjectScope.java#L529-L547 |
tango-controls/JTango | server/src/main/java/org/tango/server/events/EventManager.java | EventManager.checkEventCriteria | public static void checkEventCriteria(final AttributeImpl attribute, final EventType eventType) throws DevFailed {
"""
Check if event criteria are set for change and archive events
@param attribute the specified attribute
@param eventType the specified event type
@throws DevFailed if event type is change or archive and no event criteria is set.
"""
switch (eventType) {
case CHANGE_EVENT:
ChangeEventTrigger.checkEventCriteria(attribute);
break;
case ARCHIVE_EVENT:
ArchiveEventTrigger.checkEventCriteria(attribute);
break;
default:
break;
}
} | java | public static void checkEventCriteria(final AttributeImpl attribute, final EventType eventType) throws DevFailed {
switch (eventType) {
case CHANGE_EVENT:
ChangeEventTrigger.checkEventCriteria(attribute);
break;
case ARCHIVE_EVENT:
ArchiveEventTrigger.checkEventCriteria(attribute);
break;
default:
break;
}
} | [
"public",
"static",
"void",
"checkEventCriteria",
"(",
"final",
"AttributeImpl",
"attribute",
",",
"final",
"EventType",
"eventType",
")",
"throws",
"DevFailed",
"{",
"switch",
"(",
"eventType",
")",
"{",
"case",
"CHANGE_EVENT",
":",
"ChangeEventTrigger",
".",
"ch... | Check if event criteria are set for change and archive events
@param attribute the specified attribute
@param eventType the specified event type
@throws DevFailed if event type is change or archive and no event criteria is set. | [
"Check",
"if",
"event",
"criteria",
"are",
"set",
"for",
"change",
"and",
"archive",
"events"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventManager.java#L137-L148 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java | JRDF.sameNode | public static boolean sameNode(Node n1, Node n2) {
"""
Tells whether the given nodes are equivalent.
<p>
Nodes are equivalent if they are both resources or both literals and they
match according to the rules of those types.
@param n1
first node.
@param n2
second node.
@return true if equivalent, false otherwise.
"""
if (n1 instanceof URIReference && n2 instanceof URIReference) {
return sameResource((URIReference) n1, (URIReference) n2);
} else if (n1 instanceof Literal && n2 instanceof Literal) {
return sameLiteral((Literal) n1, (Literal) n2);
} else {
return false;
}
} | java | public static boolean sameNode(Node n1, Node n2) {
if (n1 instanceof URIReference && n2 instanceof URIReference) {
return sameResource((URIReference) n1, (URIReference) n2);
} else if (n1 instanceof Literal && n2 instanceof Literal) {
return sameLiteral((Literal) n1, (Literal) n2);
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"sameNode",
"(",
"Node",
"n1",
",",
"Node",
"n2",
")",
"{",
"if",
"(",
"n1",
"instanceof",
"URIReference",
"&&",
"n2",
"instanceof",
"URIReference",
")",
"{",
"return",
"sameResource",
"(",
"(",
"URIReference",
")",
"n1",
","... | Tells whether the given nodes are equivalent.
<p>
Nodes are equivalent if they are both resources or both literals and they
match according to the rules of those types.
@param n1
first node.
@param n2
second node.
@return true if equivalent, false otherwise. | [
"Tells",
"whether",
"the",
"given",
"nodes",
"are",
"equivalent",
".",
"<p",
">",
"Nodes",
"are",
"equivalent",
"if",
"they",
"are",
"both",
"resources",
"or",
"both",
"literals",
"and",
"they",
"match",
"according",
"to",
"the",
"rules",
"of",
"those",
"t... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L35-L43 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/function/Bounds.java | Bounds.transformFromUnitInterval | public double transformFromUnitInterval(int i, double d) {
"""
Maps d \in [0,1] to transformed(d), such that
transformed(d) \in [A[i], B[i]]. The transform is
just a linear one. It does *NOT* check for +/- infinity.
"""
return (B[i]-A[i])*(d-1.0)+B[i];
} | java | public double transformFromUnitInterval(int i, double d){
return (B[i]-A[i])*(d-1.0)+B[i];
} | [
"public",
"double",
"transformFromUnitInterval",
"(",
"int",
"i",
",",
"double",
"d",
")",
"{",
"return",
"(",
"B",
"[",
"i",
"]",
"-",
"A",
"[",
"i",
"]",
")",
"*",
"(",
"d",
"-",
"1.0",
")",
"+",
"B",
"[",
"i",
"]",
";",
"}"
] | Maps d \in [0,1] to transformed(d), such that
transformed(d) \in [A[i], B[i]]. The transform is
just a linear one. It does *NOT* check for +/- infinity. | [
"Maps",
"d",
"\\",
"in",
"[",
"0",
"1",
"]",
"to",
"transformed",
"(",
"d",
")",
"such",
"that",
"transformed",
"(",
"d",
")",
"\\",
"in",
"[",
"A",
"[",
"i",
"]",
"B",
"[",
"i",
"]]",
".",
"The",
"transform",
"is",
"just",
"a",
"linear",
"on... | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/Bounds.java#L82-L84 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java | BeanBox.injectMethod | public BeanBox injectMethod(String methodName, Object... configs) {
"""
This is Java configuration method equal to put @INJECT on a class's method, a
usage example: injectMethod("setName", String.class, JBEANBOX.value("Sam"));
"""
checkOrCreateMethodInjects();
Class<?>[] paramTypes = new Class<?>[configs.length / 2];
BeanBox[] params = new BeanBox[configs.length / 2];
int mid = configs.length / 2;
for (int i = 0; i < mid; i++)
paramTypes[i] = (Class<?>) configs[i];
for (int i = mid; i < configs.length; i++) {
params[i - mid] = BeanBoxUtils.wrapParamToBox(configs[i]);
params[i - mid].setType(paramTypes[i - mid]);
}
Method m = ReflectionUtils.findMethod(beanClass, methodName, paramTypes);
if (m != null)
ReflectionUtils.makeAccessible(m);
this.getMethodInjects().put(m, params);
return this;
} | java | public BeanBox injectMethod(String methodName, Object... configs) {
checkOrCreateMethodInjects();
Class<?>[] paramTypes = new Class<?>[configs.length / 2];
BeanBox[] params = new BeanBox[configs.length / 2];
int mid = configs.length / 2;
for (int i = 0; i < mid; i++)
paramTypes[i] = (Class<?>) configs[i];
for (int i = mid; i < configs.length; i++) {
params[i - mid] = BeanBoxUtils.wrapParamToBox(configs[i]);
params[i - mid].setType(paramTypes[i - mid]);
}
Method m = ReflectionUtils.findMethod(beanClass, methodName, paramTypes);
if (m != null)
ReflectionUtils.makeAccessible(m);
this.getMethodInjects().put(m, params);
return this;
} | [
"public",
"BeanBox",
"injectMethod",
"(",
"String",
"methodName",
",",
"Object",
"...",
"configs",
")",
"{",
"checkOrCreateMethodInjects",
"(",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"configs",
... | This is Java configuration method equal to put @INJECT on a class's method, a
usage example: injectMethod("setName", String.class, JBEANBOX.value("Sam")); | [
"This",
"is",
"Java",
"configuration",
"method",
"equal",
"to",
"put"
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java#L208-L224 |
structr/structr | structr-core/src/main/java/org/structr/core/Services.java | Services.parseInt | public static int parseInt(String value, int defaultValue) {
"""
Tries to parse the given String to an int value, returning
defaultValue on error.
@param value the source String to parse
@param defaultValue the default value that will be returned when parsing fails
@return the parsed value or the given default value when parsing fails
"""
if (StringUtils.isBlank(value)) {
return defaultValue;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException ignore) {}
return defaultValue;
} | java | public static int parseInt(String value, int defaultValue) {
if (StringUtils.isBlank(value)) {
return defaultValue;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException ignore) {}
return defaultValue;
} | [
"public",
"static",
"int",
"parseInt",
"(",
"String",
"value",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"try",
"{",
"return",
"Integer",
".",
"parseIn... | Tries to parse the given String to an int value, returning
defaultValue on error.
@param value the source String to parse
@param defaultValue the default value that will be returned when parsing fails
@return the parsed value or the given default value when parsing fails | [
"Tries",
"to",
"parse",
"the",
"given",
"String",
"to",
"an",
"int",
"value",
"returning",
"defaultValue",
"on",
"error",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/Services.java#L760-L771 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.postWithRegEx | public RouteMatcher postWithRegEx(String regex, Handler<HttpServerRequest> handler) {
"""
Specify a handler that will be called for a matching HTTP POST
@param regex A regular expression
@param handler The handler to call
"""
addRegEx(regex, handler, postBindings);
return this;
} | java | public RouteMatcher postWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, postBindings);
return this;
} | [
"public",
"RouteMatcher",
"postWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"postBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP POST
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"POST"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L229-L232 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_dashboard_dashboardId_GET | public OvhDashboard serviceName_output_graylog_dashboard_dashboardId_GET(String serviceName, String dashboardId) throws IOException {
"""
Returns details of specified graylog dashboard
REST: GET /dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}
@param serviceName [required] Service name
@param dashboardId [required] Dashboard ID
"""
String qPath = "/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}";
StringBuilder sb = path(qPath, serviceName, dashboardId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDashboard.class);
} | java | public OvhDashboard serviceName_output_graylog_dashboard_dashboardId_GET(String serviceName, String dashboardId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}";
StringBuilder sb = path(qPath, serviceName, dashboardId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDashboard.class);
} | [
"public",
"OvhDashboard",
"serviceName_output_graylog_dashboard_dashboardId_GET",
"(",
"String",
"serviceName",
",",
"String",
"dashboardId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}\"",
";",
"S... | Returns details of specified graylog dashboard
REST: GET /dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}
@param serviceName [required] Service name
@param dashboardId [required] Dashboard ID | [
"Returns",
"details",
"of",
"specified",
"graylog",
"dashboard"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1149-L1154 |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.optionalLongAttribute | public static long optionalLongAttribute(
final XMLStreamReader reader,
final String localName,
final long defaultValue) {
"""
Returns the value of an attribute as a long. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty.
"""
return optionalLongAttribute(reader, null, localName, defaultValue);
} | java | public static long optionalLongAttribute(
final XMLStreamReader reader,
final String localName,
final long defaultValue) {
return optionalLongAttribute(reader, null, localName, defaultValue);
} | [
"public",
"static",
"long",
"optionalLongAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"localName",
",",
"final",
"long",
"defaultValue",
")",
"{",
"return",
"optionalLongAttribute",
"(",
"reader",
",",
"null",
",",
"localName",
",... | Returns the value of an attribute as a long. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty. | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"as",
"a",
"long",
".",
"If",
"the",
"attribute",
"is",
"empty",
"this",
"method",
"returns",
"the",
"default",
"value",
"provided",
"."
] | train | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L842-L847 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/schema/api/AbstractSchemaManager.java | AbstractSchemaManager.exportSchema | protected void exportSchema(final String persistenceUnit, List<TableInfo> tables) {
"""
Export schema handles the handleOperation method.
@param hbase
"""
// Get persistence unit metadata
this.puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
String paramString = externalProperties != null ? (String) externalProperties
.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
if (clientFactory != null
&& ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty(
PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory
.equalsIgnoreCase(paramString))))
{
readConfigProperties(puMetadata);
// invoke handle operation.
if (operation != null && initiateClient())
{
tableInfos = tables;
handleOperations(tables);
}
}
} | java | protected void exportSchema(final String persistenceUnit, List<TableInfo> tables)
{
// Get persistence unit metadata
this.puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
String paramString = externalProperties != null ? (String) externalProperties
.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
if (clientFactory != null
&& ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty(
PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory
.equalsIgnoreCase(paramString))))
{
readConfigProperties(puMetadata);
// invoke handle operation.
if (operation != null && initiateClient())
{
tableInfos = tables;
handleOperations(tables);
}
}
} | [
"protected",
"void",
"exportSchema",
"(",
"final",
"String",
"persistenceUnit",
",",
"List",
"<",
"TableInfo",
">",
"tables",
")",
"{",
"// Get persistence unit metadata",
"this",
".",
"puMetadata",
"=",
"kunderaMetadata",
".",
"getApplicationMetadata",
"(",
")",
".... | Export schema handles the handleOperation method.
@param hbase | [
"Export",
"schema",
"handles",
"the",
"handleOperation",
"method",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/schema/api/AbstractSchemaManager.java#L98-L118 |
rythmengine/rythmengine | src/main/java/org/rythmengine/template/TemplateBase.java | TemplateBase.__getAs | protected final <T> T __getAs(String name, Class<T> c) {
"""
Get render arg and do type cast to the class specified
@param name
@param c
@param <T>
@return a render argument
"""
Object o = __getRenderArg(name);
if (null == o) return null;
return (T) o;
} | java | protected final <T> T __getAs(String name, Class<T> c) {
Object o = __getRenderArg(name);
if (null == o) return null;
return (T) o;
} | [
"protected",
"final",
"<",
"T",
">",
"T",
"__getAs",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"Object",
"o",
"=",
"__getRenderArg",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"o",
")",
"return",
"null",
";",
"return... | Get render arg and do type cast to the class specified
@param name
@param c
@param <T>
@return a render argument | [
"Get",
"render",
"arg",
"and",
"do",
"type",
"cast",
"to",
"the",
"class",
"specified"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L1065-L1069 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/parsers/ImageParser.java | ImageParser.parseBase64 | public static Document parseBase64(String base64Data, Element instruction)
throws Exception {
"""
/*
Parse a string of base64 encoded image data. 2011-09-08 PwD
"""
byte[] imageData = Base64.decodeBase64(base64Data);
ByteArrayInputStream bais = new ByteArrayInputStream(imageData);
StringWriter swLogger = new StringWriter();
PrintWriter pwLogger = new PrintWriter(swLogger);
return parse(bais, instruction, pwLogger);
} | java | public static Document parseBase64(String base64Data, Element instruction)
throws Exception {
byte[] imageData = Base64.decodeBase64(base64Data);
ByteArrayInputStream bais = new ByteArrayInputStream(imageData);
StringWriter swLogger = new StringWriter();
PrintWriter pwLogger = new PrintWriter(swLogger);
return parse(bais, instruction, pwLogger);
} | [
"public",
"static",
"Document",
"parseBase64",
"(",
"String",
"base64Data",
",",
"Element",
"instruction",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"imageData",
"=",
"Base64",
".",
"decodeBase64",
"(",
"base64Data",
")",
";",
"ByteArrayInputStream",
"b... | /*
Parse a string of base64 encoded image data. 2011-09-08 PwD | [
"/",
"*",
"Parse",
"a",
"string",
"of",
"base64",
"encoded",
"image",
"data",
".",
"2011",
"-",
"09",
"-",
"08",
"PwD"
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/ImageParser.java#L707-L714 |
flow/commons | src/main/java/com/flowpowered/commons/datatable/delta/DeltaMap.java | DeltaMap.get | @Override
public <T extends Serializable> T get(Object key, T defaultValue) {
"""
- If we clear this map, the type changes to REPLACE and all elements are cleared
"""
throw new UnsupportedOperationException("DeltaMap must only be read in bulk.");
} | java | @Override
public <T extends Serializable> T get(Object key, T defaultValue) {
throw new UnsupportedOperationException("DeltaMap must only be read in bulk.");
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"Serializable",
">",
"T",
"get",
"(",
"Object",
"key",
",",
"T",
"defaultValue",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"DeltaMap must only be read in bulk.\"",
")",
";",
"}"
] | - If we clear this map, the type changes to REPLACE and all elements are cleared | [
"-",
"If",
"we",
"clear",
"this",
"map",
"the",
"type",
"changes",
"to",
"REPLACE",
"and",
"all",
"elements",
"are",
"cleared"
] | train | https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/datatable/delta/DeltaMap.java#L96-L99 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.writeSilence | @Override
public void writeSilence(ControlSilence m) {
"""
Writes a range of Silence from a ControlSilence message to the stream
@param m The ControlSilence message
@exception Thrown from writeRange, handleNewGap
and checkForWindowAdvanceGaps
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
// Construct a TickRange from the Silence message
TickRange tr =
new TickRange(TickRange.Completed, m.getStartTick(), m.getEndTick());
writeSilenceInternal(tr, false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
} | java | @Override
public void writeSilence(ControlSilence m)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
// Construct a TickRange from the Silence message
TickRange tr =
new TickRange(TickRange.Completed, m.getStartTick(), m.getEndTick());
writeSilenceInternal(tr, false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
} | [
"@",
"Override",
"public",
"void",
"writeSilence",
"(",
"ControlSilence",
"m",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
"... | Writes a range of Silence from a ControlSilence message to the stream
@param m The ControlSilence message
@exception Thrown from writeRange, handleNewGap
and checkForWindowAdvanceGaps | [
"Writes",
"a",
"range",
"of",
"Silence",
"from",
"a",
"ControlSilence",
"message",
"to",
"the",
"stream"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L782-L797 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/ArrayDrawable.java | ArrayDrawable.setDrawable | @Nullable
public Drawable setDrawable(int index, @Nullable Drawable drawable) {
"""
Sets a new drawable at the specified index, and return the previous drawable, if any.
"""
Preconditions.checkArgument(index >= 0);
Preconditions.checkArgument(index < mLayers.length);
final Drawable oldDrawable = mLayers[index];
if (drawable != oldDrawable) {
if (drawable != null && mIsMutated) {
drawable.mutate();
}
DrawableUtils.setCallbacks(mLayers[index], null, null);
DrawableUtils.setCallbacks(drawable, null, null);
DrawableUtils.setDrawableProperties(drawable, mDrawableProperties);
DrawableUtils.copyProperties(drawable, this);
DrawableUtils.setCallbacks(drawable, this, this);
mIsStatefulCalculated = false;
mLayers[index] = drawable;
invalidateSelf();
}
return oldDrawable;
} | java | @Nullable
public Drawable setDrawable(int index, @Nullable Drawable drawable) {
Preconditions.checkArgument(index >= 0);
Preconditions.checkArgument(index < mLayers.length);
final Drawable oldDrawable = mLayers[index];
if (drawable != oldDrawable) {
if (drawable != null && mIsMutated) {
drawable.mutate();
}
DrawableUtils.setCallbacks(mLayers[index], null, null);
DrawableUtils.setCallbacks(drawable, null, null);
DrawableUtils.setDrawableProperties(drawable, mDrawableProperties);
DrawableUtils.copyProperties(drawable, this);
DrawableUtils.setCallbacks(drawable, this, this);
mIsStatefulCalculated = false;
mLayers[index] = drawable;
invalidateSelf();
}
return oldDrawable;
} | [
"@",
"Nullable",
"public",
"Drawable",
"setDrawable",
"(",
"int",
"index",
",",
"@",
"Nullable",
"Drawable",
"drawable",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"index",
">=",
"0",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"index",
... | Sets a new drawable at the specified index, and return the previous drawable, if any. | [
"Sets",
"a",
"new",
"drawable",
"at",
"the",
"specified",
"index",
"and",
"return",
"the",
"previous",
"drawable",
"if",
"any",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/ArrayDrawable.java#L83-L103 |
integration-technology/amazon-mws-orders | src/main/java/com/amazonservices/mws/client/MwsAQCall.java | MwsAQCall.execute | @Override
public MwsResponse execute() {
"""
Perform a synchronous call with no retry or error handling.
@return
"""
HttpPost request = createRequest();
try {
HttpResponse hr = executeRequest(request);
StatusLine statusLine = hr.getStatusLine();
int status = statusLine.getStatusCode();
String message = statusLine.getReasonPhrase();
rhmd = getResponseHeaderMetadata(hr);
String body = getResponseBody(hr);
MwsResponse response = new MwsResponse(status,message,rhmd,body);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
request.releaseConnection();
}
} | java | @Override
public MwsResponse execute() {
HttpPost request = createRequest();
try {
HttpResponse hr = executeRequest(request);
StatusLine statusLine = hr.getStatusLine();
int status = statusLine.getStatusCode();
String message = statusLine.getReasonPhrase();
rhmd = getResponseHeaderMetadata(hr);
String body = getResponseBody(hr);
MwsResponse response = new MwsResponse(status,message,rhmd,body);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
request.releaseConnection();
}
} | [
"@",
"Override",
"public",
"MwsResponse",
"execute",
"(",
")",
"{",
"HttpPost",
"request",
"=",
"createRequest",
"(",
")",
";",
"try",
"{",
"HttpResponse",
"hr",
"=",
"executeRequest",
"(",
"request",
")",
";",
"StatusLine",
"statusLine",
"=",
"hr",
".",
"... | Perform a synchronous call with no retry or error handling.
@return | [
"Perform",
"a",
"synchronous",
"call",
"with",
"no",
"retry",
"or",
"error",
"handling",
"."
] | train | https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L269-L286 |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/authentication/configuration/LdapConfiguration.java | LdapConfiguration.ldapAuthenticationFilter | @Bean
public FilterRegistrationBean<LdapAuthenticationFilter> ldapAuthenticationFilter(final LdapProperties ldapProperties,
final LdapConnectionFactory ldapConnectionFactory) {
"""
Add an authentication filter to the web application context if edison.ldap property is set to {@code enabled}'.
All routes starting with the value of the {@code edison.ldap.prefix} property will be secured by LDAP. If no
property is set this will default to all routes starting with '/internal'.
@param ldapProperties the properties used to configure LDAP
@param ldapConnectionFactory the connection factory used to build the LdapAuthenticationFilter
@return FilterRegistrationBean
"""
FilterRegistrationBean<LdapAuthenticationFilter> filterRegistration = new FilterRegistrationBean<>();
filterRegistration.setFilter(new LdapAuthenticationFilter(ldapProperties, ldapConnectionFactory));
filterRegistration.setOrder(Ordered.LOWEST_PRECEDENCE - 1);
ldapProperties.getPrefixes().forEach(prefix -> filterRegistration.addUrlPatterns(String.format("%s/*", prefix)));
return filterRegistration;
} | java | @Bean
public FilterRegistrationBean<LdapAuthenticationFilter> ldapAuthenticationFilter(final LdapProperties ldapProperties,
final LdapConnectionFactory ldapConnectionFactory) {
FilterRegistrationBean<LdapAuthenticationFilter> filterRegistration = new FilterRegistrationBean<>();
filterRegistration.setFilter(new LdapAuthenticationFilter(ldapProperties, ldapConnectionFactory));
filterRegistration.setOrder(Ordered.LOWEST_PRECEDENCE - 1);
ldapProperties.getPrefixes().forEach(prefix -> filterRegistration.addUrlPatterns(String.format("%s/*", prefix)));
return filterRegistration;
} | [
"@",
"Bean",
"public",
"FilterRegistrationBean",
"<",
"LdapAuthenticationFilter",
">",
"ldapAuthenticationFilter",
"(",
"final",
"LdapProperties",
"ldapProperties",
",",
"final",
"LdapConnectionFactory",
"ldapConnectionFactory",
")",
"{",
"FilterRegistrationBean",
"<",
"LdapA... | Add an authentication filter to the web application context if edison.ldap property is set to {@code enabled}'.
All routes starting with the value of the {@code edison.ldap.prefix} property will be secured by LDAP. If no
property is set this will default to all routes starting with '/internal'.
@param ldapProperties the properties used to configure LDAP
@param ldapConnectionFactory the connection factory used to build the LdapAuthenticationFilter
@return FilterRegistrationBean | [
"Add",
"an",
"authentication",
"filter",
"to",
"the",
"web",
"application",
"context",
"if",
"edison",
".",
"ldap",
"property",
"is",
"set",
"to",
"{",
"@code",
"enabled",
"}",
".",
"All",
"routes",
"starting",
"with",
"the",
"value",
"of",
"the",
"{",
"... | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/authentication/configuration/LdapConfiguration.java#L52-L60 |
aws/aws-sdk-java | aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/GetPlaybackConfigurationResult.java | GetPlaybackConfigurationResult.withTags | public GetPlaybackConfigurationResult withTags(java.util.Map<String, String> tags) {
"""
<p>
The tags assigned to the playback configuration.
</p>
@param tags
The tags assigned to the playback configuration.
@return Returns a reference to this object so that method calls can be chained together.
"""
setTags(tags);
return this;
} | java | public GetPlaybackConfigurationResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"GetPlaybackConfigurationResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags assigned to the playback configuration.
</p>
@param tags
The tags assigned to the playback configuration.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"assigned",
"to",
"the",
"playback",
"configuration",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/GetPlaybackConfigurationResult.java#L555-L558 |
fuinorg/utils4swing | src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java | ThreadSafeJOptionPane.showInputDialog | public static String showInputDialog(final Component parentComponent, final Object message) {
"""
Shows a question-message dialog requesting input from the user parented
to <code>parentComponent</code>. The dialog is displayed on top of the
<code>Component</code>'s frame, and is usually positioned below the
<code>Component</code>.
@param parentComponent
the parent <code>Component</code> for the dialog
@param message
the <code>Object</code> to display
@return user's input, or <code>null</code> meaning the user canceled the
input
"""
return execute(new StringOptionPane() {
public void show(final StringResult result) {
result.setResult(JOptionPane.showInputDialog(parentComponent, message));
}
});
} | java | public static String showInputDialog(final Component parentComponent, final Object message) {
return execute(new StringOptionPane() {
public void show(final StringResult result) {
result.setResult(JOptionPane.showInputDialog(parentComponent, message));
}
});
} | [
"public",
"static",
"String",
"showInputDialog",
"(",
"final",
"Component",
"parentComponent",
",",
"final",
"Object",
"message",
")",
"{",
"return",
"execute",
"(",
"new",
"StringOptionPane",
"(",
")",
"{",
"public",
"void",
"show",
"(",
"final",
"StringResult"... | Shows a question-message dialog requesting input from the user parented
to <code>parentComponent</code>. The dialog is displayed on top of the
<code>Component</code>'s frame, and is usually positioned below the
<code>Component</code>.
@param parentComponent
the parent <code>Component</code> for the dialog
@param message
the <code>Object</code> to display
@return user's input, or <code>null</code> meaning the user canceled the
input | [
"Shows",
"a",
"question",
"-",
"message",
"dialog",
"requesting",
"input",
"from",
"the",
"user",
"parented",
"to",
"<code",
">",
"parentComponent<",
"/",
"code",
">",
".",
"The",
"dialog",
"is",
"displayed",
"on",
"top",
"of",
"the",
"<code",
">",
"Compon... | train | https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java#L252-L260 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readSiblings | public List<CmsResource> readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter)
throws CmsException {
"""
Returns a List of all siblings of the specified resource,
the specified resource being always part of the result set.<p>
The result is a list of <code>{@link CmsResource}</code> objects.<p>
@param dbc the current database context
@param resource the resource to read the siblings for
@param filter a filter object
@return a list of <code>{@link CmsResource}</code> Objects that
are siblings to the specified resource,
including the specified resource itself
@throws CmsException if something goes wrong
"""
List<CmsResource> siblings = getVfsDriver(
dbc).readSiblings(dbc, dbc.currentProject().getUuid(), resource, filter.includeDeleted());
// important: there is no permission check done on the returned list of siblings
// this is because of possible issues with the "publish all siblings" option,
// moreover the user has read permission for the content through
// the selected sibling anyway
return updateContextDates(dbc, siblings, filter);
} | java | public List<CmsResource> readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter)
throws CmsException {
List<CmsResource> siblings = getVfsDriver(
dbc).readSiblings(dbc, dbc.currentProject().getUuid(), resource, filter.includeDeleted());
// important: there is no permission check done on the returned list of siblings
// this is because of possible issues with the "publish all siblings" option,
// moreover the user has read permission for the content through
// the selected sibling anyway
return updateContextDates(dbc, siblings, filter);
} | [
"public",
"List",
"<",
"CmsResource",
">",
"readSiblings",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsResource",
">",
"siblings",
"=",
"getVfsDriver",
"(",
... | Returns a List of all siblings of the specified resource,
the specified resource being always part of the result set.<p>
The result is a list of <code>{@link CmsResource}</code> objects.<p>
@param dbc the current database context
@param resource the resource to read the siblings for
@param filter a filter object
@return a list of <code>{@link CmsResource}</code> Objects that
are siblings to the specified resource,
including the specified resource itself
@throws CmsException if something goes wrong | [
"Returns",
"a",
"List",
"of",
"all",
"siblings",
"of",
"the",
"specified",
"resource",
"the",
"specified",
"resource",
"being",
"always",
"part",
"of",
"the",
"result",
"set",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7914-L7925 |
webjars/webjars-locator | src/main/java/org/webjars/RequireJS.java | RequireJS.getSetupJavaScript | public synchronized static String getSetupJavaScript(String cdnPrefix, String urlPrefix) {
"""
Returns the JavaScript that is used to setup the RequireJS config.
This value is cached in memory so that all of the processing to get the String only has to happen once.
@param urlPrefix The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/
@param cdnPrefix The optional CDN prefix where the WebJars can be downloaded from
@return The JavaScript block that can be embedded or loaded in a <script> tag
"""
if (requireConfigJavaScriptCdn == null) {
List<String> prefixes = new ArrayList<>();
prefixes.add(cdnPrefix);
prefixes.add(urlPrefix);
requireConfigJavaScriptCdn = generateSetupJavaScript(prefixes);
}
return requireConfigJavaScriptCdn;
} | java | public synchronized static String getSetupJavaScript(String cdnPrefix, String urlPrefix) {
if (requireConfigJavaScriptCdn == null) {
List<String> prefixes = new ArrayList<>();
prefixes.add(cdnPrefix);
prefixes.add(urlPrefix);
requireConfigJavaScriptCdn = generateSetupJavaScript(prefixes);
}
return requireConfigJavaScriptCdn;
} | [
"public",
"synchronized",
"static",
"String",
"getSetupJavaScript",
"(",
"String",
"cdnPrefix",
",",
"String",
"urlPrefix",
")",
"{",
"if",
"(",
"requireConfigJavaScriptCdn",
"==",
"null",
")",
"{",
"List",
"<",
"String",
">",
"prefixes",
"=",
"new",
"ArrayList"... | Returns the JavaScript that is used to setup the RequireJS config.
This value is cached in memory so that all of the processing to get the String only has to happen once.
@param urlPrefix The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/
@param cdnPrefix The optional CDN prefix where the WebJars can be downloaded from
@return The JavaScript block that can be embedded or loaded in a <script> tag | [
"Returns",
"the",
"JavaScript",
"that",
"is",
"used",
"to",
"setup",
"the",
"RequireJS",
"config",
".",
"This",
"value",
"is",
"cached",
"in",
"memory",
"so",
"that",
"all",
"of",
"the",
"processing",
"to",
"get",
"the",
"String",
"only",
"has",
"to",
"h... | train | https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L63-L72 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDateHeader | @Deprecated
public static Date getDateHeader(HttpMessage message, String name) throws ParseException {
"""
@deprecated Use {@link #getTimeMillis(CharSequence)} instead.
@see #getDateHeader(HttpMessage, CharSequence)
"""
return getDateHeader(message, (CharSequence) name);
} | java | @Deprecated
public static Date getDateHeader(HttpMessage message, String name) throws ParseException {
return getDateHeader(message, (CharSequence) name);
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDateHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
")",
"throws",
"ParseException",
"{",
"return",
"getDateHeader",
"(",
"message",
",",
"(",
"CharSequence",
")",
"name",
")",
";",
"}"
] | @deprecated Use {@link #getTimeMillis(CharSequence)} instead.
@see #getDateHeader(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L826-L829 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java | WidgetFactory.loadModel | public static GVRSceneObject loadModel(final GVRContext gvrContext,
final String modelFile) throws IOException {
"""
Load model from file
@param gvrContext Valid {@link GVRContext} instance
@param modelFile Path to the model's file, relative to the {@code assets} directory
@return root object The root {@link GVRSceneObject} of the model
@throws IOException If reading the model file fails
"""
return loadModel(gvrContext, modelFile, new HashMap<String, Integer>());
} | java | public static GVRSceneObject loadModel(final GVRContext gvrContext,
final String modelFile) throws IOException {
return loadModel(gvrContext, modelFile, new HashMap<String, Integer>());
} | [
"public",
"static",
"GVRSceneObject",
"loadModel",
"(",
"final",
"GVRContext",
"gvrContext",
",",
"final",
"String",
"modelFile",
")",
"throws",
"IOException",
"{",
"return",
"loadModel",
"(",
"gvrContext",
",",
"modelFile",
",",
"new",
"HashMap",
"<",
"String",
... | Load model from file
@param gvrContext Valid {@link GVRContext} instance
@param modelFile Path to the model's file, relative to the {@code assets} directory
@return root object The root {@link GVRSceneObject} of the model
@throws IOException If reading the model file fails | [
"Load",
"model",
"from",
"file"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L254-L257 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java | DisksInner.getByResourceGroup | public DiskInner getByResourceGroup(String resourceGroupName, String diskName) {
"""
Gets information about a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiskInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body();
} | java | public DiskInner getByResourceGroup(String resourceGroupName, String diskName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body();
} | [
"public",
"DiskInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(... | Gets information about a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiskInner object if successful. | [
"Gets",
"information",
"about",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L487-L489 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java | ClusterJoinManager.handleJoinRequest | public void handleJoinRequest(JoinRequest joinRequest, Connection connection) {
"""
Handle a {@link JoinRequestOp}. If this node is not master, reply with a {@link MasterResponseOp} to let the
joining node know the current master. Otherwise, if no other join is in progress, execute the {@link JoinRequest}
@param joinRequest the join request
@param connection the connection to the joining node
@see JoinRequestOp
"""
if (!ensureNodeIsReady()) {
return;
}
if (!ensureValidConfiguration(joinRequest)) {
return;
}
Address target = joinRequest.getAddress();
boolean isRequestFromCurrentMaster = target.equals(clusterService.getMasterAddress());
// if the join request from current master, do not send a master answer,
// because master can somehow dropped its connection and wants to join back
if (!clusterService.isMaster() && !isRequestFromCurrentMaster) {
sendMasterAnswer(target);
return;
}
if (joinInProgress) {
if (logger.isFineEnabled()) {
logger.fine(format("Join or membership claim is in progress, cannot handle join request from %s at the moment",
target));
}
return;
}
executeJoinRequest(joinRequest, connection);
} | java | public void handleJoinRequest(JoinRequest joinRequest, Connection connection) {
if (!ensureNodeIsReady()) {
return;
}
if (!ensureValidConfiguration(joinRequest)) {
return;
}
Address target = joinRequest.getAddress();
boolean isRequestFromCurrentMaster = target.equals(clusterService.getMasterAddress());
// if the join request from current master, do not send a master answer,
// because master can somehow dropped its connection and wants to join back
if (!clusterService.isMaster() && !isRequestFromCurrentMaster) {
sendMasterAnswer(target);
return;
}
if (joinInProgress) {
if (logger.isFineEnabled()) {
logger.fine(format("Join or membership claim is in progress, cannot handle join request from %s at the moment",
target));
}
return;
}
executeJoinRequest(joinRequest, connection);
} | [
"public",
"void",
"handleJoinRequest",
"(",
"JoinRequest",
"joinRequest",
",",
"Connection",
"connection",
")",
"{",
"if",
"(",
"!",
"ensureNodeIsReady",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"ensureValidConfiguration",
"(",
"joinRequest",
")... | Handle a {@link JoinRequestOp}. If this node is not master, reply with a {@link MasterResponseOp} to let the
joining node know the current master. Otherwise, if no other join is in progress, execute the {@link JoinRequest}
@param joinRequest the join request
@param connection the connection to the joining node
@see JoinRequestOp | [
"Handle",
"a",
"{",
"@link",
"JoinRequestOp",
"}",
".",
"If",
"this",
"node",
"is",
"not",
"master",
"reply",
"with",
"a",
"{",
"@link",
"MasterResponseOp",
"}",
"to",
"let",
"the",
"joining",
"node",
"know",
"the",
"current",
"master",
".",
"Otherwise",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L150-L176 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/utils/TermOccurrenceUtils.java | TermOccurrenceUtils.areOverlapping | public static boolean areOverlapping(TermOccurrence a, TermOccurrence b) {
"""
Returns true if two occurrences are in the same
document and their offsets overlap.
@param a
@param b
@return
"""
return a.getSourceDocument().equals(b.getSourceDocument()) && areOffsetsOverlapping(a, b);
} | java | public static boolean areOverlapping(TermOccurrence a, TermOccurrence b) {
return a.getSourceDocument().equals(b.getSourceDocument()) && areOffsetsOverlapping(a, b);
} | [
"public",
"static",
"boolean",
"areOverlapping",
"(",
"TermOccurrence",
"a",
",",
"TermOccurrence",
"b",
")",
"{",
"return",
"a",
".",
"getSourceDocument",
"(",
")",
".",
"equals",
"(",
"b",
".",
"getSourceDocument",
"(",
")",
")",
"&&",
"areOffsetsOverlapping... | Returns true if two occurrences are in the same
document and their offsets overlap.
@param a
@param b
@return | [
"Returns",
"true",
"if",
"two",
"occurrences",
"are",
"in",
"the",
"same",
"document",
"and",
"their",
"offsets",
"overlap",
"."
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/utils/TermOccurrenceUtils.java#L166-L168 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java | AbstractBinaryExternalMerger.mergeChannels | private ChannelWithMeta mergeChannels(List<ChannelWithMeta> channelIDs) throws IOException {
"""
Merges the sorted runs described by the given Channel IDs into a single sorted run.
@param channelIDs The IDs of the runs' channels.
@return The ID and number of blocks of the channel that describes the merged run.
"""
// the list with the target iterators
List<FileIOChannel> openChannels = new ArrayList<>(channelIDs.size());
final BinaryMergeIterator<Entry> mergeIterator =
getMergingIterator(channelIDs, openChannels);
// create a new channel writer
final FileIOChannel.ID mergedChannelID = ioManager.createChannel();
channelManager.addChannel(mergedChannelID);
AbstractChannelWriterOutputView output = null;
int numBytesInLastBlock;
int numBlocksWritten;
try {
output = FileChannelUtil.createOutputView(
ioManager, mergedChannelID, compressionEnable,
compressionCodecFactory, compressionBlockSize, pageSize);
writeMergingOutput(mergeIterator, output);
numBytesInLastBlock = output.close();
numBlocksWritten = output.getBlockCount();
} catch (IOException e) {
if (output != null) {
output.close();
output.getChannel().deleteChannel();
}
throw e;
}
// remove, close and delete channels
for (FileIOChannel channel : openChannels) {
channelManager.removeChannel(channel.getChannelID());
try {
channel.closeAndDelete();
} catch (Throwable ignored) {
}
}
return new ChannelWithMeta(mergedChannelID, numBlocksWritten, numBytesInLastBlock);
} | java | private ChannelWithMeta mergeChannels(List<ChannelWithMeta> channelIDs) throws IOException {
// the list with the target iterators
List<FileIOChannel> openChannels = new ArrayList<>(channelIDs.size());
final BinaryMergeIterator<Entry> mergeIterator =
getMergingIterator(channelIDs, openChannels);
// create a new channel writer
final FileIOChannel.ID mergedChannelID = ioManager.createChannel();
channelManager.addChannel(mergedChannelID);
AbstractChannelWriterOutputView output = null;
int numBytesInLastBlock;
int numBlocksWritten;
try {
output = FileChannelUtil.createOutputView(
ioManager, mergedChannelID, compressionEnable,
compressionCodecFactory, compressionBlockSize, pageSize);
writeMergingOutput(mergeIterator, output);
numBytesInLastBlock = output.close();
numBlocksWritten = output.getBlockCount();
} catch (IOException e) {
if (output != null) {
output.close();
output.getChannel().deleteChannel();
}
throw e;
}
// remove, close and delete channels
for (FileIOChannel channel : openChannels) {
channelManager.removeChannel(channel.getChannelID());
try {
channel.closeAndDelete();
} catch (Throwable ignored) {
}
}
return new ChannelWithMeta(mergedChannelID, numBlocksWritten, numBytesInLastBlock);
} | [
"private",
"ChannelWithMeta",
"mergeChannels",
"(",
"List",
"<",
"ChannelWithMeta",
">",
"channelIDs",
")",
"throws",
"IOException",
"{",
"// the list with the target iterators",
"List",
"<",
"FileIOChannel",
">",
"openChannels",
"=",
"new",
"ArrayList",
"<>",
"(",
"c... | Merges the sorted runs described by the given Channel IDs into a single sorted run.
@param channelIDs The IDs of the runs' channels.
@return The ID and number of blocks of the channel that describes the merged run. | [
"Merges",
"the",
"sorted",
"runs",
"described",
"by",
"the",
"given",
"Channel",
"IDs",
"into",
"a",
"single",
"sorted",
"run",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java#L160-L198 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST | public OvhTask organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST(String organizationName, String exchangeService, String primaryEmailAddress, Long quota) throws IOException {
"""
Create new archive mailbox
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive
@param quota [required] Archive mailbox quota (if not provided mailbox quota will be taken)
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param primaryEmailAddress [required] Default email for this mailbox
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "quota", quota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST(String organizationName, String exchangeService, String primaryEmailAddress, Long quota) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "quota", quota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"primaryEmailAddress",
",",
"Long",
"quota",
")",
"throws",
"IOException",
"{",
"String"... | Create new archive mailbox
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive
@param quota [required] Archive mailbox quota (if not provided mailbox quota will be taken)
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param primaryEmailAddress [required] Default email for this mailbox | [
"Create",
"new",
"archive",
"mailbox"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1577-L1584 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java | FactoryInterpolation.createPixelS | public static <T extends ImageGray<T>> InterpolatePixelS<T>
createPixelS(double min, double max, InterpolationType type, BorderType borderType, Class<T> imageType) {
"""
Creates an interpolation class of the specified type for the specified image type.
@param min Minimum possible pixel value. Inclusive.
@param max Maximum possible pixel value. Inclusive.
@param type Interpolation type
@param borderType Border type. If null then it will not be set here.
@param imageType Type of input image
@return Interpolation
"""
InterpolatePixelS<T> alg;
switch( type ) {
case NEAREST_NEIGHBOR:
alg = nearestNeighborPixelS(imageType);
break;
case BILINEAR:
return bilinearPixelS(imageType, borderType);
case BICUBIC:
alg = bicubicS(-0.5f, (float) min, (float) max, imageType);
break;
case POLYNOMIAL4:
alg = polynomialS(4, min, max, imageType);
break;
default:
throw new IllegalArgumentException("Add type: "+type);
}
if( borderType != null )
alg.setBorder(FactoryImageBorder.single(imageType, borderType));
return alg;
} | java | public static <T extends ImageGray<T>> InterpolatePixelS<T>
createPixelS(double min, double max, InterpolationType type, BorderType borderType, Class<T> imageType)
{
InterpolatePixelS<T> alg;
switch( type ) {
case NEAREST_NEIGHBOR:
alg = nearestNeighborPixelS(imageType);
break;
case BILINEAR:
return bilinearPixelS(imageType, borderType);
case BICUBIC:
alg = bicubicS(-0.5f, (float) min, (float) max, imageType);
break;
case POLYNOMIAL4:
alg = polynomialS(4, min, max, imageType);
break;
default:
throw new IllegalArgumentException("Add type: "+type);
}
if( borderType != null )
alg.setBorder(FactoryImageBorder.single(imageType, borderType));
return alg;
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"InterpolatePixelS",
"<",
"T",
">",
"createPixelS",
"(",
"double",
"min",
",",
"double",
"max",
",",
"InterpolationType",
"type",
",",
"BorderType",
"borderType",
",",
"Class",
"<",
... | Creates an interpolation class of the specified type for the specified image type.
@param min Minimum possible pixel value. Inclusive.
@param max Maximum possible pixel value. Inclusive.
@param type Interpolation type
@param borderType Border type. If null then it will not be set here.
@param imageType Type of input image
@return Interpolation | [
"Creates",
"an",
"interpolation",
"class",
"of",
"the",
"specified",
"type",
"for",
"the",
"specified",
"image",
"type",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java#L80-L108 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.isBetweenExclusive | public static long isBetweenExclusive (final long nValue,
final String sName,
final long nLowerBoundExclusive,
final long nUpperBoundExclusive) {
"""
Check if
<code>nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive</code>
@param nValue
Value
@param sName
Name
@param nLowerBoundExclusive
Lower bound
@param nUpperBoundExclusive
Upper bound
@return The value
"""
if (isEnabled ())
return isBetweenExclusive (nValue, () -> sName, nLowerBoundExclusive, nUpperBoundExclusive);
return nValue;
} | java | public static long isBetweenExclusive (final long nValue,
final String sName,
final long nLowerBoundExclusive,
final long nUpperBoundExclusive)
{
if (isEnabled ())
return isBetweenExclusive (nValue, () -> sName, nLowerBoundExclusive, nUpperBoundExclusive);
return nValue;
} | [
"public",
"static",
"long",
"isBetweenExclusive",
"(",
"final",
"long",
"nValue",
",",
"final",
"String",
"sName",
",",
"final",
"long",
"nLowerBoundExclusive",
",",
"final",
"long",
"nUpperBoundExclusive",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"ret... | Check if
<code>nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive</code>
@param nValue
Value
@param sName
Name
@param nLowerBoundExclusive
Lower bound
@param nUpperBoundExclusive
Upper bound
@return The value | [
"Check",
"if",
"<code",
">",
"nValue",
">",
";",
"nLowerBoundInclusive",
"&",
";",
"&",
";",
"nValue",
"<",
";",
"nUpperBoundInclusive<",
"/",
"code",
">"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2731-L2739 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.getLevenshteinDistance | public static int getLevenshteinDistance(String firstString, String secondString) {
"""
Compute the Levenshstein distance between two strings.
<p>Null string is assimilated to the empty string.
@param firstString first string.
@param secondString second string.
@return the Levenshstein distance.
@see "https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance"
"""
final String s0 = firstString == null ? "" : firstString; //$NON-NLS-1$
final String s1 = secondString == null ? "" : secondString; //$NON-NLS-1$
final int len0 = s0.length() + 1;
final int len1 = s1.length() + 1;
// the array of distances
int[] cost = new int[len0];
int[] newcost = new int[len0];
// initial cost of skipping prefix in String s0
for (int i = 0; i < len0; ++i) {
cost[i] = i;
}
// dynamically computing the array of distances
// transformation cost for each letter in s1
for (int j = 1; j < len1; ++j) {
// initial cost of skipping prefix in String s1
newcost[0] = j;
// transformation cost for each letter in s0
for (int i = 1; i < len0; ++i) {
// matching current letters in both strings
final int match = (s0.charAt(i - 1) == s1.charAt(j - 1)) ? 0 : 1;
// computing cost for each transformation
final int costReplace = cost[i - 1] + match;
final int costInsert = cost[i] + 1;
final int costDelete = newcost[i - 1] + 1;
// keep minimum cost
newcost[i] = Math.min(Math.min(costInsert, costDelete), costReplace);
}
// swap cost/newcost arrays
final int[] swap = cost;
cost = newcost;
newcost = swap;
}
// the distance is the cost for transforming all letters in both strings
return cost[len0 - 1];
} | java | public static int getLevenshteinDistance(String firstString, String secondString) {
final String s0 = firstString == null ? "" : firstString; //$NON-NLS-1$
final String s1 = secondString == null ? "" : secondString; //$NON-NLS-1$
final int len0 = s0.length() + 1;
final int len1 = s1.length() + 1;
// the array of distances
int[] cost = new int[len0];
int[] newcost = new int[len0];
// initial cost of skipping prefix in String s0
for (int i = 0; i < len0; ++i) {
cost[i] = i;
}
// dynamically computing the array of distances
// transformation cost for each letter in s1
for (int j = 1; j < len1; ++j) {
// initial cost of skipping prefix in String s1
newcost[0] = j;
// transformation cost for each letter in s0
for (int i = 1; i < len0; ++i) {
// matching current letters in both strings
final int match = (s0.charAt(i - 1) == s1.charAt(j - 1)) ? 0 : 1;
// computing cost for each transformation
final int costReplace = cost[i - 1] + match;
final int costInsert = cost[i] + 1;
final int costDelete = newcost[i - 1] + 1;
// keep minimum cost
newcost[i] = Math.min(Math.min(costInsert, costDelete), costReplace);
}
// swap cost/newcost arrays
final int[] swap = cost;
cost = newcost;
newcost = swap;
}
// the distance is the cost for transforming all letters in both strings
return cost[len0 - 1];
} | [
"public",
"static",
"int",
"getLevenshteinDistance",
"(",
"String",
"firstString",
",",
"String",
"secondString",
")",
"{",
"final",
"String",
"s0",
"=",
"firstString",
"==",
"null",
"?",
"\"\"",
":",
"firstString",
";",
"//$NON-NLS-1$",
"final",
"String",
"s1",... | Compute the Levenshstein distance between two strings.
<p>Null string is assimilated to the empty string.
@param firstString first string.
@param secondString second string.
@return the Levenshstein distance.
@see "https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance" | [
"Compute",
"the",
"Levenshstein",
"distance",
"between",
"two",
"strings",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1688-L1733 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java | SetLocaleSupport.findFormattingMatch | private static Locale findFormattingMatch(Locale pref, Locale[] avail) {
"""
/*
Returns the best match between the given preferred locale and the
given available locales.
The best match is given as the first available locale that exactly
matches the given preferred locale ("exact match"). If no exact match
exists, the best match is given to an available locale that meets
the following criteria (in order of priority):
- available locale's variant is empty and exact match for both
language and country
- available locale's variant and country are empty, and exact match
for language.
@param pref the preferred locale
@param avail the available formatting locales
@return Available locale that best matches the given preferred locale,
or <tt>null</tt> if no match exists
"""
Locale match = null;
boolean langAndCountryMatch = false;
for (Locale locale : avail) {
if (pref.equals(locale)) {
// Exact match
match = locale;
break;
} else if (
!"".equals(pref.getVariant()) &&
"".equals(locale.getVariant()) &&
pref.getLanguage().equals(locale.getLanguage()) &&
pref.getCountry().equals(locale.getCountry())) {
// Language and country match; different variant
match = locale;
langAndCountryMatch = true;
} else if (
!langAndCountryMatch &&
pref.getLanguage().equals(locale.getLanguage()) &&
("".equals(locale.getCountry()))) {
// Language match
if (match == null) {
match = locale;
}
}
}
return match;
} | java | private static Locale findFormattingMatch(Locale pref, Locale[] avail) {
Locale match = null;
boolean langAndCountryMatch = false;
for (Locale locale : avail) {
if (pref.equals(locale)) {
// Exact match
match = locale;
break;
} else if (
!"".equals(pref.getVariant()) &&
"".equals(locale.getVariant()) &&
pref.getLanguage().equals(locale.getLanguage()) &&
pref.getCountry().equals(locale.getCountry())) {
// Language and country match; different variant
match = locale;
langAndCountryMatch = true;
} else if (
!langAndCountryMatch &&
pref.getLanguage().equals(locale.getLanguage()) &&
("".equals(locale.getCountry()))) {
// Language match
if (match == null) {
match = locale;
}
}
}
return match;
} | [
"private",
"static",
"Locale",
"findFormattingMatch",
"(",
"Locale",
"pref",
",",
"Locale",
"[",
"]",
"avail",
")",
"{",
"Locale",
"match",
"=",
"null",
";",
"boolean",
"langAndCountryMatch",
"=",
"false",
";",
"for",
"(",
"Locale",
"locale",
":",
"avail",
... | /*
Returns the best match between the given preferred locale and the
given available locales.
The best match is given as the first available locale that exactly
matches the given preferred locale ("exact match"). If no exact match
exists, the best match is given to an available locale that meets
the following criteria (in order of priority):
- available locale's variant is empty and exact match for both
language and country
- available locale's variant and country are empty, and exact match
for language.
@param pref the preferred locale
@param avail the available formatting locales
@return Available locale that best matches the given preferred locale,
or <tt>null</tt> if no match exists | [
"/",
"*",
"Returns",
"the",
"best",
"match",
"between",
"the",
"given",
"preferred",
"locale",
"and",
"the",
"given",
"available",
"locales",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java#L373-L400 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java | DeploymentMetadataParse.parseProperties | protected void parseProperties(Element element, Map<String, String> properties) {
"""
Transform a
<pre>
<properties>
<property name="name">value</property>
</properties>
</pre>
structure into a properties {@link Map}
Supports resolution of Ant-style placeholders against system properties.
"""
for (Element childElement : element.elements()) {
if(PROPERTY.equals(childElement.getTagName())) {
String resolved = PropertyHelper.resolveProperty(System.getProperties(), childElement.getText());
properties.put(childElement.attribute(NAME), resolved);
}
}
} | java | protected void parseProperties(Element element, Map<String, String> properties) {
for (Element childElement : element.elements()) {
if(PROPERTY.equals(childElement.getTagName())) {
String resolved = PropertyHelper.resolveProperty(System.getProperties(), childElement.getText());
properties.put(childElement.attribute(NAME), resolved);
}
}
} | [
"protected",
"void",
"parseProperties",
"(",
"Element",
"element",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"for",
"(",
"Element",
"childElement",
":",
"element",
".",
"elements",
"(",
")",
")",
"{",
"if",
"(",
"PROPERTY",
"... | Transform a
<pre>
<properties>
<property name="name">value</property>
</properties>
</pre>
structure into a properties {@link Map}
Supports resolution of Ant-style placeholders against system properties. | [
"Transform",
"a",
"<pre",
">",
"<",
";",
"properties>",
";",
"<",
";",
"property",
"name",
"=",
"name",
">",
";",
"value<",
";",
"/",
"property>",
";",
"<",
";",
"/",
"properties>",
";",
"<",
"/",
"pre",
">",
"structure",
"into",
"a",
... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java#L171-L180 |
alkacon/opencms-core | src/org/opencms/ui/apps/sitemanager/CmsEditSiteForm.java | CmsEditSiteForm.createAliasComponent | protected FormLayout createAliasComponent(String alias, boolean red) {
"""
Creates field for aliases.<p>
@param alias url
@param red redirect
@return component
"""
FormLayout layout = new FormLayout();
TextField field = new TextField(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_0));
field.setWidth("100%");
field.setValue(alias);
field.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_HELP_0));
CheckBox redirect = new CheckBox(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_0), red);
redirect.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_HELP_0));
layout.addComponent(field);
layout.addComponent(redirect);
return layout;
} | java | protected FormLayout createAliasComponent(String alias, boolean red) {
FormLayout layout = new FormLayout();
TextField field = new TextField(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_0));
field.setWidth("100%");
field.setValue(alias);
field.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_HELP_0));
CheckBox redirect = new CheckBox(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_0), red);
redirect.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_HELP_0));
layout.addComponent(field);
layout.addComponent(redirect);
return layout;
} | [
"protected",
"FormLayout",
"createAliasComponent",
"(",
"String",
"alias",
",",
"boolean",
"red",
")",
"{",
"FormLayout",
"layout",
"=",
"new",
"FormLayout",
"(",
")",
";",
"TextField",
"field",
"=",
"new",
"TextField",
"(",
"CmsVaadinUtils",
".",
"getMessageTex... | Creates field for aliases.<p>
@param alias url
@param red redirect
@return component | [
"Creates",
"field",
"for",
"aliases",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsEditSiteForm.java#L1092-L1104 |
orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java | XYToAnyTransform.setTargetNormal | public void setTargetNormal( double nx, double ny, double nz ) {
"""
Assumes target normal is normalized
@param nx
@param ny
@param nz
"""
double h,f,c,vx,vy,hvx;
vx = ny;
vy = -nx;
c = nz;
h = (1-c)/(1-c*c);
hvx = h*vx;
f = (c < 0) ? -c : c;
if( f < 1.0 - 1.0E-4 )
{
m00=c + hvx*vx;
m01=hvx*vy;
m02=-vy;
m10=hvx*vy;
m11=c + h*vy*vy;
m12=vx;
m20=vy;
m21=-vx;
m22=c;
}
else
{
// if "from" and "to" vectors are nearly parallel
m00=1;
m01=0;
m02=0;
m10=0;
m11=1;
m12=0;
m20=0;
m21=0;
if( c > 0 )
{
m22=1;
}
else
{
m22=-1;
}
}
} | java | public void setTargetNormal( double nx, double ny, double nz )
{
double h,f,c,vx,vy,hvx;
vx = ny;
vy = -nx;
c = nz;
h = (1-c)/(1-c*c);
hvx = h*vx;
f = (c < 0) ? -c : c;
if( f < 1.0 - 1.0E-4 )
{
m00=c + hvx*vx;
m01=hvx*vy;
m02=-vy;
m10=hvx*vy;
m11=c + h*vy*vy;
m12=vx;
m20=vy;
m21=-vx;
m22=c;
}
else
{
// if "from" and "to" vectors are nearly parallel
m00=1;
m01=0;
m02=0;
m10=0;
m11=1;
m12=0;
m20=0;
m21=0;
if( c > 0 )
{
m22=1;
}
else
{
m22=-1;
}
}
} | [
"public",
"void",
"setTargetNormal",
"(",
"double",
"nx",
",",
"double",
"ny",
",",
"double",
"nz",
")",
"{",
"double",
"h",
",",
"f",
",",
"c",
",",
"vx",
",",
"vy",
",",
"hvx",
";",
"vx",
"=",
"ny",
";",
"vy",
"=",
"-",
"nx",
";",
"c",
"=",... | Assumes target normal is normalized
@param nx
@param ny
@param nz | [
"Assumes",
"target",
"normal",
"is",
"normalized"
] | train | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java#L28-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.